diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-12-28 09:18:54 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-12-28 09:18:54 +0000 |
commit | 0ee66aad3e44d03c6e9c3fd8a5aaafde89028d94 (patch) | |
tree | 9b11ffcfb225684be430f90790241e69db8fdc6c /include | |
parent | 150e296459c5dab146545ec8bec6066718eaad67 (diff) |
Sema: Don't crash when an inject class name has a nested redefinition
We expected the type of a TagDecl to be a TagType, not an
InjectedClassNameType. Introduced a helper method, Type::getAsTagDecl,
to abstract away the difference; redefine Type::getAsCXXRecordDecl to be
in terms of it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224898 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/AST/Type.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 9c3af0781f..8a77c1dd00 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -1707,6 +1707,11 @@ public: /// type of a class template or class template partial specialization. CXXRecordDecl *getAsCXXRecordDecl() const; + /// \brief Retrieves the TagDecl that this type refers to, either + /// because the type is a TagType or because it is the injected-class-name + /// type of a class template or class template partial specialization. + TagDecl *getAsTagDecl() const; + /// If this is a pointer or reference to a RecordType, return the /// CXXRecordDecl that that type refers to. /// |