summaryrefslogtreecommitdiffstats
path: root/lib/Frontend/ASTConsumers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Frontend/ASTConsumers.cpp')
-rw-r--r--lib/Frontend/ASTConsumers.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp
index eb7f270..92fb1e8 100644
--- a/lib/Frontend/ASTConsumers.cpp
+++ b/lib/Frontend/ASTConsumers.cpp
@@ -24,7 +24,7 @@
#include "llvm/Module.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/System/Path.h"
+#include "llvm/Support/Path.h"
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -354,8 +354,18 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
PrintDeclContext(DC, Indentation+2);
break;
}
+ case Decl::IndirectField: {
+ IndirectFieldDecl* IFD = cast<IndirectFieldDecl>(*I);
+ Out << "<IndirectField> " << IFD << '\n';
+ break;
+ }
+ case Decl::Label: {
+ LabelDecl *LD = cast<LabelDecl>(*I);
+ Out << "<Label> " << LD << '\n';
+ break;
+ }
case Decl::Field: {
- FieldDecl* FD = cast<FieldDecl>(*I);
+ FieldDecl *FD = cast<FieldDecl>(*I);
Out << "<field> " << FD << '\n';
break;
}
@@ -423,29 +433,21 @@ ASTConsumer *clang::CreateDeclContextPrinter() {
}
//===----------------------------------------------------------------------===//
-/// InheritanceViewer - C++ Inheritance Visualization
+/// ASTDumperXML - In-depth XML dumping.
namespace {
-class InheritanceViewer : public ASTConsumer {
- const std::string clsname;
+class ASTDumpXML : public ASTConsumer {
+ llvm::raw_ostream &OS;
+
public:
- InheritanceViewer(const std::string& cname) : clsname(cname) {}
+ ASTDumpXML(llvm::raw_ostream &OS) : OS(OS) {}
void HandleTranslationUnit(ASTContext &C) {
- for (ASTContext::type_iterator I=C.types_begin(),E=C.types_end(); I!=E; ++I)
- if (RecordType *T = dyn_cast<RecordType>(*I)) {
- if (CXXRecordDecl *D = dyn_cast<CXXRecordDecl>(T->getDecl())) {
- // FIXME: This lookup needs to be generalized to handle namespaces and
- // (when we support them) templates.
- if (D->getNameAsString() == clsname) {
- D->viewInheritance(C);
- }
- }
- }
- }
+ C.getTranslationUnitDecl()->dumpXML(OS);
+ }
};
}
-ASTConsumer *clang::CreateInheritanceViewer(const std::string& clsname) {
- return new InheritanceViewer(clsname);
+ASTConsumer *clang::CreateASTDumperXML(llvm::raw_ostream &OS) {
+ return new ASTDumpXML(OS);
}
OpenPOWER on IntegriCloud