Keep track of whether the asm is volatile or not.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44297 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/Stmt.cpp b/AST/Stmt.cpp
index 9a4d434..6663d6f 100644
--- a/AST/Stmt.cpp
+++ b/AST/Stmt.cpp
@@ -112,6 +112,7 @@
}
AsmStmt::AsmStmt(SourceLocation asmloc,
+ bool isvolatile,
unsigned numoutputs,
unsigned numinputs,
std::string *names,
@@ -122,7 +123,7 @@
StringLiteral **clobbers,
SourceLocation rparenloc)
: Stmt(AsmStmtClass), AsmLoc(asmloc), RParenLoc(rparenloc), AsmStr(asmstr)
- , NumOutputs(numoutputs), NumInputs(numinputs)
+ , IsVolatile(isvolatile), NumOutputs(numoutputs), NumInputs(numinputs)
{
for (unsigned i = 0, e = numinputs + numoutputs; i != e; i++) {
Names.push_back(names[i]);
diff --git a/AST/StmtPrinter.cpp b/AST/StmtPrinter.cpp
index cc6ffda..c68257e 100644
--- a/AST/StmtPrinter.cpp
+++ b/AST/StmtPrinter.cpp
@@ -326,7 +326,12 @@
void StmtPrinter::VisitAsmStmt(AsmStmt *Node) {
- Indent() << "asm (";
+ Indent() << "asm ";
+
+ if (Node->isVolatile())
+ OS << "volatile ";
+
+ OS << "(";
VisitStringLiteral(Node->getAsmString());
// Outputs
diff --git a/AST/StmtSerialization.cpp b/AST/StmtSerialization.cpp
index 46f8559..3134f88 100644
--- a/AST/StmtSerialization.cpp
+++ b/AST/StmtSerialization.cpp
@@ -201,6 +201,7 @@
getAsmString()->EmitImpl(S);
S.Emit(RParenLoc);
+ S.EmitBool(IsVolatile);
S.EmitInt(NumOutputs);
S.EmitInt(NumInputs);
@@ -225,7 +226,8 @@
StringLiteral *AsmStr = StringLiteral::CreateImpl(D);
SourceLocation PLoc = SourceLocation::ReadVal(D);
- AsmStmt *Stmt = new AsmStmt(ALoc, 0, 0, 0, 0, 0,
+ bool IsVolatile = D.ReadBool();
+ AsmStmt *Stmt = new AsmStmt(ALoc, IsVolatile, 0, 0, 0, 0, 0,
AsmStr,
0, 0, PLoc);