[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 30 12:43:42 PDT 2025
================
@@ -4820,6 +4820,15 @@ bool CodeGenFunction::isUnderlyingBasePointerConstantNull(const Expr *E) {
const Expr *UnderlyingBaseExpr = E->IgnoreParens();
while (auto *BaseMemberExpr = dyn_cast<MemberExpr>(UnderlyingBaseExpr))
UnderlyingBaseExpr = BaseMemberExpr->getBase()->IgnoreParens();
+ // Workaround for old glibc's __PTR_ALIGN macro
+ // If the condition can be constant evaluated, we check the selected arm.
+ if (auto *Select = dyn_cast<ConditionalOperator>(UnderlyingBaseExpr)) {
+ if (auto *C = dyn_cast_if_present<llvm::Constant>(
----------------
efriedma-quic wrote:
EvaluateAsBooleanCondition, to ensure this is based on the AST. (tryEmitAbstract on a boolean is mostly the same thing these days, but not quite.)
https://github.com/llvm/llvm-project/pull/137851
More information about the cfe-commits
mailing list