]> granicus.if.org Git - clang/commitdiff
[ms-inline asm] Add inputs and outputs to AST. No functional change.
authorChad Rosier <mcrosier@apple.com>
Thu, 16 Aug 2012 00:06:53 +0000 (00:06 +0000)
committerChad Rosier <mcrosier@apple.com>
Thu, 16 Aug 2012 00:06:53 +0000 (00:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162000 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Stmt.h
lib/AST/Stmt.cpp
lib/Sema/SemaStmt.cpp

index 943e005d1f2ba50534a44ea976640c74f0039f4c..47dada86ddf19d25bb3dcd19728b92041197364d 100644 (file)
@@ -1627,15 +1627,19 @@ class MSAsmStmt : public Stmt {
   bool IsVolatile;
 
   unsigned NumAsmToks;
+  unsigned NumInputs;
+  unsigned NumOutputs;
   unsigned NumClobbers;
 
   Token *AsmToks;
+  IdentifierInfo **Names;
   Stmt **Exprs;
   StringRef *Clobbers;
 
 public:
   MSAsmStmt(ASTContext &C, SourceLocation asmloc, SourceLocation lbraceloc,
             bool issimple, bool isvolatile, ArrayRef<Token> asmtoks,
+            ArrayRef<IdentifierInfo*> inputs, ArrayRef<IdentifierInfo*> outputs,
             StringRef asmstr, ArrayRef<StringRef> clobbers,
             SourceLocation endloc);
 
index 680ebc81c8eacc51039526d70f1448851bbc3d44..77452c9d9d1c271824fff7e8cebd083d3e4dc4b8 100644 (file)
@@ -583,14 +583,23 @@ AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
   std::copy(clobbers, clobbers + NumClobbers, Clobbers);
 }
 
-MSAsmStmt::MSAsmStmt(ASTContext &C,
-                     SourceLocation asmloc, SourceLocation lbraceloc,
-                     bool issimple, bool isvolatile, ArrayRef<Token> asmtoks,
-                     StringRef asmstr, ArrayRef<StringRef> clobbers,
-                     SourceLocation endloc)
+MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc,
+                     SourceLocation lbraceloc, bool issimple, bool isvolatile,
+                     ArrayRef<Token> asmtoks, ArrayRef<IdentifierInfo*> inputs,
+                     ArrayRef<IdentifierInfo*> outputs, StringRef asmstr,
+                     ArrayRef<StringRef> clobbers, SourceLocation endloc)
   : Stmt(MSAsmStmtClass), AsmLoc(asmloc), LBraceLoc(lbraceloc), EndLoc(endloc),
     AsmStr(asmstr.str()), IsSimple(issimple), IsVolatile(isvolatile),
-    NumAsmToks(asmtoks.size()), NumClobbers(clobbers.size()) {
+    NumAsmToks(asmtoks.size()), NumInputs(inputs.size()),
+    NumOutputs(outputs.size()), NumClobbers(clobbers.size()) {
+
+  unsigned NumExprs = NumOutputs + NumInputs;
+
+  Names = new (C) IdentifierInfo*[NumExprs];
+  for (unsigned i = 0, e = NumOutputs; i != e; ++i)
+    Names[i] = outputs[i];
+  for (unsigned i = NumOutputs, e = NumExprs; i != e; ++i)
+    Names[i] = inputs[i];
 
   AsmToks = new (C) Token[NumAsmToks];
   for (unsigned i = 0, e = NumAsmToks; i != e; ++i)
index 27e420fadcb24ceb232de70942df8813a55897d2..b14c7c411633355ab3137648a27a9a35e199b10b 100644 (file)
@@ -2880,14 +2880,16 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
   Diag(AsmLoc, diag::warn_unsupported_msasm);
   SmallVector<StringRef,4> Clobbers;
   std::set<std::string> ClobberRegs;
+  SmallVector<IdentifierInfo*, 4> Inputs;
+  SmallVector<IdentifierInfo*, 4> Outputs;
 
   // Empty asm statements don't need to instantiate the AsmParser, etc.
   if (AsmToks.empty()) {
     StringRef AsmString;
     MSAsmStmt *NS =
-      new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc,
-                              /* IsSimple */ true, /* IsVolatile */ true,
-                              AsmToks, AsmString, Clobbers, EndLoc);
+      new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, /*IsSimple*/ true,
+                              /*IsVolatile*/ true, AsmToks, Inputs, Outputs,
+                              AsmString, Clobbers, EndLoc);
     return Owned(NS);
   }
 
@@ -2905,9 +2907,9 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
   // patchMSAsmStrings doesn't correctly patch non-simple asm statements.
   if (!IsSimple) {
     MSAsmStmt *NS =
-      new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc,
-                              /* IsSimple */ true, /* IsVolatile */ true,
-                              AsmToks, AsmString, Clobbers, EndLoc);
+      new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, /*IsSimple*/ true,
+                              /*IsVolatile*/ true, AsmToks, Inputs, Outputs,
+                              AsmString, Clobbers, EndLoc);
     return Owned(NS);
   }
 
@@ -2999,10 +3001,9 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
     Clobbers.push_back(*I);
 
   MSAsmStmt *NS =
-    new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc,
-                            IsSimple, /* IsVolatile */ true,
-                            AsmToks, AsmString, Clobbers, EndLoc);
-
+    new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, IsSimple,
+                            /*IsVolatile*/ true, AsmToks, Inputs, Outputs,
+                            AsmString, Clobbers, EndLoc);
   return Owned(NS);
 }