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

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 12 08:14:22 PST 2019


martong marked 2 inline comments as done.
martong added a comment.

In D70819#1781678 <https://reviews.llvm.org/D70819#1781678>, @martong wrote:

> In D70819#1777770 <https://reviews.llvm.org/D70819#1777770>, @shafik wrote:
>
> > Apologies for wacky C++ code that follows but will this also work for the following cases:
> >
> >   auto f2() { 
> >     auto l = []() {
> >         struct X{};
> >         return X();
> >     };
> >    return l(); 
> >    }
> >  
> >    auto f3() { 
> >     if ( struct X{} x; true) 
> >         return X();
> >     else return X();    
> >    }
> >  
> >    auto f4() {
> >       for(struct X{} x;;)
> >          return X();
> >    }
> >  
> >    auto f5() {
> >       switch(struct X{} x; 10) {
> >         case 10:
> >          return X();
> >       }
> >    }
> >
> >
> > godbolt live example <https://godbolt.org/z/_SXcje>
>
>
> Thanks for these cases! I am going to write unit tests for these as well.


So I checked and wrote a test case for all of these. All of them passed!



================
Comment at: clang/lib/AST/ASTImporter.cpp:48
 #include "clang/Basic/Builtins.h"
+#include "clang/Basic/DiagnosticSema.h"
 #include "clang/Basic/ExceptionSpecificationType.h"
----------------
a_sidorin wrote:
> Do we use this new include?
Thanks for catching this! I used clangd this time and that added this include, I am not sure why, anyway I set up clangd to do not add includes.


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