diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-01-13 03:26:38 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-01-13 03:26:38 +0000 |
commit | 2a3eb0e22e671112ab19b62e9a40615d195a7f17 (patch) | |
tree | d7faff5a250e3961d30f23c9cb9a04a71718e138 | |
parent | 9c2a3dbf8a977eef20152f73bce7ea40031c18b2 (diff) |
Improve c++ methods printing in DeclContextPrinter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62143 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Driver/ASTConsumers.cpp | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp index 5bafd0928b..2aa7c651b2 100644 --- a/Driver/ASTConsumers.cpp +++ b/Driver/ASTConsumers.cpp @@ -647,46 +647,69 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, break; } case Decl::CXXMethod: { - CXXMethodDecl* CMD = CXXMethodDecl::castFromDeclContext(DC); - if (CMD->isOutOfLineDefinition()) + CXXMethodDecl* D = CXXMethodDecl::castFromDeclContext(DC); + if (D->isOutOfLineDefinition()) Out << "[c++ method] "; + else if (D->isImplicit()) + Out << "(c++ method) "; else Out << "<c++ method> "; - Out << CMD->getNameAsString(); + Out << D->getNameAsString(); // Check the semantic DeclContext. - DeclContext* SemaDC = CMD->getDeclContext(); - DeclContext* LexicalDC = CMD->getLexicalDeclContext(); - if (SemaDC != LexicalDC) { + DeclContext* SemaDC = D->getDeclContext(); + DeclContext* LexicalDC = D->getLexicalDeclContext(); + if (SemaDC != LexicalDC) Out << " [[" << SemaDC << "]]"; - } + break; } case Decl::CXXConstructor: { - CXXConstructorDecl* CMD = CXXConstructorDecl::castFromDeclContext(DC); - if (CMD->isOutOfLineDefinition()) + CXXConstructorDecl* D = CXXConstructorDecl::castFromDeclContext(DC); + if (D->isOutOfLineDefinition()) Out << "[c++ ctor] "; + else if (D->isImplicit()) + Out << "(c++ ctor) "; else Out << "<c++ ctor> "; - Out << CMD->getNameAsString(); + Out << D->getNameAsString(); + // Check the semantic DC. + DeclContext* SemaDC = D->getDeclContext(); + DeclContext* LexicalDC = D->getLexicalDeclContext(); + if (SemaDC != LexicalDC) + Out << " [[" << SemaDC << "]]"; break; } case Decl::CXXDestructor: { - CXXDestructorDecl* CMD = CXXDestructorDecl::castFromDeclContext(DC); - if (CMD->isOutOfLineDefinition()) + CXXDestructorDecl* D = CXXDestructorDecl::castFromDeclContext(DC); + if (D->isOutOfLineDefinition()) Out << "[c++ dtor] "; + else if (D->isImplicit()) + Out << "(c++ dtor) "; else Out << "<c++ dtor> "; - Out << CMD->getNameAsString(); + Out << D->getNameAsString(); + // Check the semantic DC. + DeclContext* SemaDC = D->getDeclContext(); + DeclContext* LexicalDC = D->getLexicalDeclContext(); + if (SemaDC != LexicalDC) + Out << " [[" << SemaDC << "]]"; break; } case Decl::CXXConversion: { - CXXConversionDecl* CMD = CXXConversionDecl::castFromDeclContext(DC); - if (CMD->isOutOfLineDefinition()) + CXXConversionDecl* D = CXXConversionDecl::castFromDeclContext(DC); + if (D->isOutOfLineDefinition()) Out << "[c++ conversion] "; + else if (D->isImplicit()) + Out << "(c++ conversion) "; else Out << "<c++ conversion> "; - Out << CMD->getNameAsString(); + Out << D->getNameAsString(); + // Check the semantic DC. + DeclContext* SemaDC = D->getDeclContext(); + DeclContext* LexicalDC = D->getLexicalDeclContext(); + if (SemaDC != LexicalDC) + Out << " [[" << SemaDC << "]]"; break; } |