Skip decls using names from defs like typedef struct {} structName
This commit is contained in:
parent
620fc072d0
commit
7b99ddcfa1
@ -791,14 +791,14 @@ namespace cling {
|
|||||||
|
|
||||||
void ForwardDeclPrinter::
|
void ForwardDeclPrinter::
|
||||||
VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl* D) {
|
VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl* D) {
|
||||||
const TemplateArgumentList& iargs = D->getTemplateInstantiationArgs();
|
|
||||||
|
|
||||||
if (llvm::isa<ClassTemplatePartialSpecializationDecl>(D)) {
|
if (shouldSkip(D)) {
|
||||||
skipCurrentDecl();
|
skipCurrentDecl();
|
||||||
//TODO: How to print partial specializations?
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TemplateArgumentList& iargs = D->getTemplateInstantiationArgs();
|
||||||
|
|
||||||
m_Out << "template <> ";
|
m_Out << "template <> ";
|
||||||
VisitCXXRecordDecl(D->getCanonicalDecl());
|
VisitCXXRecordDecl(D->getCanonicalDecl());
|
||||||
|
|
||||||
@ -826,8 +826,13 @@ namespace cling {
|
|||||||
|
|
||||||
bool ForwardDeclPrinter::isIncompatibleType(QualType q) {
|
bool ForwardDeclPrinter::isIncompatibleType(QualType q) {
|
||||||
//FIXME: This is a workaround and filters out many acceptable cases
|
//FIXME: This is a workaround and filters out many acceptable cases
|
||||||
|
if (q.getTypePtr()->isAnyPointerType())
|
||||||
|
q = q.getTypePtr()->getPointeeType();
|
||||||
|
q.removeLocalConst();
|
||||||
|
q.removeLocalRestrict();
|
||||||
|
q.removeLocalVolatile();
|
||||||
llvm::StringRef str = q.getAsString();
|
llvm::StringRef str = q.getAsString();
|
||||||
|
// llvm::outs() << "Q:"<<str<<"\n";
|
||||||
return m_IncompatibleTypes.find(str) != m_IncompatibleTypes.end()
|
return m_IncompatibleTypes.find(str) != m_IncompatibleTypes.end()
|
||||||
|| str.find("::") != llvm::StringRef::npos;
|
|| str.find("::") != llvm::StringRef::npos;
|
||||||
|
|
||||||
@ -867,9 +872,24 @@ namespace cling {
|
|||||||
m_IncompatibleTypes.insert(D->getName());
|
m_IncompatibleTypes.insert(D->getName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (isa<RecordType>(ET->getNamedType())) {
|
||||||
|
m_IncompatibleTypes.insert(D->getName());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (const TemplateSpecializationType* tst
|
||||||
|
= dyn_cast<TemplateSpecializationType>(D->getTypeSourceInfo()->getType().getTypePtr())){
|
||||||
|
for (uint i = 0; i < tst->getNumArgs(); ++i ) {
|
||||||
|
const TemplateArgument& arg = tst->getArg(i);
|
||||||
|
if (arg.getKind() == TemplateArgument::ArgKind::Type)
|
||||||
|
if (m_IncompatibleTypes.find(arg.getAsType().getAsString())!=m_IncompatibleTypes.end())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (isIncompatibleType(D->getTypeSourceInfo()->getType())) {
|
if (isIncompatibleType(D->getTypeSourceInfo()->getType())) {
|
||||||
|
m_IncompatibleTypes.insert(D->getName());
|
||||||
|
// llvm::outs() << "I: "<<D->getName()<<"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -889,6 +909,24 @@ namespace cling {
|
|||||||
}
|
}
|
||||||
m_TotalDecls++;
|
m_TotalDecls++;
|
||||||
}
|
}
|
||||||
|
bool ForwardDeclPrinter::shouldSkip(ClassTemplateSpecializationDecl *D) {
|
||||||
|
if (llvm::isa<ClassTemplatePartialSpecializationDecl>(D)) {
|
||||||
|
//TODO: How to print partial specializations?
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
const TemplateArgumentList& iargs = D->getTemplateInstantiationArgs();
|
||||||
|
for (uint i = 0; i < iargs.size(); ++i) {
|
||||||
|
const TemplateArgument& arg = iargs[i];
|
||||||
|
if (arg.getKind() == TemplateArgument::ArgKind::Type)
|
||||||
|
if (m_IncompatibleTypes.find(arg.getAsType().getAsString())!=m_IncompatibleTypes.end())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ForwardDeclPrinter::printStats() {
|
void ForwardDeclPrinter::printStats() {
|
||||||
llvm::outs() << m_SkipCounter << " decls skipped out of " << m_TotalDecls << "\n";
|
llvm::outs() << m_SkipCounter << " decls skipped out of " << m_TotalDecls << "\n";
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ namespace cling {
|
|||||||
bool shouldSkip(clang::TypedefDecl* D);
|
bool shouldSkip(clang::TypedefDecl* D);
|
||||||
bool shouldSkip(clang::VarDecl* D);
|
bool shouldSkip(clang::VarDecl* D);
|
||||||
bool shouldSkip(clang::EnumDecl* D);
|
bool shouldSkip(clang::EnumDecl* D);
|
||||||
bool shouldSkip(clang::ClassTemplateSpecializationDecl* D){return true;}
|
bool shouldSkip(clang::ClassTemplateSpecializationDecl* D);
|
||||||
bool shouldSkip(clang::UsingDecl* D){return true;}
|
bool shouldSkip(clang::UsingDecl* D){return true;}
|
||||||
bool shouldSkip(clang::UsingShadowDecl* D){return true;}
|
bool shouldSkip(clang::UsingShadowDecl* D){return true;}
|
||||||
|
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
|
|
||||||
// RUN: cat %s | %cling -I %S -Xclang -verify
|
// RUN: cat %s | %cling -I %S -Xclang -verify
|
||||||
// Test incompleteType
|
// Test incompleteType
|
||||||
//XFAIL: *
|
|
||||||
//Becasue functionality is disabled now
|
|
||||||
|
|
||||||
#include "cling/Interpreter/Interpreter.h"
|
#include "cling/Interpreter/Interpreter.h"
|
||||||
gCling->EnableAutoloading();
|
gCling->EnableAutoloading();
|
||||||
|
Loading…
Reference in New Issue
Block a user