diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2012-03-09 18:35:03 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2012-03-09 18:35:03 +0000 |
| commit | 62ee6417ac93b343d7ade1a3c8bb1c2ae71cee86 (patch) | |
| tree | b4373f3893aaf0d937ad1d72f1bb571322f7f11b /clang/lib/AST | |
| parent | ddb83c71946dde29e4f99016c9885b9c8f70c608 (diff) | |
| download | bcm5719-llvm-62ee6417ac93b343d7ade1a3c8bb1c2ae71cee86.tar.gz bcm5719-llvm-62ee6417ac93b343d7ade1a3c8bb1c2ae71cee86.zip | |
[AST/Sema/libclang] Replace getSourceRange().getBegin() with getLocStart().
- getSourceRange().getBegin() is about as awesome a pattern as .copy().size().
I already killed the hot paths so this doesn't seem to impact performance on my
tests-of-the-day, but it is a much more sensible (and shorter) pattern.
llvm-svn: 152419
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 12 | ||||
| -rw-r--r-- | clang/lib/AST/Stmt.cpp | 26 |
2 files changed, 19 insertions, 19 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 0bc50c5f308..cc0213fca23 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -965,10 +965,10 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, Base1->getType(), Base2->getType())) { Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) << Context.C2.getTypeDeclType(D2); - Context.Diag2(Base2->getSourceRange().getBegin(), diag::note_odr_base) + Context.Diag2(Base2->getLocStart(), diag::note_odr_base) << Base2->getType() << Base2->getSourceRange(); - Context.Diag1(Base1->getSourceRange().getBegin(), diag::note_odr_base) + Context.Diag1(Base1->getLocStart(), diag::note_odr_base) << Base1->getType() << Base1->getSourceRange(); return false; @@ -978,10 +978,10 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, if (Base1->isVirtual() != Base2->isVirtual()) { Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) << Context.C2.getTypeDeclType(D2); - Context.Diag2(Base2->getSourceRange().getBegin(), + Context.Diag2(Base2->getLocStart(), diag::note_odr_virtual_base) << Base2->isVirtual() << Base2->getSourceRange(); - Context.Diag1(Base1->getSourceRange().getBegin(), diag::note_odr_base) + Context.Diag1(Base1->getLocStart(), diag::note_odr_base) << Base1->isVirtual() << Base1->getSourceRange(); return false; @@ -991,7 +991,7 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) << Context.C2.getTypeDeclType(D2); const CXXBaseSpecifier *Base1 = D1CXX->bases_begin(); - Context.Diag1(Base1->getSourceRange().getBegin(), diag::note_odr_base) + Context.Diag1(Base1->getLocStart(), diag::note_odr_base) << Base1->getType() << Base1->getSourceRange(); Context.Diag2(D2->getLocation(), diag::note_odr_missing_base); @@ -4171,7 +4171,7 @@ TypeSourceInfo *ASTImporter::Import(TypeSourceInfo *FromTSI) { return 0; return ToContext.getTrivialTypeSourceInfo(T, - FromTSI->getTypeLoc().getSourceRange().getBegin()); + FromTSI->getTypeLoc().getLocStart()); } Decl *ASTImporter::Import(Decl *FromD) { diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 7907e565dde..6af20df4beb 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -693,9 +693,9 @@ void IfStmt::setConditionVariable(ASTContext &C, VarDecl *V) { return; } - SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), - V->getSourceRange().getBegin(), - V->getSourceRange().getEnd()); + SourceRange VarRange = V->getSourceRange(); + SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), VarRange.getBegin(), + VarRange.getEnd()); } ForStmt::ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, @@ -724,9 +724,9 @@ void ForStmt::setConditionVariable(ASTContext &C, VarDecl *V) { return; } - SubExprs[CONDVAR] = new (C) DeclStmt(DeclGroupRef(V), - V->getSourceRange().getBegin(), - V->getSourceRange().getEnd()); + SourceRange VarRange = V->getSourceRange(); + SubExprs[CONDVAR] = new (C) DeclStmt(DeclGroupRef(V), VarRange.getBegin(), + VarRange.getEnd()); } SwitchStmt::SwitchStmt(ASTContext &C, VarDecl *Var, Expr *cond) @@ -751,9 +751,9 @@ void SwitchStmt::setConditionVariable(ASTContext &C, VarDecl *V) { return; } - SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), - V->getSourceRange().getBegin(), - V->getSourceRange().getEnd()); + SourceRange VarRange = V->getSourceRange(); + SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), VarRange.getBegin(), + VarRange.getEnd()); } Stmt *SwitchCase::getSubStmt() { @@ -784,10 +784,10 @@ void WhileStmt::setConditionVariable(ASTContext &C, VarDecl *V) { SubExprs[VAR] = 0; return; } - - SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), - V->getSourceRange().getBegin(), - V->getSourceRange().getEnd()); + + SourceRange VarRange = V->getSourceRange(); + SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), VarRange.getBegin(), + VarRange.getEnd()); } // IndirectGotoStmt |

