Commit Interpreter.cpp with dumpLookupTable() function not working yet.
This will be fully operational after the LLVM/Clang update.
This commit is contained in:
parent
34d2c33c18
commit
624354cfb4
@ -452,6 +452,13 @@ namespace cling {
|
||||
///
|
||||
void compareInterpreterState(const std::string& name) const;
|
||||
|
||||
///\brief Dump the Lookups tables in a file
|
||||
///
|
||||
///\param[in] name - The name of the temporary file where the lookups table
|
||||
/// will be printed
|
||||
///
|
||||
void dumpLookupTable (const std::string& name) const;
|
||||
|
||||
///\brief Compiles the given input.
|
||||
///
|
||||
/// This interface helps to run everything that cling can run. From
|
||||
|
@ -333,6 +333,7 @@ namespace cling {
|
||||
TU->print(Out, policy, Indentation, PrintInstantiation);
|
||||
Out.flush();
|
||||
}
|
||||
Interpreter::dumpLookupTable(name);
|
||||
}
|
||||
|
||||
void Interpreter::compareInterpreterState(const std::string& name) const {
|
||||
@ -455,6 +456,34 @@ namespace cling {
|
||||
if((result1 != 0) && (result2 != 0))
|
||||
perror( "Error deleting files were AST were stored" );
|
||||
}
|
||||
|
||||
void Interpreter::dumpLookupTable(const std::string& name) const {
|
||||
|
||||
std::string ErrMsg;
|
||||
llvm::sys::Path LookupFile = llvm::sys::Path::GetCurrentDirectory();
|
||||
if (LookupFile.isEmpty()) {
|
||||
llvm::errs() << "Error: " << ErrMsg << "\n";
|
||||
return;
|
||||
}
|
||||
std::string fileName = name + ".lookup";
|
||||
LookupFile.appendComponent(fileName);
|
||||
std::ofstream ofs (LookupFile.c_str(), std::ofstream::out);
|
||||
llvm::raw_os_ostream Out(ofs);
|
||||
|
||||
class DumpDeclContexts : public RecursiveASTVisitor<DumpDeclContexts> {
|
||||
private:
|
||||
llvm::raw_ostream& m_OS;
|
||||
public:
|
||||
DumpDeclContexts(llvm::raw_ostream& OS) : m_OS(OS) { }
|
||||
bool VisitDeclContext(DeclContext* DC) {
|
||||
//DC->dumpLookups(m_OS);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
ASTContext& C = getSema().getASTContext();
|
||||
DumpDeclContexts dumper(Out);
|
||||
dumper.TraverseDecl(C.getTranslationUnitDecl());
|
||||
}
|
||||
|
||||
// Adapted from clang/lib/Frontend/CompilerInvocation.cpp
|
||||
void Interpreter::GetIncludePaths(llvm::SmallVectorImpl<std::string>& incpaths,
|
||||
|
Loading…
Reference in New Issue
Block a user