diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/AST/Decl.h | 2 | ||||
-rw-r--r-- | include/clang/AST/DeclCXX.h | 34 | ||||
-rw-r--r-- | include/clang/Basic/IdentifierTable.h | 22 | ||||
-rw-r--r-- | include/clang/Parse/Action.h | 8 |
4 files changed, 49 insertions, 17 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index d7e25357c5..3a766bfd5e 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -67,7 +67,7 @@ public: : Decl(DK, L), Identifier(Id) {} IdentifierInfo *getIdentifier() const { return Identifier; } - const char *getName() const; + virtual const char *getName() const; static bool classof(const Decl *D) { return D->getKind() >= NamedFirst && D->getKind() <= NamedLast; diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index 26ccb62bdc..39c22aaf70 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -246,12 +246,8 @@ class CXXRecordDecl : public RecordDecl, public DeclContext { /// CXXConversionDecl. OverloadedFunctionDecl Conversions; - CXXRecordDecl(TagKind TK, DeclContext *DC, - SourceLocation L, IdentifierInfo *Id) - : RecordDecl(CXXRecord, TK, DC, L, Id), DeclContext(CXXRecord), - UserDeclaredConstructor(false), UserDeclaredCopyConstructor(false), - Aggregate(true), Polymorphic(false), Bases(0), NumBases(0), - Constructors(DC, Id), Destructor(0), Conversions(DC, Id) { } + CXXRecordDecl(ASTContext &C, TagKind TK, DeclContext *DC, + SourceLocation L, IdentifierInfo *Id); ~CXXRecordDecl(); @@ -592,6 +588,9 @@ public: QualType T, bool isExplicit, bool isInline, bool isImplicitlyDeclared); + /// getName - Returns a human-readable name for this constructor. + virtual const char *getName() const; + /// isExplicit - Whether this constructor was marked "explicit" or not. bool isExplicit() const { return Explicit; } @@ -687,13 +686,17 @@ class CXXDestructorDecl : public CXXMethodDecl { /// @c !ImplicitlyDeclared && ImplicitlyDefined. bool ImplicitlyDefined : 1; + /// Name - The formatted name of this destructor. This will be + /// generated when getName() is called. + mutable char *Name; + CXXDestructorDecl(CXXRecordDecl *RD, SourceLocation L, IdentifierInfo *Id, QualType T, bool isInline, bool isImplicitlyDeclared) : CXXMethodDecl(CXXDestructor, RD, L, Id, T, false, isInline, /*PrevDecl=*/0), ImplicitlyDeclared(isImplicitlyDeclared), - ImplicitlyDefined(false) { } + ImplicitlyDefined(false), Name(0) { } public: static CXXDestructorDecl *Create(ASTContext &C, CXXRecordDecl *RD, @@ -701,6 +704,11 @@ public: QualType T, bool isInline, bool isImplicitlyDeclared); + virtual ~CXXDestructorDecl(); + + /// getName - Returns a human-readable name for this destructor. + virtual const char *getName() const; + /// isImplicitlyDeclared - Whether this destructor was implicitly /// declared. If false, then this destructor was explicitly /// declared by the user. @@ -754,12 +762,16 @@ class CXXConversionDecl : public CXXMethodDecl { /// explicitly wrote a cast. This is a C++0x feature. bool Explicit : 1; + /// Name - The formatted name of this conversion function. This will + /// be generated when getName() is called. + mutable char *Name; + CXXConversionDecl(CXXRecordDecl *RD, SourceLocation L, IdentifierInfo *Id, QualType T, bool isInline, bool isExplicit) : CXXMethodDecl(CXXConversion, RD, L, Id, T, false, isInline, /*PrevDecl=*/0), - Explicit(isExplicit) { } + Explicit(isExplicit), Name(0) { } public: static CXXConversionDecl *Create(ASTContext &C, CXXRecordDecl *RD, @@ -767,6 +779,12 @@ public: QualType T, bool isInline, bool isExplicit); + virtual ~CXXConversionDecl(); + + /// getName - Returns a human-readable name for this conversion + /// function. + virtual const char *getName() const; + /// isExplicit - Whether this is an explicit conversion operator /// (C++0x only). Explicit conversion operators are only considered /// when the user has explicitly written a cast. diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 4a16a3e42b..f6b95ba380 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -178,6 +178,16 @@ class IdentifierTable { /// overloadable operators in C++. IdentifierInfo *OverloadedOperators[NUM_OVERLOADED_OPERATORS]; + /// ConstructorId - Placeholder identifier for C++ constructors. + IdentifierInfo *ConstructorId; + + /// DestructorId - Placeholder identifier for C++ destructor. + IdentifierInfo *DestructorId; + + /// ConversionFunctionId - Placeholder identifier for a C++ + /// conversion function. + IdentifierInfo *ConversionFunctionId; + public: /// IdentifierTable ctor - Create the identifier table, populating it with /// info about the language keywords for the language specified by LangOpts. @@ -203,6 +213,18 @@ public: return *OverloadedOperators[Op]; } + /// getConstructorId - Return a placeholder identifier for a C++ + /// constructor. + IdentifierInfo &getConstructorId(); + + /// getDestructorId - Return a placeholder identifier for a C++ + /// destructor. + IdentifierInfo &getDestructorId(); + + /// getConversionFunctionId - Return a placeholder identifier for a + /// C++ conversion function. + IdentifierInfo &getConversionFunctionId(); + typedef HashTableTy::const_iterator iterator; typedef HashTableTy::const_iterator const_iterator; diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index 1e036e7559..4aa900f628 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -154,14 +154,6 @@ public: virtual void ActOnCXXExitDeclaratorScope(const CXXScopeSpec &SS) { } - /// getTypeAsString - Returns a string that describes the given - /// type. This callback is used in C++ to form identifiers for - /// special declarations that otherwise don't have simple names, - /// such as constructors, destructors, and conversion functions. - virtual std::string getTypeAsString(TypeTy *Type) { - return "<unknown type>"; - } - /// ActOnDeclarator - This callback is invoked when a declarator is parsed and /// 'Init' specifies the initializer if any. This is for things like: /// "int X = 4" or "typedef int foo". |