[cfe-commits] r71800 - in /cfe/trunk: include/clang/AST/Decl.h lib/AST/Decl.cpp lib/Frontend/PCHReaderDecl.cpp lib/Frontend/PCHWriterDecl.cpp lib/Sema/SemaDecl.cpp

Anders Carlsson andersca at mac.com
Thu May 14 14:46:03 PDT 2009


Author: andersca
Date: Thu May 14 16:46:00 2009
New Revision: 71800

URL: http://llvm.org/viewvc/llvm-project?rev=71800&view=rev
Log:
Improvements to the FunctionDecl getters/setters.

Modified:
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/lib/AST/Decl.cpp
    cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
    cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=71800&r1=71799&r2=71800&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Thu May 14 16:46:00 2009
@@ -519,8 +519,8 @@
   bool C99InlineDefinition : 1;
   bool IsVirtual : 1;
   bool IsPure : 1;
-  bool InheritedPrototype : 1;
-  bool HasPrototype : 1;
+  bool HasInheritedPrototype : 1;
+  bool HasWrittenPrototype : 1;
   bool IsDeleted : 1;
 
   // Move to DeclGroup when it is implemented.
@@ -546,8 +546,8 @@
       DeclContext(DK),
       ParamInfo(0), Body(), PreviousDeclaration(0),
       SClass(S), IsInline(isInline), C99InlineDefinition(false), 
-      IsVirtual(false), IsPure(false), InheritedPrototype(false), 
-      HasPrototype(true), IsDeleted(false), TypeSpecStartLoc(TSSL),
+      IsVirtual(false), IsPure(false), HasInheritedPrototype(false), 
+      HasWrittenPrototype(true), IsDeleted(false), TypeSpecStartLoc(TSSL),
       TemplateOrInstantiation() {}
 
   virtual ~FunctionDecl() {}
@@ -557,7 +557,7 @@
   static FunctionDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L,
                               DeclarationName N, QualType T, 
                               StorageClass S = None, bool isInline = false,
-                              bool hasPrototype = true,
+                              bool hasWrittenPrototype = true,
                               SourceLocation TSStartLoc = SourceLocation());  
   
   SourceLocation getTypeSpecStartLoc() const { return TypeSpecStartLoc; }
@@ -604,13 +604,17 @@
   /// was explicitly written or because it was "inherited" by merging
   /// a declaration without a prototype with a declaration that has a
   /// prototype.
-  bool hasPrototype() const { return HasPrototype || InheritedPrototype; }
-  void setHasPrototype(bool P) { HasPrototype = P; }
+  bool hasPrototype() const { 
+    return HasWrittenPrototype || HasInheritedPrototype; 
+  }
+  
+  bool hasWrittenPrototype() const { return HasWrittenPrototype; }
+  void setHasWrittenPrototype(bool P) { HasWrittenPrototype = P; }
 
   /// \brief Whether this function inherited its prototype from a
   /// previous declaration.
-  bool inheritedPrototype() const { return InheritedPrototype; }
-  void setInheritedPrototype(bool P = true) { InheritedPrototype = P; }
+  bool hasInheritedPrototype() const { return HasInheritedPrototype; }
+  void setHasInheritedPrototype(bool P = true) { HasInheritedPrototype = P; }
 
   /// \brief Whether this function has been deleted.
   ///

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=71800&r1=71799&r2=71800&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Thu May 14 16:46:00 2009
@@ -123,12 +123,12 @@
                                    SourceLocation L, 
                                    DeclarationName N, QualType T, 
                                    StorageClass S, bool isInline, 
-                                   bool hasPrototype,
+                                   bool hasWrittenPrototype,
                                    SourceLocation TypeSpecStartLoc) {
   FunctionDecl *New 
     = new (C) FunctionDecl(Function, DC, L, N, T, S, isInline, 
                            TypeSpecStartLoc);
-  New->HasPrototype = hasPrototype;
+  New->HasWrittenPrototype = hasWrittenPrototype;
   return New;
 }
 

Modified: cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderDecl.cpp?rev=71800&r1=71799&r2=71800&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderDecl.cpp Thu May 14 16:46:00 2009
@@ -151,8 +151,8 @@
   FD->setC99InlineDefinition(Record[Idx++]);
   FD->setVirtual(Record[Idx++]);
   FD->setPure(Record[Idx++]);
-  FD->setInheritedPrototype(Record[Idx++]);
-  FD->setHasPrototype(Record[Idx++]);
+  FD->setHasInheritedPrototype(Record[Idx++]);
+  FD->setHasWrittenPrototype(Record[Idx++]);
   FD->setDeleted(Record[Idx++]);
   FD->setTypeSpecStartLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
   // FIXME: C++ TemplateOrInstantiation

Modified: cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriterDecl.cpp?rev=71800&r1=71799&r2=71800&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriterDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriterDecl.cpp Thu May 14 16:46:00 2009
@@ -151,8 +151,8 @@
   Record.push_back(D->isC99InlineDefinition());
   Record.push_back(D->isVirtual());
   Record.push_back(D->isPure());
-  Record.push_back(D->inheritedPrototype());
-  Record.push_back(D->hasPrototype() && !D->inheritedPrototype());
+  Record.push_back(D->hasInheritedPrototype());
+  Record.push_back(D->hasWrittenPrototype());
   Record.push_back(D->isDeleted());
   Writer.AddSourceLocation(D->getTypeSpecStartLoc(), Record);
   // FIXME: C++ TemplateOrInstantiation

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=71800&r1=71799&r2=71800&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu May 14 16:46:00 2009
@@ -736,7 +736,7 @@
                                          OldProto->isVariadic(),
                                          OldProto->getTypeQuals());
       New->setType(NewQType);
-      New->setInheritedPrototype();
+      New->setHasInheritedPrototype();
 
       // Synthesize a parameter for each argument type.
       llvm::SmallVector<ParmVarDecl*, 16> Params;





More information about the cfe-commits mailing list