diff options
Diffstat (limited to 'clang/lib/AST/NestedNameSpecifier.cpp')
-rw-r--r-- | clang/lib/AST/NestedNameSpecifier.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/AST/NestedNameSpecifier.cpp b/clang/lib/AST/NestedNameSpecifier.cpp index ede38626c8b..2f38db40d9a 100644 --- a/clang/lib/AST/NestedNameSpecifier.cpp +++ b/clang/lib/AST/NestedNameSpecifier.cpp @@ -171,10 +171,19 @@ NamespaceAliasDecl *NestedNameSpecifier::getAsNamespaceAlias() const { /// \brief Retrieve the record declaration stored in this nested name specifier. CXXRecordDecl *NestedNameSpecifier::getAsRecordDecl() const { - if (Prefix.getInt() == StoredDecl) + switch (Prefix.getInt()) { + case StoredIdentifier: + return nullptr; + + case StoredDecl: return dyn_cast<CXXRecordDecl>(static_cast<NamedDecl *>(Specifier)); - return nullptr; + case StoredTypeSpec: + case StoredTypeSpecWithTemplate: + return getAsType()->getAsCXXRecordDecl(); + } + + llvm_unreachable("Invalid NNS Kind!"); } /// \brief Whether this nested name specifier refers to a dependent |