summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/clang/lib/Frontend/ASTConsumers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Frontend/ASTConsumers.cpp')
-rw-r--r--contrib/llvm/tools/clang/lib/Frontend/ASTConsumers.cpp77
1 files changed, 39 insertions, 38 deletions
diff --git a/contrib/llvm/tools/clang/lib/Frontend/ASTConsumers.cpp b/contrib/llvm/tools/clang/lib/Frontend/ASTConsumers.cpp
index 28d312a..54bb282 100644
--- a/contrib/llvm/tools/clang/lib/Frontend/ASTConsumers.cpp
+++ b/contrib/llvm/tools/clang/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<NamespaceDecl>(DC);
- Out << ND;
+ Out << *ND;
break;
}
case Decl::Enum: {
const EnumDecl* ED = cast<EnumDecl>(DC);
- if (ED->isDefinition())
+ if (ED->isCompleteDefinition())
Out << "[enum] ";
else
Out << "<enum> ";
- Out << ED;
+ Out << *ED;
break;
}
case Decl::Record: {
const RecordDecl* RD = cast<RecordDecl>(DC);
- if (RD->isDefinition())
+ if (RD->isCompleteDefinition())
Out << "[struct] ";
else
Out << "<struct> ";
- Out << RD;
+ Out << *RD;
break;
}
case Decl::CXXRecord: {
const CXXRecordDecl* RD = cast<CXXRecordDecl>(DC);
- if (RD->isDefinition())
+ if (RD->isCompleteDefinition())
Out << "[class] ";
else
Out << "<class> ";
- Out << RD << ' ' << DC;
+ Out << *RD << ' ' << DC;
break;
}
case Decl::ObjCMethod:
@@ -177,7 +178,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
Out << "[function] ";
else
Out << "<function> ";
- 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 << "<c++ method> ";
- 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 << "<c++ ctor> ";
- 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 << "<c++ dtor> ";
- 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 << "<c++ conversion> ";
- 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<IndirectFieldDecl>(*I);
- Out << "<IndirectField> " << IFD << '\n';
+ Out << "<IndirectField> " << *IFD << '\n';
break;
}
case Decl::Label: {
LabelDecl *LD = cast<LabelDecl>(*I);
- Out << "<Label> " << LD << '\n';
+ Out << "<Label> " << *LD << '\n';
break;
}
case Decl::Field: {
FieldDecl *FD = cast<FieldDecl>(*I);
- Out << "<field> " << FD << '\n';
+ Out << "<field> " << *FD << '\n';
break;
}
case Decl::Typedef:
case Decl::TypeAlias: {
TypedefNameDecl* TD = cast<TypedefNameDecl>(*I);
- Out << "<typedef> " << TD << '\n';
+ Out << "<typedef> " << *TD << '\n';
break;
}
case Decl::EnumConstant: {
EnumConstantDecl* ECD = cast<EnumConstantDecl>(*I);
- Out << "<enum constant> " << ECD << '\n';
+ Out << "<enum constant> " << *ECD << '\n';
break;
}
case Decl::Var: {
VarDecl* VD = cast<VarDecl>(*I);
- Out << "<var> " << VD << '\n';
+ Out << "<var> " << *VD << '\n';
break;
}
case Decl::ImplicitParam: {
ImplicitParamDecl* IPD = cast<ImplicitParamDecl>(*I);
- Out << "<implicit parameter> " << IPD << '\n';
+ Out << "<implicit parameter> " << *IPD << '\n';
break;
}
case Decl::ParmVar: {
ParmVarDecl* PVD = cast<ParmVarDecl>(*I);
- Out << "<parameter> " << PVD << '\n';
+ Out << "<parameter> " << *PVD << '\n';
break;
}
case Decl::ObjCProperty: {
ObjCPropertyDecl* OPD = cast<ObjCPropertyDecl>(*I);
- Out << "<objc property> " << OPD << '\n';
+ Out << "<objc property> " << *OPD << '\n';
break;
}
case Decl::FunctionTemplate: {
FunctionTemplateDecl* FTD = cast<FunctionTemplateDecl>(*I);
- Out << "<function template> " << FTD << '\n';
+ Out << "<function template> " << *FTD << '\n';
break;
}
case Decl::FileScopeAsm: {
@@ -381,17 +382,17 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
}
case Decl::NamespaceAlias: {
NamespaceAliasDecl* NAD = cast<NamespaceAliasDecl>(*I);
- Out << "<namespace alias> " << NAD << '\n';
+ Out << "<namespace alias> " << *NAD << '\n';
break;
}
case Decl::ClassTemplate: {
ClassTemplateDecl *CTD = cast<ClassTemplateDecl>(*I);
- Out << "<class template> " << CTD << '\n';
+ Out << "<class template> " << *CTD << '\n';
break;
}
default:
Out << "DeclKind: " << DK << '"' << *I << "\"\n";
- assert(0 && "decl unhandled");
+ llvm_unreachable("decl unhandled");
}
}
}
@@ -404,10 +405,10 @@ ASTConsumer *clang::CreateDeclContextPrinter() {
namespace {
class ASTDumpXML : public ASTConsumer {
- llvm::raw_ostream &OS;
+ raw_ostream &OS;
public:
- ASTDumpXML(llvm::raw_ostream &OS) : OS(OS) {}
+ ASTDumpXML(raw_ostream &OS) : OS(OS) {}
void HandleTranslationUnit(ASTContext &C) {
C.getTranslationUnitDecl()->dumpXML(OS);
@@ -415,6 +416,6 @@ public:
};
}
-ASTConsumer *clang::CreateASTDumperXML(llvm::raw_ostream &OS) {
+ASTConsumer *clang::CreateASTDumperXML(raw_ostream &OS) {
return new ASTDumpXML(OS);
}
OpenPOWER on IntegriCloud