Author: Timm Bäder
Date: 2023-08-01T10:58:08+02:00
New Revision: b864592915aed568d81f8218cb5c424b0006c14b

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

LOG: [clang][Interp] Fix ignoring TypeTraitExprs

Differential Revision: https://reviews.llvm.org/D149834

Added: 
    

Modified: 
    clang/lib/AST/Interp/ByteCodeExprGen.cpp
    clang/test/AST/Interp/literals.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp 
b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 1508b0619a19ad..77fe0412d0dc5c 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -958,6 +958,8 @@ bool ByteCodeExprGen<Emitter>::VisitCompoundLiteralExpr(
 
 template <class Emitter>
 bool ByteCodeExprGen<Emitter>::VisitTypeTraitExpr(const TypeTraitExpr *E) {
+  if (DiscardResult)
+    return true;
   return this->emitConstBool(E->getValue(), E);
 }
 

diff  --git a/clang/test/AST/Interp/literals.cpp 
b/clang/test/AST/Interp/literals.cpp
index 9f31cd909e2938..7cb01a80c86859 100644
--- a/clang/test/AST/Interp/literals.cpp
+++ b/clang/test/AST/Interp/literals.cpp
@@ -895,6 +895,8 @@ namespace DiscardExprs {
     (void)5, (void)6;
 
     1 ? 0 : 1;
+    __is_trivial(int);
+
     return 0;
   }
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to