[cfe-dev] "should not see dependent types here" in AST traversal

Stephen Kelly via cfe-dev cfe-dev at lists.llvm.org
Sun Nov 25 06:56:46 PST 2018


On 23/11/2018 16:34, Julian Mueller via cfe-dev wrote:> Hi.
 > I am programming a clang tool, that traverses the ASTs for multiple
 > files generating info on memberusages.
 > Naturally when parsing an AST the visitors traverse through each
 > included h/hpp file even if it is not a user made file but something
 > like glfw.
 > Since eventually I want to make sourcefile transformations, I want to
 > exclude those kinds of files.
 > Therefore I use an AST matcher /file_match/:
 >
 > isExpansionInFileMatching("foo.c|bar.c|include/*")


Surely most of the headers used in your translation units are in 
directories matching "include/*" (even vector etc is in 
/usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_bvector.h). 


I suggest using a different pattern, such as the name of the root 
directory of your project.

Also, you might be able to use the --header-filter command line 
parameter of clang-tidy to include only particular files.


 > I also get an error message:
 >
 > .../llvm/tools/clang/include/clang/AST/TypeNodes.def:87: clang::TypeInfo
 > clang::ASTContext::getTypeInfoImpl(const clang::Type*) const: Assertion
 > `!T->isDependentType() && "should not see dependent types here"'
 >
 > TypeNodes.def:87:
 > NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TypeOfExpr, Type)


I suggest creating an http://sscce.org/ for this.

Thanks,

Stephen.




More information about the cfe-dev mailing list