diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/AST/ASTContext.h | 6 | ||||
-rw-r--r-- | include/clang/AST/DeclBase.h | 12 | ||||
-rw-r--r-- | include/clang/AST/Type.h | 13 |
3 files changed, 20 insertions, 11 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 2f669b131d..b29c23e3f7 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -176,7 +176,11 @@ public: /// list. isVariadic indicates whether the argument list includes '...'. QualType getFunctionType(QualType ResultTy, QualType *ArgArray, unsigned NumArgs, bool isVariadic); - + + /// getTypeDeclType - Return the unique reference to the type for + /// the specified type declaration. + QualType getTypeDeclType(TypeDecl *Decl); + /// getTypedefType - Return the unique reference to the type for the /// specified typename decl. QualType getTypedefType(TypedefDecl *Decl); diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index 058cb9223c..a5c1cb29ec 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -80,12 +80,14 @@ public: }; /// IdentifierNamespace - According to C99 6.2.3, there are four namespaces, - /// labels, tags, members and ordinary identifiers. + /// labels, tags, members and ordinary identifiers. These are meant + /// as bitmasks, so that searches in C++ can look into the "tag" namespace + /// during ordinary lookup. enum IdentifierNamespace { - IDNS_Label, - IDNS_Tag, - IDNS_Member, - IDNS_Ordinary + IDNS_Label = 0x1, + IDNS_Tag = 0x2, + IDNS_Member = 0x4, + IDNS_Ordinary = 0x8 }; /// ObjCDeclQualifier - Qualifier used on types in method declarations diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 5d36b759a3..8b5ed4ce63 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -994,10 +994,11 @@ public: class TagType : public Type { TagDecl *decl; + +protected: TagType(TagDecl *D, QualType can) : Type(Tagged, can), decl(D) {} - friend class ASTContext; // ASTContext creates these. -public: - + +public: TagDecl *getDecl() const { return decl; } virtual void getAsStringInternal(std::string &InnerString) const; @@ -1014,7 +1015,8 @@ protected: /// RecordType - This is a helper class that allows the use of isa/cast/dyncast /// to detect TagType objects of structs/unions/classes. class RecordType : public TagType { - RecordType(); // DO NOT IMPLEMENT + explicit RecordType(RecordDecl *D) : TagType(cast<TagDecl>(D), QualType()) { } + friend class ASTContext; // ASTContext creates these. public: RecordDecl *getDecl() const { @@ -1040,7 +1042,8 @@ public: /// EnumType - This is a helper class that allows the use of isa/cast/dyncast /// to detect TagType objects of enums. class EnumType : public TagType { - EnumType(); // DO NOT IMPLEMENT + explicit EnumType(EnumDecl *D) : TagType(cast<TagDecl>(D), QualType()) { } + friend class ASTContext; // ASTContext creates these. public: EnumDecl *getDecl() const { |