[PATCH] D55039: [sema] Warn of mangling change if function parameters are noexcept.

Nicolas Lesser via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 3 23:56:03 PST 2018


Rakete1111 added inline comments.


================
Comment at: lib/Sema/SemaDecl.cpp:9933
+        llvm::any_of(FPT->param_types(),
+                     [](QualType Q) { return hasNoexcept(Q); }))
+      return true;
----------------
You don't need this lambda.


================
Comment at: lib/Sema/SemaDecl.cpp:10266
       auto *FPT = NewFD->getType()->castAs<FunctionProtoType>();
-      bool AnyNoexcept = HasNoexcept(FPT->getReturnType());
-      for (QualType T : FPT->param_types())
-        AnyNoexcept |= HasNoexcept(T);
-      if (AnyNoexcept)
+      if (hasNoexcept(FPT->getReturnType()) ||
+          llvm::any_of(FPT->param_types(),
----------------
What you're doing here is a subset of what `hasNoexcept` is doing for function types. Do you think it would make sense to use `!FPT->isNothrow() && hasNoexcept(NewFW->getType())` or something like that?


================
Comment at: lib/Sema/SemaDecl.cpp:10268
+          llvm::any_of(FPT->param_types(),
+                       [](QualType Q) { return hasNoexcept(Q); })) {
         Diag(NewFD->getLocation(),
----------------
Same, that lambda is unnecessary.


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

https://reviews.llvm.org/D55039





More information about the cfe-commits mailing list