DynLookup: annotate the wrapper instead of visiting it.
This commit is contained in:
parent
1b81e23313
commit
a8608d0a67
@ -845,53 +845,12 @@ namespace cling {
|
||||
|
||||
// end EvalBuilder
|
||||
|
||||
// Helpers
|
||||
|
||||
|
||||
// Class extracting recursively every decl defined somewhere.
|
||||
class DeclVisitor : public RecursiveASTVisitor<DeclVisitor> {
|
||||
private:
|
||||
bool m_ShouldVisitSubTree;
|
||||
public:
|
||||
DeclVisitor() : m_ShouldVisitSubTree(false) {}
|
||||
|
||||
bool getShouldVisitSubTree() const { return m_ShouldVisitSubTree; }
|
||||
|
||||
bool isCandidate(Decl* D) {
|
||||
// FIXME: Here we should have our custom attribute.
|
||||
if (AnnotateAttr* A = D->getAttr<AnnotateAttr>())
|
||||
if (A->getAnnotation().equals("__ResolveAtRuntime"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VisitDeclStmt(DeclStmt* DS) {
|
||||
DeclGroupRef DGR = DS->getDeclGroup();
|
||||
for (DeclGroupRef::const_iterator I = DGR.begin(),
|
||||
E = DGR.end(); I != E; ++I) {
|
||||
if (isCandidate(*I)) {
|
||||
m_ShouldVisitSubTree = true;
|
||||
return false; // returning false will abort the in-depth traversal.
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// In cases when there is no decl stmt, like dep->Call();
|
||||
bool VisitDeclRefExpr(DeclRefExpr* DRE) {
|
||||
if (isCandidate(DRE->getDecl())) {
|
||||
m_ShouldVisitSubTree = true;
|
||||
return false; // returning false will abort the in-depth traversal.
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
bool EvaluateTSynthesizer::ShouldVisit(Decl* D) {
|
||||
DeclVisitor Visitor;
|
||||
Visitor.TraverseStmt(D->getBody());
|
||||
return Visitor.getShouldVisitSubTree();
|
||||
bool EvaluateTSynthesizer::ShouldVisit(FunctionDecl* D) {
|
||||
// FIXME: Here we should have our custom attribute.
|
||||
if (AnnotateAttr* A = D->getAttr<AnnotateAttr>())
|
||||
if (A->getAnnotation().equals("__ResolveAtRuntime"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EvaluateTSynthesizer::IsArtificiallyDependent(Expr* Node) {
|
||||
|
@ -273,12 +273,9 @@ namespace cling {
|
||||
///
|
||||
bool IsArtificiallyDependent(clang::Expr* Node);
|
||||
|
||||
///\brief Checks if the given declaration should be examined. It checks
|
||||
/// whether a declaration context marked as dependent contains the
|
||||
/// declaration or the declaration type is not one of those we are looking
|
||||
/// for.
|
||||
///\brief Checks if the function might contain dynamically scoped Decls.
|
||||
///
|
||||
bool ShouldVisit(clang::Decl* D);
|
||||
bool ShouldVisit(clang::FunctionDecl* D);
|
||||
|
||||
/// \brief Gets all children of a given node.
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user