[clang][Interp][NFC] Small State.cpp refactoring
authorTimm Bäder <tbaeder@redhat.com>
Wed, 19 Apr 2023 06:10:13 +0000 (08:10 +0200)
committerTimm Bäder <tbaeder@redhat.com>
Wed, 19 Apr 2023 06:13:16 +0000 (08:13 +0200)
clang/lib/AST/Interp/State.cpp

index f0eed85..2512979 100644 (file)
@@ -142,12 +142,12 @@ void State::addCallStack(unsigned Limit) {
 
     // Use a different note for an inheriting constructor, because from the
     // user's perspective it's not really a function at all.
-    if (auto *CD = dyn_cast_if_present<CXXConstructorDecl>(F->getCallee())) {
-      if (CD->isInheritingConstructor()) {
-        addDiag(CallLocation, diag::note_constexpr_inherited_ctor_call_here)
-            << CD->getParent();
-        continue;
-      }
+    if (const auto *CD =
+            dyn_cast_if_present<CXXConstructorDecl>(F->getCallee());
+        CD && CD->isInheritingConstructor()) {
+      addDiag(CallLocation, diag::note_constexpr_inherited_ctor_call_here)
+          << CD->getParent();
+      continue;
     }
 
     SmallString<128> Buffer;