diff --git a/AST/StmtPrinter.cpp b/AST/StmtPrinter.cpp index 668902708d..74d94eacf6 100644 --- a/AST/StmtPrinter.cpp +++ b/AST/StmtPrinter.cpp @@ -536,7 +536,7 @@ void StmtPrinter::VisitCharacterLiteral(CharacterLiteral *Node) { OS << "'\\v'"; break; default: - if (isprint(value) && value < 256) { + if (value < 256 && isprint(value)) { OS << "'" << (char)value << "'"; } else if (value < 256) { OS << "'\\x" << std::hex << value << std::dec << "'"; diff --git a/AST/StmtSerialization.cpp b/AST/StmtSerialization.cpp index 0b3f231ba7..a2006057bf 100644 --- a/AST/StmtSerialization.cpp +++ b/AST/StmtSerialization.cpp @@ -270,7 +270,10 @@ AsmStmt* AsmStmt::CreateImpl(Deserializer& D) { std::vector data; D.ReadCStr(data, false); - Stmt->Names.push_back(std::string(&data[0], data.size())); + if (data.size() == 0) + Stmt->Names.push_back(std::string()); + else + Stmt->Names.push_back(std::string(&data[0], data.size())); } Stmt->Constraints.reserve(size);