Skip to content

Commit

Permalink
[clang][bytecode] Fix __extension__ handling for vector operators (l…
Browse files Browse the repository at this point in the history
…lvm#118482)

Don't reject them, but delegate to the subexpression.
  • Loading branch information
tbaederr authored Dec 3, 2024
1 parent e1cb316 commit 7802fb5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/lib/AST/ByteCode/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5914,6 +5914,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);
Expand Down
1 change: 1 addition & 0 deletions clang/test/AST/ByteCode/vectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7802fb5

Please sign in to comment.