[clang] [clang][AMDGPU] Fix -ast-print crash on expanded predicate builtins (PR #199963)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Wed May 27 09:09:02 PDT 2026
================
@@ -760,14 +760,21 @@ Expr *SemaAMDGPU::ExpandAMDGPUPredicateBuiltIn(Expr *E) {
CallExpr *CE = cast<CallExpr>(E->IgnoreParens());
ASTContext &Ctx = getASTContext();
QualType BoolTy = Ctx.getLogicalOperationType();
- llvm::APInt False = llvm::APInt::getZero(Ctx.getIntWidth(BoolTy));
- llvm::APInt True = llvm::APInt::getAllOnes(Ctx.getIntWidth(BoolTy));
SourceLocation Loc = CE->getExprLoc();
+ // A plain IntegerLiteral whose type is _Bool/bool is not a shape any other
+ // clang producer creates, and consumers (e.g. StmtPrinter) assume it cannot
+ // occur — see issue #199563.
+ auto MakePredicateLiteral = [&](bool Val) -> Expr * {
----------------
jhuber6 wrote:
Is this trying to solve the same problem as https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaExprObjC.cpp#L437? Can we do something similar? I'd assume this is just a C/C++ distinction.
https://github.com/llvm/llvm-project/pull/199963
More information about the cfe-commits
mailing list