Prevent printing non-fixed enums Remove skipping of system headers Also, do not print default template arguments if they do not have a name.
This commit is contained in:
parent
a2a924a263
commit
03e5ef7668
@ -615,9 +615,8 @@ namespace cling {
|
||||
void AddAtExitFunc(void (*Func) (void*), void* Arg);
|
||||
|
||||
|
||||
void GenerateAutoloadingMap(llvm::StringRef inFile,llvm::StringRef outFile,
|
||||
bool enableMacros = false,
|
||||
bool skipSystem = true);
|
||||
void GenerateAutoloadingMap(llvm::StringRef inFile, llvm::StringRef outFile,
|
||||
bool enableMacros = false);
|
||||
void SetAutoloadCallback();
|
||||
// FIXME: workaround for double deletion problem
|
||||
|
||||
|
@ -99,6 +99,7 @@ namespace cling {
|
||||
|
||||
AutoloadCallback::AutoloadCallback(Interpreter* interp) :
|
||||
InterpreterCallbacks(interp,true,false,true), m_Interpreter(interp){
|
||||
|
||||
}
|
||||
AutoloadCallback::~AutoloadCallback() {
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ namespace cling {
|
||||
}
|
||||
|
||||
void ForwardDeclPrinter::VisitEnumDecl(EnumDecl *D) {
|
||||
if (D->getName().size() == 0) {
|
||||
if (D->getName().size() == 0 || !D->isFixed()) {
|
||||
m_SkipFlag = true;
|
||||
return;
|
||||
}
|
||||
@ -571,6 +571,7 @@ namespace cling {
|
||||
//So, we ignore restrict here
|
||||
T.removeLocalRestrict();
|
||||
T.print(Out, Policy, D->getName());
|
||||
// llvm::outs()<<D->getName()<<"\n";
|
||||
T.addRestrict();
|
||||
|
||||
Expr *Init = D->getInit();
|
||||
@ -743,6 +744,7 @@ namespace cling {
|
||||
if (const TemplateTypeParmDecl *TTP =
|
||||
dyn_cast<TemplateTypeParmDecl>(Param)) {
|
||||
|
||||
|
||||
if (TTP->wasDeclaredWithTypename())
|
||||
Out << "typename ";
|
||||
else
|
||||
@ -756,7 +758,7 @@ namespace cling {
|
||||
if (Args) {
|
||||
Out << " = ";
|
||||
Args->get(i).print(Policy, Out);
|
||||
} else if (TTP->hasDefaultArgument()) {
|
||||
} else if (TTP->hasDefaultArgument() && TTP->getName().size() != 0) {
|
||||
Out << " = ";
|
||||
Out << TTP->getDefaultArgument().getAsString(Policy);
|
||||
};
|
||||
|
@ -1192,23 +1192,7 @@ namespace cling {
|
||||
|
||||
void Interpreter::GenerateAutoloadingMap(llvm::StringRef inFile,
|
||||
llvm::StringRef outFile,
|
||||
bool enableMacros,
|
||||
bool skipSystem) {
|
||||
|
||||
llvm::SmallVector<std::string,30> withSys;
|
||||
GetIncludePaths(withSys,true,false);
|
||||
|
||||
llvm::SmallVector<std::string,30> withoutSys;
|
||||
GetIncludePaths(withoutSys,false,false);
|
||||
|
||||
std::sort(withSys.begin(),withSys.end());
|
||||
std::sort(withoutSys.begin(),withoutSys.end());
|
||||
|
||||
std::vector<std::string> incpaths(withSys.size());
|
||||
if(skipSystem)
|
||||
std::set_difference(withSys.begin(),withSys.end(),
|
||||
withoutSys.begin(),withoutSys.end(),
|
||||
incpaths.begin());
|
||||
bool enableMacros) {
|
||||
|
||||
CompilationOptions CO;
|
||||
CO.DeclarationExtraction = 0;
|
||||
@ -1256,23 +1240,6 @@ namespace cling {
|
||||
for(auto dit = dci.m_DGR.begin(); dit != dci.m_DGR.end(); ++dit) {
|
||||
clang::Decl* decl = *dit;
|
||||
|
||||
if(skipSystem) {
|
||||
bool skip = false;
|
||||
auto filename = getSema().getSourceManager().getFilename
|
||||
(decl->getSourceRange().getBegin());
|
||||
auto path = llvm::sys::path::parent_path(filename);
|
||||
for (auto p : incpaths) {
|
||||
if (llvm::sys::fs::equivalent(p,path)
|
||||
|| llvm::sys::fs::equivalent
|
||||
(p,llvm::sys::path::parent_path(path))) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (skip)
|
||||
continue;
|
||||
}
|
||||
|
||||
visitor.Visit(decl);
|
||||
visitor.printSemiColon();
|
||||
}
|
||||
@ -1283,7 +1250,9 @@ namespace cling {
|
||||
out << "#undef " << m << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
T->setState(Transaction::kCommitted);
|
||||
unload(1);
|
||||
return;
|
||||
}
|
||||
void Interpreter::SetAutoloadCallback() {
|
||||
|
@ -1,21 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// CLING - the C++ LLVM-based InterpreterG :)
|
||||
//
|
||||
// This file is dual-licensed: you can choose to license it under the University
|
||||
// of Illinois Open Source License or the GNU Lesser General Public License. See
|
||||
// LICENSE.TXT for details.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// RUN: cat %s | %cling -I %S -Xclang -verify
|
||||
// Test EnumTest
|
||||
//XFAIL: *
|
||||
|
||||
#include "cling/Interpreter/Interpreter.h"
|
||||
gCling->GenerateAutoloadingMap("Enum.h","test.h");
|
||||
.undo 1
|
||||
#include "test.h"
|
||||
#include "Enum.h"
|
||||
|
||||
//expected-no-diagnostics
|
||||
|
||||
.q
|
Loading…
x
Reference in New Issue
Block a user