diff options
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index b6e4d8aff21e9..25e685be3e9b1 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -16,6 +16,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/DeclGroup.h" #include "clang/AST/Expr.h" +#include "clang/AST/ExprConcepts.h" #include "clang/AST/ExprCXX.h" #include "clang/AST/ExprObjC.h" #include "clang/AST/ExprOpenMP.h" @@ -272,7 +273,6 @@ SourceRange Stmt::getSourceRange() const { } SourceLocation Stmt::getBeginLoc() const { - // llvm::errs() << "getBeginLoc() for " << getStmtClassName() << "\n"; switch (getStmtClass()) { case Stmt::NoStmtClass: llvm_unreachable("statement without class"); #define ABSTRACT_STMT(type) @@ -456,7 +456,7 @@ void GCCAsmStmt::setInputExpr(unsigned i, Expr *E) { } AddrLabelExpr *GCCAsmStmt::getLabelExpr(unsigned i) const { - return cast<AddrLabelExpr>(Exprs[i + NumInputs]); + return cast<AddrLabelExpr>(Exprs[i + NumOutputs + NumInputs]); } StringRef GCCAsmStmt::getLabelName(unsigned i) const { @@ -522,7 +522,7 @@ int GCCAsmStmt::getNamedOperand(StringRef SymbolicName) const { for (unsigned i = 0, e = getNumLabels(); i != e; ++i) if (getLabelName(i) == SymbolicName) - return i + getNumInputs(); + return i + getNumOutputs() + getNumInputs(); // Not found. return -1; @@ -731,7 +731,7 @@ std::string GCCAsmStmt::generateAsmString(const ASTContext &C) const { /// Assemble final IR asm string (MS-style). std::string MSAsmStmt::generateAsmString(const ASTContext &C) const { // FIXME: This needs to be translated into the IR string representation. - return AsmStr; + return std::string(AsmStr); } Expr *MSAsmStmt::getOutputExpr(unsigned i) { @@ -1012,7 +1012,8 @@ void SwitchStmt::setConditionVariable(const ASTContext &Ctx, VarDecl *V) { } WhileStmt::WhileStmt(const ASTContext &Ctx, VarDecl *Var, Expr *Cond, - Stmt *Body, SourceLocation WL) + Stmt *Body, SourceLocation WL, SourceLocation LParenLoc, + SourceLocation RParenLoc) : Stmt(WhileStmtClass) { bool HasVar = Var != nullptr; WhileStmtBits.HasVar = HasVar; @@ -1023,6 +1024,8 @@ WhileStmt::WhileStmt(const ASTContext &Ctx, VarDecl *Var, Expr *Cond, setConditionVariable(Ctx, Var); setWhileLoc(WL); + setLParenLoc(LParenLoc); + setRParenLoc(RParenLoc); } WhileStmt::WhileStmt(EmptyShell Empty, bool HasVar) @@ -1031,12 +1034,14 @@ WhileStmt::WhileStmt(EmptyShell Empty, bool HasVar) } WhileStmt *WhileStmt::Create(const ASTContext &Ctx, VarDecl *Var, Expr *Cond, - Stmt *Body, SourceLocation WL) { + Stmt *Body, SourceLocation WL, + SourceLocation LParenLoc, + SourceLocation RParenLoc) { bool HasVar = Var != nullptr; void *Mem = Ctx.Allocate(totalSizeToAlloc<Stmt *>(NumMandatoryStmtPtr + HasVar), alignof(WhileStmt)); - return new (Mem) WhileStmt(Ctx, Var, Cond, Body, WL); + return new (Mem) WhileStmt(Ctx, Var, Cond, Body, WL, LParenLoc, RParenLoc); } WhileStmt *WhileStmt::CreateEmpty(const ASTContext &Ctx, bool HasVar) { |