[ms-inline asm] Use StringRef here, per Jordan's suggestion.
authorChad Rosier <mcrosier@apple.com>
Thu, 9 Aug 2012 21:06:32 +0000 (21:06 +0000)
committerChad Rosier <mcrosier@apple.com>
Thu, 9 Aug 2012 21:06:32 +0000 (21:06 +0000)
llvm-svn: 161619

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

index 5a082b7..f119637 100644 (file)
@@ -1636,7 +1636,7 @@ class MSAsmStmt : public Stmt {
 public:
   MSAsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
             bool isvolatile, ArrayRef<Token> asmtoks,
-            ArrayRef<unsigned> lineends, std::string &asmstr,
+            ArrayRef<unsigned> lineends, StringRef asmstr,
             SourceLocation endloc);
 
   SourceLocation getAsmLoc() const { return AsmLoc; }
index e5ff75e..f676711 100644 (file)
@@ -585,10 +585,10 @@ AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
 
 MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc,
                      bool issimple, bool isvolatile, ArrayRef<Token> asmtoks,
-                     ArrayRef<unsigned> lineends, std::string &asmstr,
+                     ArrayRef<unsigned> lineends, StringRef asmstr,
                      SourceLocation endloc)
   : Stmt(MSAsmStmtClass), AsmLoc(asmloc), EndLoc(endloc),
-    AsmStr(asmstr), IsSimple(issimple), IsVolatile(isvolatile),
+    AsmStr(asmstr.str()), IsSimple(issimple), IsVolatile(isvolatile),
     NumAsmToks(asmtoks.size()), NumLineEnds(lineends.size()) {
 
   AsmToks = new (C) Token[NumAsmToks];
index 856a602..944fc40 100644 (file)
@@ -2890,7 +2890,7 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
 
   // Empty asm statements don't need to instantiate the AsmParser, etc.
   if (AsmToks.empty()) {
-    std::string AsmString;
+    StringRef AsmString;
     MSAsmStmt *NS =
       new (Context) MSAsmStmt(Context, AsmLoc, /* IsSimple */ true,
                               /* IsVolatile */ true, AsmToks, LineEnds,