]> granicus.if.org Git - clang/commitdiff
rename some methods.
authorChris Lattner <sabre@nondot.org>
Sat, 28 Mar 2009 06:33:19 +0000 (06:33 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 28 Mar 2009 06:33:19 +0000 (06:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67923 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 5d1c6dc2077c4f312abe7576e1cffc9e2f1374d8..79b4a2956e7e2afe9049ee69da945974e7c364e1 100644 (file)
@@ -235,14 +235,14 @@ public:
   
   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; }
index 3bfac7fbdcdae4e9f9aad214ae0f2669821a6d84..297758316a538bd532c3af4f688087483424ba22 100644 (file)
@@ -358,41 +358,40 @@ CFGBlock* CFGBuilder::WalkAST(Stmt* Terminator, bool AlwaysAddStmt = false) {
 
     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: {
index 70e6647c27ee608019450d157ecdfc90d60d5894..8241d13a0b32f06eb5dbbf6bc362101a9a0bac98 100644 (file)
@@ -1534,7 +1534,7 @@ void GRExprEngine::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S,
   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);
index 23f6f461aa13ef3a712028ce52d0a31cb46d3101..b8b0aaca18429d623c61c54e5376a79797c84e28 100644 (file)
@@ -194,7 +194,7 @@ TransferFuncs::BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
   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)))
index 9ff99f1fa1fcf2168b404914309ae29d0a9d3bae..014ea8255e680b997aa51c70ead4f7e71e1eb2b6 100644 (file)
@@ -193,7 +193,7 @@ TransferFuncs::BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
   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();
 
index de63f51b330bc06677ce802ebe7466e418d74af1..2467a8290aa8d41f57cd6650faa6f5a910fc820a 100644 (file)
@@ -436,7 +436,7 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
   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 {
index bbcc71d6e4d238b18ff679d6cf4b3b3867ac99f9..4082d485b80fb4e86bba5de9ad198f489002825a 100644 (file)
@@ -627,11 +627,11 @@ Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc,
   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
index ee2334ba8ba3181651350f097181cd60b20d08d7..e0267ec2d042b2bbd690e08428a089a845e0a094 100644 (file)
@@ -1306,7 +1306,7 @@ Stmt *RewriteObjC::RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S,
   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;