[cfe-dev] FunctionProtoType is changed during include expansion
Gábor Márton via cfe-dev
cfe-dev at lists.llvm.org
Mon Dec 2 09:27:01 PST 2019
I am puzzling with the following phenomenon:
When I compile a source file normally (i.e. -c) then a given lambda's
signature is `operator() 'int_type (long) const'` where int_type is a
TypeAlias. I.e. the return type is a TypedefType.
Now, when I compile the same source file with -E, then the signature is
changed to the canonical type: `operator() 'long (long) const'`. I.e. the
return type is no longer a TypedefType.
This happens also when I use `-E -frewrite-includes`.
Do you guys have any insights on this? What happens during include
expansion so that the parser changes some internal state?
Why this is a problem to me? Because I can't write tests that are
self-contained, the problematic AST with the TypedefType return type comes
up only when we include some files.
For your interest, if you want to reproduce it, you can do that on
1) Enable libcxx, libcxxabi
2) ninja cxx
3) ninja -v
- grab the output and attach -E (and -frewrite-includes)
4) ./bin/clang-check -p . libcxx/src/filesystem/directory_iterator.cpp
-ast-dump -ast-dump-filter "posix_utimes" | ag "CXXMethodDecl.*int_type"
- gives -CXXMethodDecl 0x3007ec0 <col:30, line:400:3> line:396:18 used
operator() 'int_type (long) const' inline
5) ./bin/clang -x c++ directory_iterator.cpp.E -fsyntax-only -Xclang
-ast-dump -Xclang -ast-dump-filter -Xclang posix_utimes | ag
6) -CXXMethodDecl 0x31c6ad0 <col:30, line:400:3> line:396:18 used
operator() 'long (long) const' inline
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev