[cfe-commits] r67923 - in /cfe/trunk: include/clang/AST/Stmt.h lib/AST/CFG.cpp lib/Analysis/GRExprEngine.cpp lib/Analysis/LiveVariables.cpp lib/Analysis/UninitializedValues.cpp lib/CodeGen/CGObjC.cpp lib/Sema/SemaStmt.cpp tools/clang-cc/RewriteObjC.cpp
Chris Lattner
sabre at nondot.org
Fri Mar 27 23:33:20 PDT 2009
Author: lattner
Date: Sat Mar 28 01:33:19 2009
New Revision: 67923
URL: http://llvm.org/viewvc/llvm-project?rev=67923&view=rev
Log:
rename some methods.
Modified:
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/lib/AST/CFG.cpp
cfe/trunk/lib/Analysis/GRExprEngine.cpp
cfe/trunk/lib/Analysis/LiveVariables.cpp
cfe/trunk/lib/Analysis/UninitializedValues.cpp
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/tools/clang-cc/RewriteObjC.cpp
Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=67923&r1=67922&r2=67923&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Sat Mar 28 01:33:19 2009
@@ -235,14 +235,14 @@
virtual void Destroy(ASTContext& Ctx);
- /// hasSolitaryDecl - This method returns true if this DeclStmt refers
+ /// isSingleDecl - This method returns true if this DeclStmt refers
/// to a single Decl.
- bool hasSolitaryDecl() const {
+ bool isSingleDecl() const {
return DG.isSingleDecl();
}
- const Decl* getSolitaryDecl() const { return DG.getSingleDecl(); }
- Decl *getSolitaryDecl() { return DG.getSingleDecl(); }
+ const Decl *getSingleDecl() const { return DG.getSingleDecl(); }
+ Decl *getSingleDecl() { return DG.getSingleDecl(); }
SourceLocation getStartLoc() const { return StartLoc; }
SourceLocation getEndLoc() const { return EndLoc; }
Modified: cfe/trunk/lib/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CFG.cpp?rev=67923&r1=67922&r2=67923&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CFG.cpp (original)
+++ cfe/trunk/lib/AST/CFG.cpp Sat Mar 28 01:33:19 2009
@@ -358,41 +358,40 @@
case Stmt::DeclStmtClass: {
DeclStmt *DS = cast<DeclStmt>(Terminator);
- if (DS->hasSolitaryDecl()) {
+ if (DS->isSingleDecl()) {
Block->appendStmt(Terminator);
- return WalkAST_VisitDeclSubExpr(DS->getSolitaryDecl());
+ return WalkAST_VisitDeclSubExpr(DS->getSingleDecl());
}
- else {
- typedef llvm::SmallVector<Decl*,10> BufTy;
- BufTy Buf;
- CFGBlock* B = 0;
-
- // FIXME: Add a reverse iterator for DeclStmt to avoid this
- // extra copy.
- for (DeclStmt::decl_iterator DI=DS->decl_begin(), DE=DS->decl_end();
- DI != DE; ++DI)
- Buf.push_back(*DI);
+
+ typedef llvm::SmallVector<Decl*,10> BufTy;
+ BufTy Buf;
+ CFGBlock* B = 0;
+
+ // FIXME: Add a reverse iterator for DeclStmt to avoid this
+ // extra copy.
+ for (DeclStmt::decl_iterator DI=DS->decl_begin(), DE=DS->decl_end();
+ DI != DE; ++DI)
+ Buf.push_back(*DI);
+
+ for (BufTy::reverse_iterator I=Buf.rbegin(), E=Buf.rend(); I!=E; ++I) {
+ // Get the alignment of the new DeclStmt, padding out to >=8 bytes.
+ unsigned A = llvm::AlignOf<DeclStmt>::Alignment < 8
+ ? 8 : llvm::AlignOf<DeclStmt>::Alignment;
- for (BufTy::reverse_iterator I=Buf.rbegin(), E=Buf.rend(); I!=E; ++I) {
- // Get the alignment of the new DeclStmt, padding out to >=8 bytes.
- unsigned A = llvm::AlignOf<DeclStmt>::Alignment < 8
- ? 8 : llvm::AlignOf<DeclStmt>::Alignment;
-
- // Allocate the DeclStmt using the BumpPtrAllocator. It will
- // get automatically freed with the CFG.
- DeclGroupRef DG(*I);
- Decl* D = *I;
- void* Mem = cfg->getAllocator().Allocate(sizeof(DeclStmt), A);
-
- DeclStmt* DS = new (Mem) DeclStmt(DG, D->getLocation(),
- GetEndLoc(D));
-
- // Append the fake DeclStmt to block.
- Block->appendStmt(DS);
- B = WalkAST_VisitDeclSubExpr(D);
- }
- return B;
+ // Allocate the DeclStmt using the BumpPtrAllocator. It will
+ // get automatically freed with the CFG.
+ DeclGroupRef DG(*I);
+ Decl* D = *I;
+ void* Mem = cfg->getAllocator().Allocate(sizeof(DeclStmt), A);
+
+ DeclStmt* DS = new (Mem) DeclStmt(DG, D->getLocation(),
+ GetEndLoc(D));
+
+ // Append the fake DeclStmt to block.
+ Block->appendStmt(DS);
+ B = WalkAST_VisitDeclSubExpr(D);
}
+ return B;
}
case Stmt::AddrLabelExprClass: {
Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=67923&r1=67922&r2=67923&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Sat Mar 28 01:33:19 2009
@@ -1534,7 +1534,7 @@
SVal ElementV;
if (DeclStmt* DS = dyn_cast<DeclStmt>(elem)) {
- VarDecl* ElemD = cast<VarDecl>(DS->getSolitaryDecl());
+ VarDecl* ElemD = cast<VarDecl>(DS->getSingleDecl());
assert (ElemD->getInit() == 0);
ElementV = getStateManager().GetLValue(GetState(Pred), ElemD);
VisitObjCForCollectionStmtAux(S, Pred, Dst, ElementV);
Modified: cfe/trunk/lib/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/LiveVariables.cpp?rev=67923&r1=67922&r2=67923&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/lib/Analysis/LiveVariables.cpp Sat Mar 28 01:33:19 2009
@@ -194,7 +194,7 @@
VarDecl* VD = 0;
if (DeclStmt* DS = dyn_cast<DeclStmt>(Element))
- VD = cast<VarDecl>(DS->getSolitaryDecl());
+ VD = cast<VarDecl>(DS->getSingleDecl());
else {
Expr* ElemExpr = cast<Expr>(Element)->IgnoreParens();
if ((DR = dyn_cast<DeclRefExpr>(ElemExpr)))
Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=67923&r1=67922&r2=67923&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Sat Mar 28 01:33:19 2009
@@ -193,7 +193,7 @@
VarDecl* VD = 0;
if (DeclStmt* DS = dyn_cast<DeclStmt>(Element))
- VD = cast<VarDecl>(DS->getSolitaryDecl());
+ VD = cast<VarDecl>(DS->getSingleDecl());
else {
Expr* ElemExpr = cast<Expr>(Element)->IgnoreParens();
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=67923&r1=67922&r2=67923&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Sat Mar 28 01:33:19 2009
@@ -436,7 +436,7 @@
if (const DeclStmt *SD = dyn_cast<DeclStmt>(S.getElement())) {
EmitStmt(SD);
assert(HaveInsertPoint() && "DeclStmt destroyed insert point!");
- const Decl* D = SD->getSolitaryDecl();
+ const Decl* D = SD->getSingleDecl();
ElementTy = cast<ValueDecl>(D)->getType();
DeclAddress = LocalDeclMap[D];
} else {
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=67923&r1=67922&r2=67923&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Sat Mar 28 01:33:19 2009
@@ -627,11 +627,11 @@
if (First) {
QualType FirstType;
if (DeclStmt *DS = dyn_cast<DeclStmt>(First)) {
- if (!DS->hasSolitaryDecl())
+ if (!DS->isSingleDecl())
return StmtError(Diag((*DS->decl_begin())->getLocation(),
diag::err_toomany_element_decls));
- Decl *D = DS->getSolitaryDecl();
+ Decl *D = DS->getSingleDecl();
FirstType = cast<ValueDecl>(D)->getType();
// C99 6.8.5p3: The declaration part of a 'for' statement shall only
// declare identifiers for objects having storage class 'auto' or
Modified: cfe/trunk/tools/clang-cc/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/RewriteObjC.cpp?rev=67923&r1=67922&r2=67923&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/RewriteObjC.cpp (original)
+++ cfe/trunk/tools/clang-cc/RewriteObjC.cpp Sat Mar 28 01:33:19 2009
@@ -1306,7 +1306,7 @@
buf = "\n{\n\t";
if (DeclStmt *DS = dyn_cast<DeclStmt>(S->getElement())) {
// type elem;
- NamedDecl* D = cast<NamedDecl>(DS->getSolitaryDecl());
+ NamedDecl* D = cast<NamedDecl>(DS->getSingleDecl());
QualType ElementType = cast<ValueDecl>(D)->getType();
elementTypeAsString = ElementType.getAsString();
buf += elementTypeAsString;
More information about the cfe-commits
mailing list