diff options
80 files changed, 424 insertions, 14 deletions
diff --git a/include/clang/AST/Attr.h b/include/clang/AST/Attr.h index 345cc94510..449e916eb1 100644 --- a/include/clang/AST/Attr.h +++ b/include/clang/AST/Attr.h @@ -112,6 +112,7 @@ public: }; class InheritableAttr : public Attr { + virtual void anchor(); protected: InheritableAttr(attr::Kind AK, SourceRange R) : Attr(AK, R) {} @@ -127,6 +128,7 @@ public: }; class InheritableParamAttr : public InheritableAttr { + virtual void anchor(); protected: InheritableParamAttr(attr::Kind AK, SourceRange R) : InheritableAttr(AK, R) {} diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 0a24b72560..6b97a5775a 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -67,6 +67,7 @@ public: /// TranslationUnitDecl - The top declaration context. class TranslationUnitDecl : public Decl, public DeclContext { + virtual void anchor(); ASTContext &Ctx; /// The (most recently entered) anonymous namespace for this @@ -99,6 +100,7 @@ public: /// NamedDecl - This represents a decl with a name. Many decls have names such /// as ObjCMethodDecl, but not @class, etc. class NamedDecl : public Decl { + virtual void anchor(); /// Name - The name of this declaration, which is typically a normal /// identifier but may also be a special kind of name (C++ /// constructor, Objective-C selector, etc.) @@ -320,6 +322,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const NamedDecl &ND) { /// location of the statement. For GNU local labels (__label__), the decl /// location is where the __label__ is. class LabelDecl : public NamedDecl { + virtual void anchor(); LabelStmt *TheStmt; /// LocStart - For normal labels, this is the same as the main declaration /// label, i.e., the location of the identifier; for GNU local labels, @@ -355,6 +358,7 @@ public: /// NamespaceDecl - Represent a C++ namespace. class NamespaceDecl : public NamedDecl, public DeclContext { + virtual void anchor(); bool IsInline : 1; /// LocStart - The starting location of the source range, pointing @@ -498,6 +502,7 @@ public: /// an lvalue) a function (in which case it is a function designator) or /// an enum constant. class ValueDecl : public NamedDecl { + virtual void anchor(); QualType DeclType; protected: @@ -1137,6 +1142,7 @@ public: }; class ImplicitParamDecl : public VarDecl { + virtual void anchor(); public: static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, @@ -2140,6 +2146,7 @@ public: /// field injected from an anonymous union/struct into the parent scope. /// IndirectFieldDecl are always implicit. class IndirectFieldDecl : public ValueDecl { + virtual void anchor(); NamedDecl **Chaining; unsigned ChainingSize; @@ -2179,6 +2186,7 @@ public: /// TypeDecl - Represents a declaration of a type. /// class TypeDecl : public NamedDecl { + virtual void anchor(); /// TypeForDecl - This indicates the Type object that represents /// this TypeDecl. It is a cache maintained by /// ASTContext::getTypedefType, ASTContext::getTagDeclType, and @@ -2220,6 +2228,7 @@ public: /// Base class for declarations which introduce a typedef-name. class TypedefNameDecl : public TypeDecl, public Redeclarable<TypedefNameDecl> { + virtual void anchor(); /// UnderlyingType - This is the type the typedef is set to. TypeSourceInfo *TInfo; @@ -2547,6 +2556,7 @@ public: /// EnumDecl - Represents an enum. As an extension, we allow forward-declared /// enums. class EnumDecl : public TagDecl { + virtual void anchor(); /// IntegerType - This represent the integer type that the enum corresponds /// to for code generation purposes. Note that the enumerator constants may /// have a different type than this does. @@ -2866,6 +2876,7 @@ private: }; class FileScopeAsmDecl : public Decl { + virtual void anchor(); StringLiteral *AsmString; SourceLocation RParenLoc; FileScopeAsmDecl(DeclContext *DC, StringLiteral *asmstring, diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index c8a703f38f..7c040e7d2e 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -104,6 +104,7 @@ namespace clang { /// Also note that this class has nothing to do with so-called /// "access declarations" (C++98 11.3 [class.access.dcl]). class AccessSpecDecl : public Decl { + virtual void anchor(); /// ColonLoc - The location of the ':'. SourceLocation ColonLoc; @@ -1316,6 +1317,7 @@ public: /// CXXMethodDecl - Represents a static or instance method of a /// struct/union/class. class CXXMethodDecl : public FunctionDecl { + virtual void anchor(); protected: CXXMethodDecl(Kind DK, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, @@ -1325,9 +1327,9 @@ protected: : FunctionDecl(DK, RD, StartLoc, NameInfo, T, TInfo, (isStatic ? SC_Static : SC_None), SCAsWritten, isInline, isConstexpr) { - if (EndLocation.isValid()) - setRangeEnd(EndLocation); - } + if (EndLocation.isValid()) + setRangeEnd(EndLocation); + } public: static CXXMethodDecl *Create(ASTContext &C, CXXRecordDecl *RD, @@ -1690,6 +1692,7 @@ public: /// }; /// @endcode class CXXConstructorDecl : public CXXMethodDecl { + virtual void anchor(); /// IsExplicitSpecified - Whether this constructor declaration has the /// 'explicit' keyword specified. bool IsExplicitSpecified : 1; @@ -1918,6 +1921,7 @@ public: /// }; /// @endcode class CXXDestructorDecl : public CXXMethodDecl { + virtual void anchor(); /// ImplicitlyDefined - Whether this destructor was implicitly /// defined by the compiler. When false, the destructor was defined /// by the user. In C++03, this flag will have the same value as @@ -1989,6 +1993,7 @@ public: /// }; /// @endcode class CXXConversionDecl : public CXXMethodDecl { + virtual void anchor(); /// IsExplicitSpecified - Whether this conversion function declaration is /// marked "explicit", meaning that it can only be applied when the user /// explicitly wrote a cast. This is a C++0x feature. @@ -2045,6 +2050,7 @@ public: /// extern "C" void foo(); /// class LinkageSpecDecl : public Decl, public DeclContext { + virtual void anchor(); public: /// LanguageIDs - Used to represent the language in a linkage /// specification. The values are part of the serialization abi for @@ -2117,9 +2123,10 @@ public: /// using namespace std; /// // NB: UsingDirectiveDecl should be Decl not NamedDecl, but we provide -// artificial name, for all using-directives in order to store +// artificial names for all using-directives in order to store // them in DeclContext effectively. class UsingDirectiveDecl : public NamedDecl { + virtual void anchor(); /// \brief The location of the "using" keyword. SourceLocation UsingLoc; @@ -2219,6 +2226,8 @@ public: /// namespace Foo = Bar; /// @endcode class NamespaceAliasDecl : public NamedDecl { + virtual void anchor(); + /// \brief The location of the "namespace" keyword. SourceLocation NamespaceLoc; @@ -2308,6 +2317,8 @@ public: /// } /// class UsingShadowDecl : public NamedDecl { + virtual void anchor(); + /// The referenced declaration. NamedDecl *Underlying; @@ -2367,6 +2378,8 @@ public: /// UsingDecl - Represents a C++ using-declaration. For example: /// using someNameSpace::someIdentifier; class UsingDecl : public NamedDecl { + virtual void anchor(); + /// \brief The source location of the "using" location itself. SourceLocation UsingLocation; @@ -2497,6 +2510,8 @@ public: /// using Base<T>::foo; /// }; class UnresolvedUsingValueDecl : public ValueDecl { + virtual void anchor(); + /// \brief The source location of the 'using' keyword SourceLocation UsingLocation; @@ -2564,6 +2579,8 @@ public: /// The type associated with a unresolved using typename decl is /// currently always a typename type. class UnresolvedUsingTypenameDecl : public TypeDecl { + virtual void anchor(); + /// \brief The source location of the 'using' keyword SourceLocation UsingLocation; @@ -2612,6 +2629,7 @@ public: /// StaticAssertDecl - Represents a C++0x static_assert declaration. class StaticAssertDecl : public Decl { + virtual void anchor(); Expr *AssertExpr; StringLiteral *Message; SourceLocation RParenLoc; diff --git a/include/clang/AST/DeclFriend.h b/include/clang/AST/DeclFriend.h index b84e5bba86..07f696a4df 100644 --- a/include/clang/AST/DeclFriend.h +++ b/include/clang/AST/DeclFriend.h @@ -35,6 +35,7 @@ namespace clang { /// /// The semantic context of a friend decl is its declaring class. class FriendDecl : public Decl { + virtual void anchor(); public: typedef llvm::PointerUnion<NamedDecl*,TypeSourceInfo*> FriendUnion; diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index 6a0b6acc87..8cc6e7374d 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -426,6 +426,8 @@ public: /// ObjCProtocolDecl, and ObjCImplDecl. /// class ObjCContainerDecl : public NamedDecl, public DeclContext { + virtual void anchor(); + SourceLocation AtStart; // These two locations in the range mark the end of the method container. @@ -542,6 +544,8 @@ public: /// class ObjCInterfaceDecl : public ObjCContainerDecl , public Redeclarable<ObjCInterfaceDecl> { + virtual void anchor(); + /// TypeForDecl - This indicates the Type object that represents this /// TypeDecl. It is a cache maintained by ASTContext::getObjCInterfaceType mutable const Type *TypeForDecl; @@ -949,6 +953,8 @@ public: /// } /// class ObjCIvarDecl : public FieldDecl { + virtual void anchor(); + public: enum AccessControl { None, Private, Protected, Public, Package @@ -1010,7 +1016,7 @@ private: /// ObjCAtDefsFieldDecl - Represents a field declaration created by an /// @defs(...). class ObjCAtDefsFieldDecl : public FieldDecl { -private: + virtual void anchor(); ObjCAtDefsFieldDecl(DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, Expr *BW) @@ -1055,6 +1061,8 @@ public: /// id <NSDraggingInfo> anyObjectThatImplementsNSDraggingInfo; /// class ObjCProtocolDecl : public ObjCContainerDecl { + virtual void anchor(); + /// Referenced protocols ObjCProtocolList ReferencedProtocols; @@ -1173,6 +1181,8 @@ public: /// @protocol NSTextInput, NSChangeSpelling, NSDraggingInfo; /// class ObjCForwardProtocolDecl : public Decl { + virtual void anchor(); + ObjCProtocolList ReferencedProtocols; ObjCForwardProtocolDecl(DeclContext *DC, SourceLocation L, @@ -1232,6 +1242,8 @@ public: /// don't support this level of dynamism, which is both powerful and dangerous. /// class ObjCCategoryDecl : public ObjCContainerDecl { + virtual void anchor(); + /// Interface belonging to this category ObjCInterfaceDecl *ClassInterface; @@ -1328,6 +1340,8 @@ public: }; class ObjCImplDecl : public ObjCContainerDecl { + virtual void anchor(); + /// Class interface for this class/category implementation ObjCInterfaceDecl *ClassInterface; @@ -1391,6 +1405,8 @@ public: /// /// ObjCCategoryImplDecl class ObjCCategoryImplDecl : public ObjCImplDecl { + virtual void anchor(); + // Category name IdentifierInfo *Id; @@ -1479,6 +1495,7 @@ raw_ostream &operator<<(raw_ostream &OS, /// specified, they need to be *identical* to the interface. /// class ObjCImplementationDecl : public ObjCImplDecl { + virtual void anchor(); /// Implementation Class's super class. ObjCInterfaceDecl *SuperClass; /// Support for ivar initialization. @@ -1609,6 +1626,7 @@ raw_ostream &operator<<(raw_ostream &OS, /// ObjCCompatibleAliasDecl - Represents alias of a class. This alias is /// declared as @compatibility_alias alias class. class ObjCCompatibleAliasDecl : public NamedDecl { + virtual void anchor(); /// Class that this is an alias of. ObjCInterfaceDecl *AliasedClass; @@ -1635,6 +1653,7 @@ public: /// @property (assign, readwrite) int MyProperty; /// class ObjCPropertyDecl : public NamedDecl { + virtual void anchor(); public: enum PropertyAttributeKind { OBJC_PR_noattr = 0x00, diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index 9149850e8f..f6bc41a640 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -198,6 +198,7 @@ public: /// parameters and a reference to the templated scoped declaration: the /// underlying AST node. class TemplateDecl : public NamedDecl { + virtual void anchor(); protected: // This is probably never used. TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, @@ -1201,6 +1202,7 @@ public: /// name of a template and the template parameters allowable for substitution. class TemplateTemplateParmDecl : public TemplateDecl, protected TemplateParmPosition { + virtual void anchor(); /// DefaultArgument - The default template argument, if any. TemplateArgumentLoc DefaultArgument; @@ -1561,6 +1563,8 @@ public: class ClassTemplatePartialSpecializationDecl : public ClassTemplateSpecializationDecl { + virtual void anchor(); + /// \brief The list of template parameters TemplateParameterList* TemplateParams; @@ -1941,6 +1945,7 @@ public: /// NOTE: This class is not currently in use. All of the above /// will yield a FriendDecl, not a FriendTemplateDecl. class FriendTemplateDecl : public Decl { + virtual void anchor(); public: typedef llvm::PointerUnion<NamedDecl*,TypeSourceInfo*> FriendUnion; @@ -2107,7 +2112,8 @@ public: /// CXXMethodDecl. Then during an instantiation of class A, it will be /// transformed into an actual function specialization. class ClassScopeFunctionSpecializationDecl : public Decl { -private: |