From 36981b17ed939300f6f8fc2355a255f711fcef71 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 20 Oct 2011 21:14:49 +0000 Subject: Vendor import of clang release_30 branch r142614: http://llvm.org/svn/llvm-project/cfe/branches/release_30@142614 --- lib/Frontend/ASTConsumers.cpp | 77 ++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 38 deletions(-) (limited to 'lib/Frontend/ASTConsumers.cpp') diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp index 28d312a2219b4..54bb282728682 100644 --- a/lib/Frontend/ASTConsumers.cpp +++ b/lib/Frontend/ASTConsumers.cpp @@ -31,22 +31,23 @@ using namespace clang; namespace { class ASTPrinter : public ASTConsumer { - llvm::raw_ostream &Out; + raw_ostream &Out; bool Dump; public: - ASTPrinter(llvm::raw_ostream* o = NULL, bool Dump = false) + ASTPrinter(raw_ostream* o = NULL, bool Dump = false) : Out(o? *o : llvm::outs()), Dump(Dump) { } virtual void HandleTranslationUnit(ASTContext &Context) { - PrintingPolicy Policy = Context.PrintingPolicy; + PrintingPolicy Policy = Context.getPrintingPolicy(); Policy.Dump = Dump; - Context.getTranslationUnitDecl()->print(Out, Policy); + Context.getTranslationUnitDecl()->print(Out, Policy, /*Indentation=*/0, + /*PrintInstantiation=*/true); } }; } // end anonymous namespace -ASTConsumer *clang::CreateASTPrinter(llvm::raw_ostream* out) { +ASTConsumer *clang::CreateASTPrinter(raw_ostream* out) { return new ASTPrinter(out); } @@ -95,7 +96,7 @@ ASTConsumer *clang::CreateASTViewer() { return new ASTViewer(); } namespace { class DeclContextPrinter : public ASTConsumer { - llvm::raw_ostream& Out; + raw_ostream& Out; public: DeclContextPrinter() : Out(llvm::errs()) {} @@ -117,34 +118,34 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, case Decl::Namespace: { Out << "[namespace] "; const NamespaceDecl* ND = cast(DC); - Out << ND; + Out << *ND; break; } case Decl::Enum: { const EnumDecl* ED = cast(DC); - if (ED->isDefinition()) + if (ED->isCompleteDefinition()) Out << "[enum] "; else Out << " "; - Out << ED; + Out << *ED; break; } case Decl::Record: { const RecordDecl* RD = cast(DC); - if (RD->isDefinition()) + if (RD->isCompleteDefinition()) Out << "[struct] "; else Out << " "; - Out << RD; + Out << *RD; break; } case Decl::CXXRecord: { const CXXRecordDecl* RD = cast(DC); - if (RD->isDefinition()) + if (RD->isCompleteDefinition()) Out << "[class] "; else Out << " "; - Out << RD << ' ' << DC; + Out << *RD << ' ' << DC; break; } case Decl::ObjCMethod: @@ -177,7 +178,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "[function] "; else Out << " "; - Out << FD; + Out << *FD; // Print the parameters. Out << "("; bool PrintComma = false; @@ -187,7 +188,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << ", "; else PrintComma = true; - Out << *I; + Out << **I; } Out << ")"; break; @@ -200,7 +201,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "(c++ method) "; else Out << " "; - Out << D; + Out << *D; // Print the parameters. Out << "("; bool PrintComma = false; @@ -210,7 +211,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << ", "; else PrintComma = true; - Out << *I; + Out << **I; } Out << ")"; @@ -230,7 +231,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "(c++ ctor) "; else Out << " "; - Out << D; + Out << *D; // Print the parameters. Out << "("; bool PrintComma = false; @@ -240,7 +241,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << ", "; else PrintComma = true; - Out << *I; + Out << **I; } Out << ")"; @@ -259,7 +260,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "(c++ dtor) "; else Out << " "; - Out << D; + Out << *D; // Check the semantic DC. const DeclContext* SemaDC = D->getDeclContext(); const DeclContext* LexicalDC = D->getLexicalDeclContext(); @@ -275,7 +276,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "(c++ conversion) "; else Out << " "; - Out << D; + Out << *D; // Check the semantic DC. const DeclContext* SemaDC = D->getDeclContext(); const DeclContext* LexicalDC = D->getLexicalDeclContext(); @@ -285,7 +286,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, } default: - assert(0 && "a decl that inherits DeclContext isn't handled"); + llvm_unreachable("a decl that inherits DeclContext isn't handled"); } Out << "\n"; @@ -322,53 +323,53 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, } case Decl::IndirectField: { IndirectFieldDecl* IFD = cast(*I); - Out << " " << IFD << '\n'; + Out << " " << *IFD << '\n'; break; } case Decl::Label: { LabelDecl *LD = cast(*I); - Out << "