diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
| commit | 2b6b257f4e5503a7a2675bdb8735693db769f75c (patch) | |
| tree | e85e046ae7003fe3bcc8b5454cd0fa3f7407b470 /lib/AST/NestedNameSpecifier.cpp | |
| parent | b4348ed0b7e90c0831b925fbee00b5f179a99796 (diff) | |
Notes
Diffstat (limited to 'lib/AST/NestedNameSpecifier.cpp')
| -rw-r--r-- | lib/AST/NestedNameSpecifier.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/AST/NestedNameSpecifier.cpp b/lib/AST/NestedNameSpecifier.cpp index d2370c88b9c5..82809d7ea7b5 100644 --- a/lib/AST/NestedNameSpecifier.cpp +++ b/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 @@ -306,7 +315,7 @@ NestedNameSpecifier::print(raw_ostream &OS, // Print the template argument list. TemplateSpecializationType::PrintTemplateArgumentList( - OS, SpecType->getArgs(), SpecType->getNumArgs(), InnerPolicy); + OS, SpecType->template_arguments(), InnerPolicy); } else { // Print the type normally QualType(T, 0).print(OS, InnerPolicy); @@ -322,7 +331,7 @@ void NestedNameSpecifier::dump(const LangOptions &LO) const { print(llvm::errs(), PrintingPolicy(LO)); } -void NestedNameSpecifier::dump() const { +LLVM_DUMP_METHOD void NestedNameSpecifier::dump() const { LangOptions LO; print(llvm::errs(), PrintingPolicy(LO)); } |
