Pass Preproc and ASTContext instead of Sema to forward decl printer.
This will allow to lookup files during the printing
This commit is contained in:
parent
39ea2ba5c2
commit
f4d9d9ccae
@ -39,6 +39,7 @@ namespace clang {
|
||||
class GlobalDecl;
|
||||
class NamedDecl;
|
||||
class Parser;
|
||||
class Preprocessor;
|
||||
class QualType;
|
||||
class RecordDecl;
|
||||
class Sema;
|
||||
@ -700,7 +701,8 @@ namespace cling {
|
||||
void GenerateAutoloadingMap(llvm::StringRef inFile, llvm::StringRef outFile,
|
||||
bool enableMacros = false, bool enableLogs = true);
|
||||
|
||||
void forwardDeclare(Transaction& T, clang::Sema& S,
|
||||
void forwardDeclare(Transaction& T, clang::Preprocessor& P,
|
||||
clang::ASTContext& Ctx,
|
||||
llvm::raw_ostream& out,
|
||||
bool enableMacros = false,
|
||||
llvm::raw_ostream* logs = 0,
|
||||
|
@ -23,14 +23,15 @@ namespace cling {
|
||||
|
||||
ForwardDeclPrinter::ForwardDeclPrinter(llvm::raw_ostream& OutS,
|
||||
llvm::raw_ostream& LogS,
|
||||
Sema& S,
|
||||
Preprocessor& P,
|
||||
ASTContext& Ctx,
|
||||
const Transaction& T,
|
||||
unsigned Indentation,
|
||||
bool printMacros,
|
||||
IgnoreFilesFunc_t ignoreFiles)
|
||||
: m_Policy(clang::PrintingPolicy(clang::LangOptions())), m_Log(LogS),
|
||||
m_Indentation(Indentation), m_SMgr(S.getSourceManager()),
|
||||
m_Ctx(S.getASTContext()), m_SkipFlag(false), m_IgnoreFile(ignoreFiles) {
|
||||
m_Indentation(Indentation), m_PP(P), m_SMgr(P.getSourceManager()),
|
||||
m_Ctx(Ctx), m_SkipFlag(false), m_IgnoreFile(ignoreFiles) {
|
||||
m_PrintInstantiation = false;
|
||||
m_Policy.SuppressTagKeyword = true;
|
||||
|
||||
|
@ -96,6 +96,7 @@ namespace cling {
|
||||
llvm::raw_ostream& m_Log;
|
||||
unsigned m_Indentation;
|
||||
bool m_PrintInstantiation;
|
||||
clang::Preprocessor& m_PP;
|
||||
clang::SourceManager& m_SMgr;
|
||||
clang::ASTContext& m_Ctx;
|
||||
bool m_SkipFlag;
|
||||
@ -109,7 +110,8 @@ namespace cling {
|
||||
public:
|
||||
ForwardDeclPrinter(llvm::raw_ostream& OutS,
|
||||
llvm::raw_ostream& LogS,
|
||||
clang::Sema& S,
|
||||
clang::Preprocessor& P,
|
||||
clang::ASTContext& Ctx,
|
||||
const Transaction& T,
|
||||
unsigned Indentation = 0,
|
||||
bool printMacros = false,
|
||||
|
@ -1267,11 +1267,13 @@ namespace cling {
|
||||
llvm::raw_fd_ostream log((outFile + ".skipped").str().c_str(),
|
||||
EC, llvm::sys::fs::OpenFlags::F_None);
|
||||
log << "Generated for :" << inFile << "\n";
|
||||
forwardDeclare(*T, fwdGen.getCI()->getSema(), out, enableMacros,
|
||||
forwardDeclare(*T, fwdGenPP, fwdGen.getCI()->getSema().getASTContext(),
|
||||
out, enableMacros,
|
||||
&log);
|
||||
}
|
||||
|
||||
void Interpreter::forwardDeclare(Transaction& T, Sema& S,
|
||||
void Interpreter::forwardDeclare(Transaction& T, Preprocessor& P,
|
||||
clang::ASTContext& Ctx,
|
||||
llvm::raw_ostream& out,
|
||||
bool enableMacros /*=false*/,
|
||||
llvm::raw_ostream* logs /*=0*/,
|
||||
@ -1280,7 +1282,7 @@ namespace cling {
|
||||
if (!logs)
|
||||
logs = &null;
|
||||
|
||||
ForwardDeclPrinter visitor(out, *logs, S, T, 0, false, ignoreFiles);
|
||||
ForwardDeclPrinter visitor(out, *logs, P, Ctx, T, 0, false, ignoreFiles);
|
||||
visitor.printStats();
|
||||
|
||||
// Avoid assertion in the ~IncrementalParser.
|
||||
|
Loading…
x
Reference in New Issue
Block a user