[clang] 56b63e0 - [clang][Interp] Get <=> value info from weak result

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 26 00:52:54 PST 2024


Author: Timm Bäder
Date: 2024-02-26T09:52:38+01:00
New Revision: 56b63e0886ba369a53df5e1d429cde2e4a2d4a34

URL: https://github.com/llvm/llvm-project/commit/56b63e0886ba369a53df5e1d429cde2e4a2d4a34
DIFF: https://github.com/llvm/llvm-project/commit/56b63e0886ba369a53df5e1d429cde2e4a2d4a34.diff

LOG: [clang][Interp] Get <=> value info from weak result

This is also what the current interpreter does and a couple of
test cases expect that.

Added: 
    

Modified: 
    clang/lib/AST/Interp/Interp.h
    clang/test/SemaCXX/compare-modules-cxx2a.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index 7994550cc7b97e..aecad1598ad2b1 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -808,7 +808,8 @@ bool CMP3(InterpState &S, CodePtr OpPC, const ComparisonCategoryInfo *CmpInfo) {
   }
 
   assert(CmpInfo);
-  const auto *CmpValueInfo = CmpInfo->getValueInfo(CmpResult);
+  const auto *CmpValueInfo =
+      CmpInfo->getValueInfo(CmpInfo->makeWeakResult(CmpResult));
   assert(CmpValueInfo);
   assert(CmpValueInfo->hasValidIntValue());
   const APSInt &IntValue = CmpValueInfo->getIntValue();

diff  --git a/clang/test/SemaCXX/compare-modules-cxx2a.cpp b/clang/test/SemaCXX/compare-modules-cxx2a.cpp
index 470464427efd9c..19093b89f60cf7 100644
--- a/clang/test/SemaCXX/compare-modules-cxx2a.cpp
+++ b/clang/test/SemaCXX/compare-modules-cxx2a.cpp
@@ -2,6 +2,7 @@
 // RUN: mkdir -p %t
 
 // RUN: %clang_cc1 -triple x86_64-apple-darwin -fcxx-exceptions -verify -std=c++2a -fmodules -fmodules-cache-path=%t.mcp -I%S/Inputs %s -fno-modules-error-recovery -fmodule-map-file=%S/Inputs/compare.modulemap
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -fcxx-exceptions -verify -std=c++2a -fmodules -fmodules-cache-path=%t.mcp -I%S/Inputs %s -fno-modules-error-recovery -fmodule-map-file=%S/Inputs/compare.modulemap -fexperimental-new-constant-interpreter
 
 struct CC { CC(...); };
 


        


More information about the cfe-commits mailing list