From: Argyrios Kyrtzidis Date: Tue, 13 Jan 2009 13:11:58 +0000 (+0000) Subject: DeclContext::KindTrait was not meant to be used outside of DeclContext::CastTo (cause... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b9ca01ff3136a7539dc08a4c4e1a3dd8c8d3a7d;p=clang DeclContext::KindTrait was not meant to be used outside of DeclContext::CastTo (causes compilation error on MSVC). Add DeclContext::getDeclKind() and use that instead of DeclContext::KindTrait. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62164 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp index d16b494888..9487a05072 100644 --- a/Driver/ASTConsumers.cpp +++ b/Driver/ASTConsumers.cpp @@ -575,8 +575,7 @@ public: void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, unsigned Indentation) { // Print DeclContext name. - Decl::Kind DK = DeclContext::KindTrait::getKind(DC); - switch (DK) { + switch (DC->getDeclKind()) { case Decl::TranslationUnit: Out << "[translation unit] " << DC; break; diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index b506436e26..d11c78d6a0 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -376,6 +376,10 @@ protected: public: ~DeclContext(); + Decl::Kind getDeclKind() const { + return DeclKind; + } + /// getParent - Returns the containing DeclContext if this is a ScopedDecl, /// else returns NULL. const DeclContext *getParent() const;