https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/118482

Don't reject them, but delegate to the subexpression.

>From 7576bf72f204904c65add97cdd867c41e5a3fa48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com>
Date: Tue, 3 Dec 2024 13:44:14 +0100
Subject: [PATCH] [clang][bytecode] Fix `__extension__` handling for vector
 operators

Don't reject them, but delegate to the subexpression.
---
 clang/lib/AST/ByteCode/Compiler.cpp | 3 +++
 clang/test/AST/ByteCode/vectors.cpp | 1 +
 2 files changed, 4 insertions(+)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index a95353fd2943c9..f6e0b54a81e368 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -5911,6 +5911,9 @@ bool Compiler<Emitter>::VisitVectorUnaryOperator(const 
UnaryOperator *E) {
     return this->discard(SubExpr);
 
   auto UnaryOp = E->getOpcode();
+  if (UnaryOp == UO_Extension)
+    return this->delegate(SubExpr);
+
   if (UnaryOp != UO_Plus && UnaryOp != UO_Minus && UnaryOp != UO_LNot &&
       UnaryOp != UO_Not && UnaryOp != UO_AddrOf)
     return this->emitInvalid(E);
diff --git a/clang/test/AST/ByteCode/vectors.cpp 
b/clang/test/AST/ByteCode/vectors.cpp
index 08e2ca2adbf5cd..a04b678a623a1e 100644
--- a/clang/test/AST/ByteCode/vectors.cpp
+++ b/clang/test/AST/ByteCode/vectors.cpp
@@ -37,6 +37,7 @@ static_assert(arr4[1][0] == 0, "");
 static_assert(arr4[1][0] == 0, "");
 static_assert(arr4[1][0] == 0, "");
 
+constexpr VI4 B = __extension__(A);
 
 /// From constant-expression-cxx11.cpp
 namespace Vector {

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

Reply via email to