]> granicus.if.org Git - clang/commitdiff
[ms-inline asm] Update the AST Reader/Writer for MS-style inline asms.
authorChad Rosier <mcrosier@apple.com>
Fri, 24 Aug 2012 23:51:02 +0000 (23:51 +0000)
committerChad Rosier <mcrosier@apple.com>
Fri, 24 Aug 2012 23:51:02 +0000 (23:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162629 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Stmt.h
include/clang/Serialization/ASTBitCodes.h
lib/Serialization/ASTReaderStmt.cpp
lib/Serialization/ASTWriter.cpp
lib/Serialization/ASTWriterStmt.cpp

index 97598db6d296e7205bccaec89e22677273a0a51a..4b7cd1cc8130a3b08c12dfb694e8378464926427 100644 (file)
@@ -1637,6 +1637,11 @@ public:
             StringRef asmstr, ArrayRef<StringRef> clobbers,
             SourceLocation endloc);
 
+  /// \brief Build an empty MS-style inline-assembly statement.
+  explicit MSAsmStmt(EmptyShell Empty) : Stmt(MSAsmStmtClass, Empty),
+    NumAsmToks(0), NumInputs(0), NumOutputs(0), NumClobbers(0), AsmToks(0),
+    Names(0), Exprs(0), Clobbers(0) { }
+
   SourceLocation getAsmLoc() const { return AsmLoc; }
   void setAsmLoc(SourceLocation L) { AsmLoc = L; }
   SourceLocation getLBraceLoc() const { return LBraceLoc; }
index dbe6e5a31440e7f09d307112529c8f5bbbcb863f..2f6c1de0d6065c8257fc333eb38f6bb61ed68308 100644 (file)
@@ -1001,6 +1001,8 @@ namespace clang {
       STMT_DECL,
       /// \brief An AsmStmt record.
       STMT_ASM,
+      /// \brief A MS-style AsmStmt record.
+      STMT_MSASM,
       /// \brief A PredefinedExpr record.
       EXPR_PREDEFINED,
       /// \brief A DeclRefExpr record.
index e6f62f8d9d14edddbe8b6c2d6823fc5d0c706281..e616faa1a49be7a6fe6b7a2474b1029db9871074 100644 (file)
@@ -1704,6 +1704,10 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
       S = new (Context) AsmStmt(Empty);
       break;
 
+    case STMT_MSASM:
+      S = new (Context) MSAsmStmt(Empty);
+      break;
+
     case EXPR_PREDEFINED:
       S = new (Context) PredefinedExpr(Empty);
       break;
index 7ee3c9a21b99de7bead662ede8ad265da9f810de..28ae08be180d8b681ff815262d09180008d6ee2f 100644 (file)
@@ -668,6 +668,7 @@ static void AddStmtsExprs(llvm::BitstreamWriter &Stream,
   RECORD(STMT_RETURN);
   RECORD(STMT_DECL);
   RECORD(STMT_ASM);
+  RECORD(STMT_MSASM);
   RECORD(EXPR_PREDEFINED);
   RECORD(EXPR_DECL_REF);
   RECORD(EXPR_INTEGER_LITERAL);
index 9f12b8a48efa2411ccc1e3ef0ea377d1a1dab4f0..9ae3e129a9514c003b2574a61a99aff2152eebed 100644 (file)
@@ -253,6 +253,8 @@ void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) {
 void ASTStmtWriter::VisitMSAsmStmt(MSAsmStmt *S) {
   // FIXME: Statement writer not yet implemented for MS style inline asm.
   VisitStmt(S);
+
+  Code = serialization::STMT_MSASM;
 }
 
 void ASTStmtWriter::VisitExpr(Expr *E) {