diff options
-rw-r--r-- | include/clang/AST/Stmt.h | 7 | ||||
-rw-r--r-- | include/clang/Sema/Sema.h | 1 | ||||
-rw-r--r-- | lib/AST/Stmt.cpp | 11 | ||||
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 6 | ||||
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 11 | ||||
-rw-r--r-- | lib/Sema/TreeTransform.h | 9 |
6 files changed, 12 insertions, 33 deletions
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index 79e1920159..fc0c0810c5 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -1627,18 +1627,15 @@ class MSAsmStmt : public Stmt { bool IsVolatile; unsigned NumAsmToks; - unsigned NumLineEnds; unsigned NumClobbers; Token *AsmToks; - unsigned *LineEnds; Stmt **Exprs; StringRef *Clobbers; public: MSAsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, - bool isvolatile, ArrayRef<Token> asmtoks, - ArrayRef<unsigned> lineends, StringRef asmstr, + bool isvolatile, ArrayRef<Token> asmtoks, StringRef asmstr, ArrayRef<StringRef> clobbers, SourceLocation endloc); SourceLocation getAsmLoc() const { return AsmLoc; } @@ -1648,8 +1645,6 @@ public: unsigned getNumAsmToks() { return NumAsmToks; } Token *getAsmToks() { return AsmToks; } - unsigned getNumLineEnds() { return NumLineEnds; } - unsigned *getLineEnds() { return LineEnds; } bool isVolatile() const { return IsVolatile; } void setVolatile(bool V) { IsVolatile = V; } diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 058e0d9d39..2cd58279d4 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -2543,7 +2543,6 @@ public: StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, ArrayRef<Token> AsmToks, - ArrayRef<unsigned> LineEnds, SourceLocation EndLoc); VarDecl *BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index d877c3fab7..9aa7f5ba55 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -585,21 +585,16 @@ AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, bool isvolatile, ArrayRef<Token> asmtoks, - ArrayRef<unsigned> lineends, StringRef asmstr, - ArrayRef<StringRef> clobbers, SourceLocation endloc) + StringRef asmstr, ArrayRef<StringRef> clobbers, + SourceLocation endloc) : Stmt(MSAsmStmtClass), AsmLoc(asmloc), EndLoc(endloc), AsmStr(asmstr.str()), IsSimple(issimple), IsVolatile(isvolatile), - NumAsmToks(asmtoks.size()), NumLineEnds(lineends.size()), - NumClobbers(clobbers.size()) { + NumAsmToks(asmtoks.size()), NumClobbers(clobbers.size()) { AsmToks = new (C) Token[NumAsmToks]; for (unsigned i = 0, e = NumAsmToks; i != e; ++i) AsmToks[i] = asmtoks[i]; - LineEnds = new (C) unsigned[NumLineEnds]; - for (unsigned i = 0, e = NumLineEnds; i != e; ++i) - LineEnds[i] = lineends[i]; - Clobbers = new (C) StringRef[NumClobbers]; for (unsigned i = 0, e = NumClobbers; i != e; ++i) { // FIXME: Avoid the allocation/copy if at all possible. diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 915a62ea16..0ff1c8a96a 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -1657,7 +1657,6 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { SourceManager &SrcMgr = PP.getSourceManager(); SourceLocation EndLoc = AsmLoc; SmallVector<Token, 4> AsmToks; - SmallVector<unsigned, 4> LineEnds; bool InBraces = false; unsigned short savedBraceCount = 0; @@ -1741,8 +1740,6 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { ++NumTokensRead; } while (1); - LineEnds.push_back(AsmToks.size()); - if (InBraces && BraceCount != savedBraceCount) { // __asm without closing brace (this can happen at EOF). Diag(Tok, diag::err_expected_rbrace); @@ -1755,8 +1752,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { } // FIXME: We should be passing source locations for better diagnostics. - return Actions.ActOnMSAsmStmt(AsmLoc, llvm::makeArrayRef(AsmToks), - llvm::makeArrayRef(LineEnds), EndLoc); + return Actions.ActOnMSAsmStmt(AsmLoc, llvm::makeArrayRef(AsmToks), EndLoc); } /// ParseAsmStatement - Parse a GNU extended asm statement. diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 5ad6e08654..1c2b6a41c0 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -2849,7 +2849,6 @@ static std::string buildMSAsmString(Sema &SemaRef, StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, ArrayRef<Token> AsmToks, - ArrayRef<unsigned> LineEnds, SourceLocation EndLoc) { // MS-style inline assembly is not fully supported, so emit a warning. Diag(AsmLoc, diag::warn_unsupported_msasm); @@ -2860,8 +2859,8 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, StringRef AsmString; MSAsmStmt *NS = new (Context) MSAsmStmt(Context, AsmLoc, /* IsSimple */ true, - /* IsVolatile */ true, AsmToks, LineEnds, - AsmString, Clobbers, EndLoc); + /* IsVolatile */ true, AsmToks, AsmString, + Clobbers, EndLoc); return Owned(NS); } @@ -2886,8 +2885,8 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, if (!IsSimple) { MSAsmStmt *NS = new (Context) MSAsmStmt(Context, AsmLoc, /* IsSimple */ true, - /* IsVolatile */ true, AsmToks, LineEnds, - AsmString, Clobbers, EndLoc); + /* IsVolatile */ true, AsmToks, AsmString, + Clobbers, EndLoc); return Owned(NS); } @@ -2930,7 +2929,7 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, MSAsmStmt *NS = new (Context) MSAsmStmt(Context, AsmLoc, IsSimple, /* IsVolatile */ true, - AsmToks, LineEnds, AsmString, Clobbers, EndLoc); + AsmToks, AsmString, Clobbers, EndLoc); return Owned(NS); } diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 73f42d9646..0516768ac4 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -1186,9 +1186,8 @@ public: /// Subclasses may override this routine to provide different behavior. StmtResult RebuildMSAsmStmt(SourceLocation AsmLoc, ArrayRef<Token> AsmToks, - ArrayRef<unsigned> LineEnds, SourceLocation EndLoc) { - return getSema().ActOnMSAsmStmt(AsmLoc, AsmToks, LineEnds, EndLoc); + return getSema().ActOnMSAsmStmt(AsmLoc, AsmToks, EndLoc); } /// \brief Build a new Objective-C \@try statement. @@ -5610,12 +5609,8 @@ StmtResult TreeTransform<Derived>::TransformMSAsmStmt(MSAsmStmt *S) { ArrayRef<Token> AsmToks = llvm::makeArrayRef(S->getAsmToks(), S->getNumAsmToks()); - ArrayRef<unsigned> LineEnds = - llvm::makeArrayRef(S->getLineEnds(), S->getNumLineEnds()); - // No need to transform the asm string literal. - return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), AsmToks, LineEnds, - S->getEndLoc()); + return getDerived().RebuildMSAsmStmt(S->getAsmLoc(), AsmToks, S->getEndLoc()); } template<typename Derived> |