diff options
author | Anders Carlsson <andersca@mac.com> | 2009-05-14 21:46:00 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-05-14 21:46:00 +0000 |
commit | e0dd1d57b3a335362da046e4e6f5ed96880f4d15 (patch) | |
tree | 58809a26393c895b6270fd81cab8581b614e39dd /clang | |
parent | 372565211e075b4aad983d74b9d4f8c0ad0da3b2 (diff) | |
download | bcm5719-llvm-e0dd1d57b3a335362da046e4e6f5ed96880f4d15.tar.gz bcm5719-llvm-e0dd1d57b3a335362da046e4e6f5ed96880f4d15.zip |
Improvements to the FunctionDecl getters/setters.
llvm-svn: 71800
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/AST/Decl.h | 22 | ||||
-rw-r--r-- | clang/lib/AST/Decl.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Frontend/PCHReaderDecl.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Frontend/PCHWriterDecl.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 |
5 files changed, 20 insertions, 16 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index b2f18a73c5d..a0b47c9e40c 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -519,8 +519,8 @@ private: 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 @@ protected: 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 @@ public: 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 @@ public: /// 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. /// diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 319d4d5756c..c62c1e2b0ea 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -123,12 +123,12 @@ FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC, 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; } diff --git a/clang/lib/Frontend/PCHReaderDecl.cpp b/clang/lib/Frontend/PCHReaderDecl.cpp index 9dd15658903..45af36c82f4 100644 --- a/clang/lib/Frontend/PCHReaderDecl.cpp +++ b/clang/lib/Frontend/PCHReaderDecl.cpp @@ -151,8 +151,8 @@ void PCHDeclReader::VisitFunctionDecl(FunctionDecl *FD) { 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 diff --git a/clang/lib/Frontend/PCHWriterDecl.cpp b/clang/lib/Frontend/PCHWriterDecl.cpp index 96045f94c53..48c7dc2d4aa 100644 --- a/clang/lib/Frontend/PCHWriterDecl.cpp +++ b/clang/lib/Frontend/PCHWriterDecl.cpp @@ -151,8 +151,8 @@ void PCHDeclWriter::VisitFunctionDecl(FunctionDecl *D) { 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 diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 20b24d12311..1c464d16b05 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -736,7 +736,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { OldProto->isVariadic(), OldProto->getTypeQuals()); New->setType(NewQType); - New->setInheritedPrototype(); + New->setHasInheritedPrototype(); // Synthesize a parameter for each argument type. llvm::SmallVector<ParmVarDecl*, 16> Params; |