<div dir="ltr"><div dir="ltr">This is a catch 22, because to get a smaller reproducer I should be able to work on the preprocessed file (only that's what works considerably well with creduce).</div><div>However, the AST piece in question is about this source code:</div><div><br></div> auto Convert = [](long nsec) {<br> using int_type = decltype(std::declval< ::timeval>().tv_usec);<br> auto dur = duration_cast<microseconds>(nanoseconds(nsec)).count();<br> return static_cast<int_type>(dur);<br> };<br><div> </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 2, 2019 at 6:57 PM David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">perhaps a smaller reproducer would be useful for this discussion? (so we could see the specific code, rather than a description of it or the entire libc++ test, etc)</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 2, 2019 at 12:27 PM Gábor Márton via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I am puzzling with the following phenomenon:</div><div>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.</div><div>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.</div><div>This happens also when I use `-E -frewrite-includes`.</div><div><br></div><div>Do you guys have any insights on this? What happens during include expansion so that the parser changes some internal state?</div><div><br></div><div>Thanks,</div><div>Gabor</div><div><br></div><div>...</div><div><br></div><div>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.</div><div><br></div><div>For your interest, if you want to reproduce it, you can do that on llvm-project/master:</div><div>1) Enable libcxx, libcxxabi</div><div>2) ninja cxx</div><div>3) ninja -v projects/libcxx/src/CMakeFiles/cxx_static.dir/filesystem/directory_iterator.cpp.o</div><div> - grab the output and attach -E (and -frewrite-includes)</div><div>4) ./bin/clang-check -p . libcxx/src/filesystem/directory_iterator.cpp -ast-dump -ast-dump-filter "posix_utimes" | ag "CXXMethodDecl.*int_type"</div><div> - gives -CXXMethodDecl 0x3007ec0 <col:30, line:400:3> line:396:18 used operator() 'int_type (long) const' inline</div><div>5) ./bin/clang -x c++ directory_iterator.cpp.E -fsyntax-only -Xclang -ast-dump -Xclang -ast-dump-filter -Xclang posix_utimes | ag "CXXMethodDecl.*operator"</div><div>6) -CXXMethodDecl 0x31c6ad0 <col:30, line:400:3> line:396:18 used operator() 'long (long) const' inline</div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>
</blockquote></div></div>