70695fe2be
Parser::Scope versus Sema::DeclContext are now checked for cross-vailidity. Emit the TU-transaction explicitly instead of relying on a first transaction. The typename extraction now takes a stream instead of a string to write to. The llvm::Linker has much reduced functionality; use llvm::sys::Path instead to find dynamic libraries. git-svn-id: http://root.cern.ch/svn/root/trunk@49325 27541ba8-7e3a-0410-8455-c3a389f83636
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
//------------------------------------------------------------------------------
|
|
// CLING - the C++ LLVM-based InterpreterG :)
|
|
// version: $Id$
|
|
// author: Vassil Vassilev <vasil.georgiev.vasilev@cern.ch>
|
|
//------------------------------------------------------------------------------
|
|
|
|
#include "ASTDumper.h"
|
|
#include "cling/Interpreter/Transaction.h"
|
|
|
|
#include "clang/AST/ASTContext.h"
|
|
#include "clang/AST/Decl.h"
|
|
#include "clang/AST/Stmt.h"
|
|
#include "clang/Sema/Sema.h"
|
|
|
|
using namespace clang;
|
|
|
|
namespace cling {
|
|
|
|
// pin the vtable to this file
|
|
ASTDumper::~ASTDumper() {}
|
|
|
|
|
|
void ASTDumper::Transform() {
|
|
if (!getTransaction()->getCompilationOpts().Debug)
|
|
return;
|
|
|
|
// FIXME: Size might change in the loop!
|
|
for (size_t Idx = 0; Idx < getTransaction()->size(); ++Idx) {
|
|
// Copy DCI; it might get relocated below.
|
|
Transaction::DelayCallInfo I = (*getTransaction())[Idx];
|
|
for (DeclGroupRef::const_iterator J = I.m_DGR.begin(),
|
|
JE = I.m_DGR.end(); J != JE; ++J)
|
|
printDecl(*J);
|
|
}
|
|
}
|
|
|
|
void ASTDumper::printDecl(Decl* D) {
|
|
if (D) {
|
|
llvm::errs() << "\n-------------------Declaration---------------------\n";
|
|
D->dump();
|
|
|
|
if (Stmt* Body = D->getBody()) {
|
|
llvm::errs() << "\n------------------Declaration Body---------------\n";
|
|
Body->dump();
|
|
}
|
|
llvm::errs() << "\n---------------------------------------------------\n";
|
|
}
|
|
}
|
|
} // namespace cling
|