[clang] 1c8c5a8 - [clang][Interp][NFC] Merge two if statements

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 4 07:17:03 PDT 2023


Author: Timm Bäder
Date: 2023-07-04T16:16:17+02:00
New Revision: 1c8c5a89c59cee16d6500a4e83c8c29b8a4a37a4

URL: https://github.com/llvm/llvm-project/commit/1c8c5a89c59cee16d6500a4e83c8c29b8a4a37a4
DIFF: https://github.com/llvm/llvm-project/commit/1c8c5a89c59cee16d6500a4e83c8c29b8a4a37a4.diff

LOG: [clang][Interp][NFC] Merge two if statements

Added: 
    

Modified: 
    clang/lib/AST/Interp/Interp.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Interp.cpp b/clang/lib/AST/Interp/Interp.cpp
index f646e876554cad..d68accdf3bf850 100644
--- a/clang/lib/AST/Interp/Interp.cpp
+++ b/clang/lib/AST/Interp/Interp.cpp
@@ -296,12 +296,10 @@ bool CheckInit(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
 
 bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
 
-  if (F->isVirtual()) {
-    if (!S.getLangOpts().CPlusPlus20) {
-      const SourceLocation &Loc = S.Current->getLocation(OpPC);
-      S.CCEDiag(Loc, diag::note_constexpr_virtual_call);
-      return false;
-    }
+  if (F->isVirtual() && !S.getLangOpts().CPlusPlus20) {
+    const SourceLocation &Loc = S.Current->getLocation(OpPC);
+    S.CCEDiag(Loc, diag::note_constexpr_virtual_call);
+    return false;
   }
 
   if (!F->isConstexpr()) {


        


More information about the cfe-commits mailing list