[PATCH] D70819: [ASTImporter] Support functions with placeholder return types ...

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 7 05:04:33 PST 2019


martong added a reviewer: teemperor.
martong marked an inline comment as done.
martong added inline comments.


================
Comment at: clang/unittests/AST/ASTImporterTest.cpp:5625
+  // parsed libcxx/src/filesystem/directory_iterator.cpp, but could not reduce
+  // that with creduce, because after preprocessing, the AST no longer
+  // contained the TypeAlias as a return type of the lambda.
----------------
martong wrote:
> a_sidorin wrote:
> > That's interesting. Have you tried '-frewrite-includes' for expanding inclusions only without macro expansion?
> I hadn't tried it before, but I've just done that now. Unfortunately, the AST produced with `-E -frewrite-includes` produces a type for the operator() that already has a canonical type: `long (long) const`
> 
> ```
> ) ./bin/clang-check -p cxx_cmd_json ~w/llvm3/git/llvm-project/libcxx/src/filesystem/directory_iterator.cpp -ast-dump -ast-dump-filter "posix_utimes" | ag "CXXMethodDecl.*int_type"                                           --- COMMAND ---
>   |           | |-CXXMethodDecl 0x3007ec0 <col:30, line:400:3> line:396:18 used operator() 'int_type (long) const' inline
>   |           | |-CXXMethodDecl 0x30131f0 <col:18, line:400:3> line:396:18 implicit __invoke 'int_type (long)' static inline
>   |           | |-CXXMethodDecl 0x2ddfaf0 <col:30, line:400:3> line:396:18 used operator() 'int_type (long) const' inline
>   |           | |-CXXMethodDecl 0x2deae20 <col:18, line:400:3> line:396:18 implicit __invoke 'int_type (long)' static inline
> (venv) egbomrt at elx78373d5s|~/WORK/llvm3/build/release_assert
> ) ./bin/clang-check -p cxx_cmd_json ~w/llvm3/git/llvm-project/libcxx/src/filesystem/directory_iterator.cpp -ast-dump -ast-dump-filter "posix_utimes" | ag "CXXMethodDecl.*operator"
>   |           | |-CXXMethodDecl 0x2833020 <col:30, line:400:3> line:396:18 used operator() 'int_type (long) const' inline
>   |           | |-CXXMethodDecl 0x287fa20 <col:30, line:400:3> line:396:18 used operator() 'int_type (long) const' inline
> (venv) egbomrt at elx78373d5s|~/WORK/llvm3/build/release_assert
> ) ./bin/clang -x c++ directory_iterator.cpp.E.orig -fsyntax-only -Xclang -ast-dump -Xclang -ast-dump-filter -Xclang posix_utimes | ag "CXXMethodDecl.*operator"
>   |           | |-CXXMethodDecl 0x31c6ad0 <col:30, line:400:3> line:396:18 used operator() 'long (long) const' inline
> (venv) egbomrt at elx78373d5s|~/WORK/llvm3/build/release_assert
> ) ./bin/clang -x c++ directory_iterator.cpp.E.ri -fsyntax-only -Xclang -ast-dump -Xclang -ast-dump-filter -Xclang posix_utimes | ag "CXXMethodDecl.*operator"
>   |           | |-CXXMethodDecl 0x25ad7f0 <col:30, line:400:3> line:396:18 used operator() 'long (long) const' inline
> ```
So, this means that the type information is transformed during the include expansion. That is very strange.
I think, I'll have an email to cfe-dev, maybe others have some insights on this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70819/new/

https://reviews.llvm.org/D70819





More information about the cfe-commits mailing list