[clang] 1d0e8b2 - [clang][Interp] Remove a no longer needed dummy check

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Thu May 23 04:11:19 PDT 2024


Author: Timm Bäder
Date: 2024-05-23T13:10:58+02:00
New Revision: 1d0e8b24001d854a848a3810b90244a6bc94cf03

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

LOG: [clang][Interp] Remove a no longer needed dummy check

Since we now have type info for dummy pointers, we don't need this
check anymore and can also have the same output for the test case
in records.cpp.

Added: 
    

Modified: 
    clang/lib/AST/Interp/Interp.h
    clang/test/AST/Interp/records.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index 8430a7de24dff..fc496b66445aa 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -1371,9 +1371,6 @@ inline bool GetPtrVirtBasePop(InterpState &S, CodePtr OpPC,
   const Pointer &Ptr = S.Stk.pop<Pointer>();
   if (!CheckNull(S, OpPC, Ptr, CSK_Base))
     return false;
-  if (Ptr.isDummy()) // FIXME: Once we have type info for dummy pointers, this
-                     // needs to go.
-    return false;
   return VirtBaseHelper(S, OpPC, D, Ptr);
 }
 

diff  --git a/clang/test/AST/Interp/records.cpp b/clang/test/AST/Interp/records.cpp
index 3a5ecd291a568..97ac3e9169555 100644
--- a/clang/test/AST/Interp/records.cpp
+++ b/clang/test/AST/Interp/records.cpp
@@ -1335,8 +1335,6 @@ namespace UnnamedBitFields {
   static_assert(a.c == 'a', "");
 }
 
-/// FIXME: This still doesn't work in the new interpreter because
-/// we lack type information for dummy pointers.
 namespace VirtualBases {
   /// This used to crash.
   namespace One {
@@ -1346,7 +1344,7 @@ namespace VirtualBases {
     };
     class B : public virtual A {
     public:
-      int getX() { return x; } // ref-note {{declared here}}
+      int getX() { return x; } // both-note {{declared here}}
     };
 
     class DV : virtual public B{};
@@ -1354,7 +1352,7 @@ namespace VirtualBases {
     void foo() {
       DV b;
       int a[b.getX()]; // both-warning {{variable length arrays}} \
-                       // ref-note {{non-constexpr function 'getX' cannot be used}}
+                       // both-note {{non-constexpr function 'getX' cannot be used}}
     }
   }
 


        


More information about the cfe-commits mailing list