]> granicus.if.org Git - clang/commitdiff
Remember if the AsmStmt came from Microsoft-style inline assembly code.
authorMike Stump <mrs@apple.com>
Mon, 4 Jan 2010 22:37:17 +0000 (22:37 +0000)
committerMike Stump <mrs@apple.com>
Mon, 4 Jan 2010 22:37:17 +0000 (22:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92526 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Stmt.h
include/clang/Parse/Action.h
lib/AST/Stmt.cpp
lib/Frontend/PCHReaderStmt.cpp
lib/Frontend/PCHWriterStmt.cpp
lib/Parse/ParseStmt.cpp
lib/Sema/Sema.h
lib/Sema/SemaStmt.cpp

index 33edadc3a5e64356d124b5f5a255257dec56b7ce..614723234dbe0eea262c41f565f5731c354ed8c5 100644 (file)
@@ -1116,6 +1116,7 @@ class AsmStmt : public Stmt {
 
   bool IsSimple;
   bool IsVolatile;
+  bool MSAsm;
 
   unsigned NumOutputs;
   unsigned NumInputs;
@@ -1126,7 +1127,7 @@ class AsmStmt : public Stmt {
 
   llvm::SmallVector<StringLiteral*, 4> Clobbers;
 public:
-  AsmStmt(SourceLocation asmloc, bool issimple, bool isvolatile,
+  AsmStmt(SourceLocation asmloc, bool issimple, bool isvolatile, bool msasm,
           unsigned numoutputs, unsigned numinputs,
           std::string *names, StringLiteral **constraints,
           Expr **exprs, StringLiteral *asmstr, unsigned numclobbers,
@@ -1144,6 +1145,8 @@ public:
   void setVolatile(bool V) { IsVolatile = V; }
   bool isSimple() const { return IsSimple; }
   void setSimple(bool V) { IsSimple = false; }
+  bool isMSAsm() const { return MSAsm; }
+  void setMSAsm(bool V) { MSAsm = V; }
 
   //===--- Asm String Analysis ---===//
 
index 4cbc21ad014ae36d723f1953ffc31b4a8bb732c7..591ec47a681b4800538b9d8f1c5f5125283c4ab0 100644 (file)
@@ -866,7 +866,8 @@ public:
                                         MultiExprArg Exprs,
                                         ExprArg AsmString,
                                         MultiExprArg Clobbers,
-                                        SourceLocation RParenLoc) {
+                                        SourceLocation RParenLoc,
+                                        bool MSAsm = false) {
     return StmtEmpty();
   }
 
index 7c7aeb8d3e1df2fddc4bf430d3a61515bfb0a90b..104e3361892f062d113be442e0a715ca0ad35e1c 100644 (file)
@@ -337,12 +337,12 @@ unsigned AsmStmt::AnalyzeAsmString(llvm::SmallVectorImpl<AsmStringPiece>&Pieces,
 //===----------------------------------------------------------------------===//
 
 AsmStmt::AsmStmt(SourceLocation asmloc, bool issimple, bool isvolatile,
-                 unsigned numoutputs, unsigned numinputs,
+                 bool msasm, unsigned numoutputs, unsigned numinputs,
                  std::string *names, StringLiteral **constraints,
                  Expr **exprs, StringLiteral *asmstr, unsigned numclobbers,
                  StringLiteral **clobbers, SourceLocation rparenloc)
   : Stmt(AsmStmtClass), AsmLoc(asmloc), RParenLoc(rparenloc), AsmStr(asmstr)
-  , IsSimple(issimple), IsVolatile(isvolatile)
+  , IsSimple(issimple), IsVolatile(isvolatile), MSAsm(msasm)
   , NumOutputs(numoutputs), NumInputs(numinputs) {
   for (unsigned i = 0, e = numinputs + numoutputs; i != e; i++) {
     Names.push_back(names[i]);
index ba82d26010268e279231bd8a267ec26409b14f65..c108f549ab2aba4a94a27b6b639ec6dff1d2a0f5 100644 (file)
@@ -304,6 +304,7 @@ unsigned PCHStmtReader::VisitAsmStmt(AsmStmt *S) {
   S->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
   S->setVolatile(Record[Idx++]);
   S->setSimple(Record[Idx++]);
+  S->setMSAsm(Record[Idx++]);
 
   unsigned StackIdx
     = StmtStack.size() - (NumOutputs*2 + NumInputs*2 + NumClobbers + 1);
index abf4eaa0f8aa9e793d3a5839760e5bdd4360a82b..4be9b817ed82e5d66a8cbd79bd4fdc0b418fcc83 100644 (file)
@@ -277,6 +277,7 @@ void PCHStmtWriter::VisitAsmStmt(AsmStmt *S) {
   Writer.AddSourceLocation(S->getRParenLoc(), Record);
   Record.push_back(S->isVolatile());
   Record.push_back(S->isSimple());
+  Record.push_back(S->isMSAsm());
   Writer.WriteSubStmt(S->getAsmString());
 
   // Outputs
index 9085b8713dfdc6b595196bfc997c13df914e4de1..277cc91d37c4537c393c32932f875649a657714d 100644 (file)
@@ -1182,7 +1182,7 @@ Parser::OwningStmtResult Parser::FuzzyParseMicrosoftAsmStatement() {
   return Actions.ActOnAsmStmt(Tok.getLocation(), true, true, 0, 0, Names.data(),
                               move_arg(Constraints), move_arg(Exprs),
                               move(AsmString), move_arg(Clobbers),
-                              Tok.getLocation());
+                              Tok.getLocation(), true);
 }
 
 /// ParseAsmStatement - Parse a GNU extended asm statement.
index 110a6268355fac03a89e32b64e02e30d98f4ea71..df25025d7737da62e7f75c4fe02702bb2ab8d645 100644 (file)
@@ -1383,7 +1383,8 @@ public:
                                         MultiExprArg Exprs,
                                         ExprArg AsmString,
                                         MultiExprArg Clobbers,
-                                        SourceLocation RParenLoc);
+                                        SourceLocation RParenLoc,
+                                        bool MSAsm = false);
 
   virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
                                                 SourceLocation RParen,
index b8928c36e7b8af3878705485dd24a207e5afd9e9..7855a7f60935945749a2647fa97cf1b9e4e392fe 100644 (file)
@@ -1157,7 +1157,8 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
                                           MultiExprArg exprs,
                                           ExprArg asmString,
                                           MultiExprArg clobbers,
-                                          SourceLocation RParenLoc) {
+                                          SourceLocation RParenLoc,
+                                          bool MSAsm) {
   unsigned NumClobbers = clobbers.size();
   StringLiteral **Constraints =
     reinterpret_cast<StringLiteral**>(constraints.get());
@@ -1261,9 +1262,9 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
   asmString.release();
   clobbers.release();
   AsmStmt *NS =
-    new (Context) AsmStmt(AsmLoc, IsSimple, IsVolatile, NumOutputs, NumInputs,
-                          Names, Constraints, Exprs, AsmString, NumClobbers,
-                          Clobbers, RParenLoc);
+    new (Context) AsmStmt(AsmLoc, IsSimple, IsVolatile, MSAsm, NumOutputs,
+                          NumInputs, Names, Constraints, Exprs, AsmString,
+                          NumClobbers, Clobbers, RParenLoc);
   // Validate the asm string, ensuring it makes sense given the operands we
   // have.
   llvm::SmallVector<AsmStmt::AsmStringPiece, 8> Pieces;