From: Chad Rosier Date: Sat, 25 Aug 2012 00:11:56 +0000 (+0000) Subject: [ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df5faf5e7ae6823d0af0b801c4ac26d47f2cee97;p=clang [ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162632 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index ca4a960d13..1347f6c167 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -1904,9 +1904,9 @@ enum CXCursorKind { */ CXCursor_ReturnStmt = 214, - /** \brief A GNU inline assembly statement extension. + /** \brief A GCC inline assembly statement extension. */ - CXCursor_AsmStmt = 215, + CXCursor_GCCAsmStmt = 215, /** \brief Objective-C's overall \@try-\@catch-\@finally statement. */ diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index 8b0a64e1e9..c24b0a9c43 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -1827,7 +1827,7 @@ bool RecursiveASTVisitor::Traverse##STMT (STMT *S) { \ return true; \ } -DEF_TRAVERSE_STMT(AsmStmt, { +DEF_TRAVERSE_STMT(GCCAsmStmt, { TRY_TO(TraverseStmt(S->getAsmString())); for (unsigned I = 0, E = S->getNumInputs(); I < E; ++I) { TRY_TO(TraverseStmt(S->getInputConstraintLiteral(I))); diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index 4b7cd1cc81..5969d53a7b 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -1363,9 +1363,9 @@ public: } }; -/// AsmStmt - This represents a GNU inline-assembly statement extension. +/// AsmStmt - This represents a GCC inline-assembly statement extension. /// -class AsmStmt : public Stmt { +class GCCAsmStmt : public Stmt { SourceLocation AsmLoc, RParenLoc; StringLiteral *AsmStr; @@ -1383,14 +1383,14 @@ class AsmStmt : public Stmt { StringLiteral **Clobbers; public: - AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, bool isvolatile, - unsigned numoutputs, unsigned numinputs, IdentifierInfo **names, - StringLiteral **constraints, Expr **exprs, StringLiteral *asmstr, - unsigned numclobbers, StringLiteral **clobbers, - SourceLocation rparenloc); + GCCAsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, + bool isvolatile, unsigned numoutputs, unsigned numinputs, + IdentifierInfo **names, StringLiteral **constraints, Expr **exprs, + StringLiteral *asmstr, unsigned numclobbers, + StringLiteral **clobbers, SourceLocation rparenloc); /// \brief Build an empty inline-assembly statement. - explicit AsmStmt(EmptyShell Empty) : Stmt(AsmStmtClass, Empty), + explicit GCCAsmStmt(EmptyShell Empty) : Stmt(GCCAsmStmtClass, Empty), Names(0), Constraints(0), Exprs(0), Clobbers(0) { } SourceLocation getAsmLoc() const { return AsmLoc; } @@ -1491,7 +1491,7 @@ public: Expr *getOutputExpr(unsigned i); const Expr *getOutputExpr(unsigned i) const { - return const_cast(this)->getOutputExpr(i); + return const_cast(this)->getOutputExpr(i); } /// isOutputPlusConstraint - Return true if the specified output constraint @@ -1535,7 +1535,7 @@ public: void setInputExpr(unsigned i, Expr *E); const Expr *getInputExpr(unsigned i) const { - return const_cast(this)->getInputExpr(i); + return const_cast(this)->getInputExpr(i); } void setOutputsAndInputsAndClobbers(ASTContext &C, @@ -1562,8 +1562,10 @@ public: return SourceRange(AsmLoc, RParenLoc); } - static bool classof(const Stmt *T) {return T->getStmtClass() == AsmStmtClass;} - static bool classof(const AsmStmt *) { return true; } + static bool classof(const Stmt *T) { + return T->getStmtClass() == GCCAsmStmtClass; + } + static bool classof(const GCCAsmStmt *) { return true; } // Input expr iterators. @@ -1610,7 +1612,7 @@ public: } }; -/// MSAsmStmt - This represents a MS inline-assembly statement extension. +/// MSAsmStmt - This represents a Microsoft inline-assembly statement extension. /// class MSAsmStmt : public Stmt { SourceLocation AsmLoc, LBraceLoc, EndLoc; diff --git a/include/clang/Basic/StmtNodes.td b/include/clang/Basic/StmtNodes.td index 47738af290..a4d09f21cd 100644 --- a/include/clang/Basic/StmtNodes.td +++ b/include/clang/Basic/StmtNodes.td @@ -29,7 +29,7 @@ def CaseStmt : DStmt; def DefaultStmt : DStmt; // GNU Extensions -def AsmStmt : Stmt; +def GCCAsmStmt : Stmt; // MS Extensions def MSAsmStmt : Stmt; diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 600d6299bc..b0afc98006 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -2569,20 +2569,15 @@ public: StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp); StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp); - StmtResult ActOnAsmStmt(SourceLocation AsmLoc, - bool IsSimple, bool IsVolatile, - unsigned NumOutputs, unsigned NumInputs, - IdentifierInfo **Names, - MultiExprArg Constraints, - MultiExprArg Exprs, - Expr *AsmString, - MultiExprArg Clobbers, - SourceLocation RParenLoc); - - StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, - SourceLocation LBraceLoc, - ArrayRef AsmToks, - SourceLocation EndLoc); + StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, + bool IsVolatile, unsigned NumOutputs, + unsigned NumInputs, IdentifierInfo **Names, + MultiExprArg Constraints, MultiExprArg Exprs, + Expr *AsmString, MultiExprArg Clobbers, + SourceLocation RParenLoc); + + StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, + ArrayRef AsmToks, SourceLocation EndLoc); VarDecl *BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h index 2f6c1de0d6..2f9e1c21b6 100644 --- a/include/clang/Serialization/ASTBitCodes.h +++ b/include/clang/Serialization/ASTBitCodes.h @@ -999,8 +999,8 @@ namespace clang { STMT_RETURN, /// \brief A DeclStmt record. STMT_DECL, - /// \brief An AsmStmt record. - STMT_ASM, + /// \brief A GCC-style AsmStmt record. + STMT_GCCASM, /// \brief A MS-style AsmStmt record. STMT_MSASM, /// \brief A PredefinedExpr record. diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h index e3826584ee..158a903a68 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h @@ -283,13 +283,14 @@ public: ExplodedNode *Pred, ExplodedNodeSet &Dst); - /// VisitAsmStmt - Transfer function logic for inline asm. - void VisitAsmStmt(const AsmStmt *A, ExplodedNode *Pred, ExplodedNodeSet &Dst); + /// VisitGCCAsmStmt - Transfer function logic for inline asm. + void VisitGCCAsmStmt(const GCCAsmStmt *A, ExplodedNode *Pred, + ExplodedNodeSet &Dst); /// VisitMSAsmStmt - Transfer function logic for MS inline asm. void VisitMSAsmStmt(const MSAsmStmt *A, ExplodedNode *Pred, ExplodedNodeSet &Dst); - + /// VisitBlockExpr - Transfer function logic for BlockExprs. void VisitBlockExpr(const BlockExpr *BE, ExplodedNode *Pred, ExplodedNodeSet &Dst); diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index ec9b4c4568..68e53cc901 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -321,20 +321,20 @@ bool Stmt::hasImplicitControlFlow() const { } } -Expr *AsmStmt::getOutputExpr(unsigned i) { +Expr *GCCAsmStmt::getOutputExpr(unsigned i) { return cast(Exprs[i]); } /// getOutputConstraint - Return the constraint string for the specified /// output operand. All output constraints are known to be non-empty (either /// '=' or '+'). -StringRef AsmStmt::getOutputConstraint(unsigned i) const { +StringRef GCCAsmStmt::getOutputConstraint(unsigned i) const { return getOutputConstraintLiteral(i)->getString(); } /// getNumPlusOperands - Return the number of output operands that have a "+" /// constraint. -unsigned AsmStmt::getNumPlusOperands() const { +unsigned GCCAsmStmt::getNumPlusOperands() const { unsigned Res = 0; for (unsigned i = 0, e = getNumOutputs(); i != e; ++i) if (isOutputPlusConstraint(i)) @@ -342,22 +342,22 @@ unsigned AsmStmt::getNumPlusOperands() const { return Res; } -Expr *AsmStmt::getInputExpr(unsigned i) { +Expr *GCCAsmStmt::getInputExpr(unsigned i) { return cast(Exprs[i + NumOutputs]); } -void AsmStmt::setInputExpr(unsigned i, Expr *E) { +void GCCAsmStmt::setInputExpr(unsigned i, Expr *E) { Exprs[i + NumOutputs] = E; } /// getInputConstraint - Return the specified input constraint. Unlike output /// constraints, these can be empty. -StringRef AsmStmt::getInputConstraint(unsigned i) const { +StringRef GCCAsmStmt::getInputConstraint(unsigned i) const { return getInputConstraintLiteral(i)->getString(); } -void AsmStmt::setOutputsAndInputsAndClobbers(ASTContext &C, +void GCCAsmStmt::setOutputsAndInputsAndClobbers(ASTContext &C, IdentifierInfo **Names, StringLiteral **Constraints, Stmt **Exprs, @@ -391,7 +391,7 @@ void AsmStmt::setOutputsAndInputsAndClobbers(ASTContext &C, /// getNamedOperand - Given a symbolic operand reference like %[foo], /// translate this into a numeric value needed to reference the same operand. /// This returns -1 if the operand name is invalid. -int AsmStmt::getNamedOperand(StringRef SymbolicName) const { +int GCCAsmStmt::getNamedOperand(StringRef SymbolicName) const { unsigned NumPlusOperands = 0; // Check if this is an output operand. @@ -411,7 +411,7 @@ int AsmStmt::getNamedOperand(StringRef SymbolicName) const { /// AnalyzeAsmString - Analyze the asm string of the current asm, decomposing /// it into pieces. If the asm string is erroneous, emit errors and return /// true, otherwise return false. -unsigned AsmStmt::AnalyzeAsmString(SmallVectorImpl&Pieces, +unsigned GCCAsmStmt::AnalyzeAsmString(SmallVectorImpl&Pieces, ASTContext &C, unsigned &DiagOffs) const { StringRef Str = getAsmString()->getString(); const char *StrStart = Str.begin(); @@ -549,10 +549,10 @@ unsigned AsmStmt::AnalyzeAsmString(SmallVectorImpl&Pieces, } } /// GenerateAsmString - Assemble final asm string. -std::string AsmStmt::GenerateAsmString(ASTContext &C) const { +std::string GCCAsmStmt::GenerateAsmString(ASTContext &C) const { // Analyze the asm string to decompose it into its pieces. We know that Sema // has already done this, so it is guaranteed to be successful. - SmallVector Pieces; + SmallVector Pieces; unsigned DiagOffs; AnalyzeAsmString(Pieces, C, DiagOffs); @@ -590,12 +590,13 @@ QualType CXXCatchStmt::getCaughtType() const { // Constructors //===----------------------------------------------------------------------===// -AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, - bool isvolatile, unsigned numoutputs, unsigned numinputs, - IdentifierInfo **names, StringLiteral **constraints, - Expr **exprs, StringLiteral *asmstr, unsigned numclobbers, - StringLiteral **clobbers, SourceLocation rparenloc) - : Stmt(AsmStmtClass), AsmLoc(asmloc), RParenLoc(rparenloc), AsmStr(asmstr) +GCCAsmStmt::GCCAsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, + bool isvolatile, unsigned numoutputs, unsigned numinputs, + IdentifierInfo **names, StringLiteral **constraints, + Expr **exprs, StringLiteral *asmstr, + unsigned numclobbers, StringLiteral **clobbers, + SourceLocation rparenloc) + : Stmt(GCCAsmStmtClass), AsmLoc(asmloc), RParenLoc(rparenloc), AsmStr(asmstr) , IsSimple(issimple), IsVolatile(isvolatile), NumOutputs(numoutputs) , NumInputs(numinputs), NumClobbers(numclobbers) { diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index c0960ce6a2..9a31416371 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -366,7 +366,7 @@ void StmtPrinter::VisitReturnStmt(ReturnStmt *Node) { } -void StmtPrinter::VisitAsmStmt(AsmStmt *Node) { +void StmtPrinter::VisitGCCAsmStmt(GCCAsmStmt *Node) { Indent() << "asm "; if (Node->isVolatile()) diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp index 2168b64d5b..e4a2e876fb 100644 --- a/lib/AST/StmtProfile.cpp +++ b/lib/AST/StmtProfile.cpp @@ -158,7 +158,7 @@ void StmtProfiler::VisitReturnStmt(const ReturnStmt *S) { VisitStmt(S); } -void StmtProfiler::VisitAsmStmt(const AsmStmt *S) { +void StmtProfiler::VisitGCCAsmStmt(const GCCAsmStmt *S) { VisitStmt(S); ID.AddBoolean(S->isVolatile()); ID.AddBoolean(S->isSimple()); diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index e52063da74..4d3b4857f4 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -132,7 +132,7 @@ void CodeGenFunction::EmitStmt(const Stmt *S) { case Stmt::ReturnStmtClass: EmitReturnStmt(cast(*S)); break; case Stmt::SwitchStmtClass: EmitSwitchStmt(cast(*S)); break; - case Stmt::AsmStmtClass: EmitAsmStmt(cast(*S)); break; + case Stmt::GCCAsmStmtClass: EmitGCCAsmStmt(cast(*S)); break; case Stmt::MSAsmStmtClass: EmitMSAsmStmt(cast(*S)); break; case Stmt::ObjCAtTryStmtClass: @@ -1295,7 +1295,7 @@ SimplifyConstraint(const char *Constraint, const TargetInfo &Target, static std::string AddVariableConstraints(const std::string &Constraint, const Expr &AsmExpr, const TargetInfo &Target, CodeGenModule &CGM, - const AsmStmt &Stmt) { + const GCCAsmStmt &Stmt) { const DeclRefExpr *AsmDeclRef = dyn_cast(&AsmExpr); if (!AsmDeclRef) return Constraint; @@ -1395,7 +1395,7 @@ static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str, return llvm::MDNode::get(CGF.getLLVMContext(), Locs); } -void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { +void CodeGenFunction::EmitGCCAsmStmt(const GCCAsmStmt &S) { // Assemble the final asm string. std::string AsmString = S.GenerateAsmString(getContext()); diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index b96ee2e14a..c74ef3021a 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -2001,7 +2001,7 @@ public: void EmitDefaultStmt(const DefaultStmt &S); void EmitCaseStmt(const CaseStmt &S); void EmitCaseStmtRange(const CaseStmt &S); - void EmitAsmStmt(const AsmStmt &S); + void EmitGCCAsmStmt(const GCCAsmStmt &S); void EmitMSAsmStmt(const MSAsmStmt &S); void EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S); diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 37f5bc51ca..f58f90d56c 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -1702,8 +1702,8 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { ExprVector Constraints; ExprVector Exprs; ExprVector Clobbers; - return Actions.ActOnAsmStmt(AsmLoc, true, true, 0, 0, 0, Constraints, Exprs, - AsmString.take(), Clobbers, EndLoc); + return Actions.ActOnGCCAsmStmt(AsmLoc, true, true, 0, 0, 0, Constraints, + Exprs, AsmString.take(), Clobbers, EndLoc); } // FIXME: We should be passing source locations for better diagnostics. @@ -1774,11 +1774,10 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) { if (Tok.is(tok::r_paren)) { // We have a simple asm expression like 'asm("foo")'. T.consumeClose(); - return Actions.ActOnAsmStmt(AsmLoc, /*isSimple*/ true, isVolatile, - /*NumOutputs*/ 0, /*NumInputs*/ 0, 0, - Constraints, Exprs, - AsmString.take(), Clobbers, - T.getCloseLocation()); + return Actions.ActOnGCCAsmStmt(AsmLoc, /*isSimple*/ true, isVolatile, + /*NumOutputs*/ 0, /*NumInputs*/ 0, 0, + Constraints, Exprs, AsmString.take(), + Clobbers, T.getCloseLocation()); } // Parse Outputs, if present. @@ -1839,11 +1838,10 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) { } T.consumeClose(); - return Actions.ActOnAsmStmt(AsmLoc, false, isVolatile, - NumOutputs, NumInputs, Names.data(), - Constraints, Exprs, - AsmString.take(), Clobbers, - T.getCloseLocation()); + return Actions.ActOnGCCAsmStmt(AsmLoc, false, isVolatile, NumOutputs, + NumInputs, Names.data(), Constraints, Exprs, + AsmString.take(), Clobbers, + T.getCloseLocation()); } /// ParseAsmOperands - Parse the asm-operands production as used by diff --git a/lib/Sema/SemaStmtAsm.cpp b/lib/Sema/SemaStmtAsm.cpp index dcbc21b287..638c87953c 100644 --- a/lib/Sema/SemaStmtAsm.cpp +++ b/lib/Sema/SemaStmtAsm.cpp @@ -78,9 +78,9 @@ static bool CheckAsmLValue(const Expr *E, Sema &S) { /// isOperandMentioned - Return true if the specified operand # is mentioned /// anywhere in the decomposed asm string. static bool isOperandMentioned(unsigned OpNo, - ArrayRef AsmStrPieces) { + ArrayRef AsmStrPieces) { for (unsigned p = 0, e = AsmStrPieces.size(); p != e; ++p) { - const AsmStmt::AsmStringPiece &Piece = AsmStrPieces[p]; + const GCCAsmStmt::AsmStringPiece &Piece = AsmStrPieces[p]; if (!Piece.isOperand()) continue; // If this is a reference to the input and if the input was the smaller @@ -91,12 +91,12 @@ static bool isOperandMentioned(unsigned OpNo, return false; } -StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple, - bool IsVolatile, unsigned NumOutputs, - unsigned NumInputs, IdentifierInfo **Names, - MultiExprArg constraints, MultiExprArg exprs, - Expr *asmString, MultiExprArg clobbers, - SourceLocation RParenLoc) { +StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, + bool IsVolatile, unsigned NumOutputs, + unsigned NumInputs, IdentifierInfo **Names, + MultiExprArg constraints, MultiExprArg exprs, + Expr *asmString, MultiExprArg clobbers, + SourceLocation RParenLoc) { unsigned NumClobbers = clobbers.size(); StringLiteral **Constraints = reinterpret_cast(constraints.data()); @@ -200,13 +200,13 @@ StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple, diag::err_asm_unknown_register_name) << Clobber); } - AsmStmt *NS = - new (Context) AsmStmt(Context, AsmLoc, IsSimple, IsVolatile, NumOutputs, - NumInputs, Names, Constraints, Exprs, AsmString, - NumClobbers, Clobbers, RParenLoc); + GCCAsmStmt *NS = + new (Context) GCCAsmStmt(Context, AsmLoc, IsSimple, IsVolatile, NumOutputs, + NumInputs, Names, Constraints, Exprs, AsmString, + NumClobbers, Clobbers, RParenLoc); // Validate the asm string, ensuring it makes sense given the operands we // have. - SmallVector Pieces; + SmallVector Pieces; unsigned DiagOffs; if (unsigned DiagID = NS->AnalyzeAsmString(Pieces, Context, DiagOffs)) { Diag(getLocationOfStringLiteralByte(AsmString, DiagOffs), DiagID) diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index e4c30e13ec..4b780f6bc0 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -1162,31 +1162,23 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - StmtResult RebuildAsmStmt(SourceLocation AsmLoc, - bool IsSimple, - bool IsVolatile, - unsigned NumOutputs, - unsigned NumInputs, - IdentifierInfo **Names, - MultiExprArg Constraints, - MultiExprArg Exprs, - Expr *AsmString, - MultiExprArg Clobbers, - SourceLocation RParenLoc) { - return getSema().ActOnAsmStmt(AsmLoc, IsSimple, IsVolatile, NumOutputs, - NumInputs, Names, Constraints, - Exprs, AsmString, Clobbers, - RParenLoc); + StmtResult RebuildGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, + bool IsVolatile, unsigned NumOutputs, + unsigned NumInputs, IdentifierInfo **Names, + MultiExprArg Constraints, MultiExprArg Exprs, + Expr *AsmString, MultiExprArg Clobbers, + SourceLocation RParenLoc) { + return getSema().ActOnGCCAsmStmt(AsmLoc, IsSimple, IsVolatile, NumOutputs, + NumInputs, Names, Constraints, Exprs, + AsmString, Clobbers, RParenLoc); } /// \brief Build a new MS style inline asm statement. /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - StmtResult RebuildMSAsmStmt(SourceLocation AsmLoc, - SourceLocation LBraceLoc, - ArrayRef AsmToks, - SourceLocation EndLoc) { + StmtResult RebuildMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, + ArrayRef AsmToks, SourceLocation EndLoc) { return getSema().ActOnMSAsmStmt(AsmLoc, LBraceLoc, AsmToks, EndLoc); } @@ -5524,7 +5516,7 @@ TreeTransform::TransformDeclStmt(DeclStmt *S) { template StmtResult -TreeTransform::TransformAsmStmt(AsmStmt *S) { +TreeTransform::TransformGCCAsmStmt(GCCAsmStmt *S) { SmallVector Constraints; SmallVector Exprs; @@ -5580,18 +5572,11 @@ TreeTransform::TransformAsmStmt(AsmStmt *S) { // No need to transform the asm string literal. AsmString = SemaRef.Owned(S->getAsmString()); - - return getDerived().RebuildAsmStmt(S->getAsmLoc(), - S->isSimple(), - S->isVolatile(), - S->getNumOutputs(), - S->getNumInputs(), - Names.data(), - Constraints, - Exprs, - AsmString.get(), - Clobbers, - S->getRParenLoc()); + return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(), + S->isVolatile(), S->getNumOutputs(), + S->getNumInputs(), Names.data(), + Constraints, Exprs, AsmString.get(), + Clobbers, S->getRParenLoc()); } template diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp index e616faa1a4..6ca450b9fb 100644 --- a/lib/Serialization/ASTReaderStmt.cpp +++ b/lib/Serialization/ASTReaderStmt.cpp @@ -288,7 +288,7 @@ void ASTStmtReader::VisitDeclStmt(DeclStmt *S) { } } -void ASTStmtReader::VisitAsmStmt(AsmStmt *S) { +void ASTStmtReader::VisitGCCAsmStmt(GCCAsmStmt *S) { VisitStmt(S); unsigned NumOutputs = Record[Idx++]; unsigned NumInputs = Record[Idx++]; @@ -1700,8 +1700,8 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { S = new (Context) DeclStmt(Empty); break; - case STMT_ASM: - S = new (Context) AsmStmt(Empty); + case STMT_GCCASM: + S = new (Context) GCCAsmStmt(Empty); break; case STMT_MSASM: diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 28ae08be18..a64e0d3579 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -667,7 +667,7 @@ static void AddStmtsExprs(llvm::BitstreamWriter &Stream, RECORD(STMT_BREAK); RECORD(STMT_RETURN); RECORD(STMT_DECL); - RECORD(STMT_ASM); + RECORD(STMT_GCCASM); RECORD(STMT_MSASM); RECORD(EXPR_PREDEFINED); RECORD(EXPR_DECL_REF); diff --git a/lib/Serialization/ASTWriterStmt.cpp b/lib/Serialization/ASTWriterStmt.cpp index 9ae3e129a9..1594178349 100644 --- a/lib/Serialization/ASTWriterStmt.cpp +++ b/lib/Serialization/ASTWriterStmt.cpp @@ -218,7 +218,7 @@ void ASTStmtWriter::VisitDeclStmt(DeclStmt *S) { Code = serialization::STMT_DECL; } -void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) { +void ASTStmtWriter::VisitGCCAsmStmt(GCCAsmStmt *S) { VisitStmt(S); Record.push_back(S->getNumOutputs()); Record.push_back(S->getNumInputs()); @@ -247,7 +247,7 @@ void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) { for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I) Writer.AddStmt(S->getClobber(I)); - Code = serialization::STMT_ASM; + Code = serialization::STMT_GCCASM; } void ASTStmtWriter::VisitMSAsmStmt(MSAsmStmt *S) { diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp index 26516938d9..6fb9116dbb 100644 --- a/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -662,9 +662,9 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, Bldr.addNodes(Dst); break; - case Stmt::AsmStmtClass: + case Stmt::GCCAsmStmtClass: Bldr.takeNodes(Pred); - VisitAsmStmt(cast(S), Pred, Dst); + VisitGCCAsmStmt(cast(S), Pred, Dst); Bldr.addNodes(Dst); break; @@ -1775,8 +1775,8 @@ void ExprEngine::evalEagerlyAssume(ExplodedNodeSet &Dst, ExplodedNodeSet &Src, } } -void ExprEngine::VisitAsmStmt(const AsmStmt *A, ExplodedNode *Pred, - ExplodedNodeSet &Dst) { +void ExprEngine::VisitGCCAsmStmt(const GCCAsmStmt *A, ExplodedNode *Pred, + ExplodedNodeSet &Dst) { StmtNodeBuilder Bldr(Pred, Dst, *currBldrCtx); // We have processed both the inputs and the outputs. All of the outputs // should evaluate to Locs. Nuke all of their values. @@ -1787,7 +1787,7 @@ void ExprEngine::VisitAsmStmt(const AsmStmt *A, ExplodedNode *Pred, ProgramStateRef state = Pred->getState(); - for (AsmStmt::const_outputs_iterator OI = A->begin_outputs(), + for (GCCAsmStmt::const_outputs_iterator OI = A->begin_outputs(), OE = A->end_outputs(); OI != OE; ++OI) { SVal X = state->getSVal(*OI, Pred->getLocationContext()); assert (!isa(X)); // Should be an Lval, or unknown, undef. diff --git a/test/SemaCXX/missing-header.cpp b/test/SemaCXX/missing-header.cpp index 5b3915b865..a1048fee46 100644 --- a/test/SemaCXX/missing-header.cpp +++ b/test/SemaCXX/missing-header.cpp @@ -4,6 +4,6 @@ class AnalysisDeclContext {}; static ControlFlowKind CheckFallThrough(AnalysisDeclContext &AC) { - if (const AsmStmt *AS = dyn_cast(S)) {} + if (const GCCAsmStmt *AS = dyn_cast(S)) {} bool NoReturnEdge = false; } diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index e451c6faf4..c6daaf8b5a 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -3510,8 +3510,8 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) { return createCXString("BreakStmt"); case CXCursor_ReturnStmt: return createCXString("ReturnStmt"); - case CXCursor_AsmStmt: - return createCXString("AsmStmt"); + case CXCursor_GCCAsmStmt: + return createCXString("GCCAsmStmt"); case CXCursor_MSAsmStmt: return createCXString("MSAsmStmt"); case CXCursor_ObjCAtTryStmt: diff --git a/tools/libclang/CXCursor.cpp b/tools/libclang/CXCursor.cpp index 2757af434c..e219f948ea 100644 --- a/tools/libclang/CXCursor.cpp +++ b/tools/libclang/CXCursor.cpp @@ -145,8 +145,8 @@ CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent, CXTranslationUnit TU, K = CXCursor_ReturnStmt; break; - case Stmt::AsmStmtClass: - K = CXCursor_AsmStmt; + case Stmt::GCCAsmStmtClass: + K = CXCursor_GCCAsmStmt; break; case Stmt::MSAsmStmtClass: diff --git a/tools/libclang/RecursiveASTVisitor.h b/tools/libclang/RecursiveASTVisitor.h index 7131025ee1..6060ab6bff 100644 --- a/tools/libclang/RecursiveASTVisitor.h +++ b/tools/libclang/RecursiveASTVisitor.h @@ -1753,7 +1753,7 @@ bool RecursiveASTVisitor::Traverse##STMT (STMT *S) { \ return true; \ } -DEF_TRAVERSE_STMT(AsmStmt, { +DEF_TRAVERSE_STMT(GCCAsmStmt, { StmtQueue.queue(S->getAsmString()); for (unsigned I = 0, E = S->getNumInputs(); I < E; ++I) { StmtQueue.queue(S->getInputConstraintLiteral(I));