[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 29 12:47:14 PDT 2025


================
@@ -4820,6 +4820,9 @@ bool CodeGenFunction::isUnderlyingBasePointerConstantNull(const Expr *E) {
   const Expr *UnderlyingBaseExpr = E->IgnoreParens();
   while (auto *BaseMemberExpr = dyn_cast<MemberExpr>(UnderlyingBaseExpr))
     UnderlyingBaseExpr = BaseMemberExpr->getBase()->IgnoreParens();
+  if (auto *Select = dyn_cast<ConditionalOperator>(UnderlyingBaseExpr))
----------------
efriedma-quic wrote:

Name seems okay to me.

To more narrowly catch the glibc pattern, we could check if the condition is a constant true/false, and only check that expression.  But I guess just checking both sides might be good enough.

https://github.com/llvm/llvm-project/pull/137851


More information about the cfe-commits mailing list