[clang] [LifetimeSafety] Support C Language in LifetimeSafety (PR #203270)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 12 07:00:13 PDT 2026
================
@@ -347,6 +351,13 @@ void FactsGenerator::VisitUnaryOperator(const UnaryOperator *UO) {
switch (UO->getOpcode()) {
case UO_AddrOf: {
const Expr *SubExpr = UO->getSubExpr();
+ // Function addresses do not need lifetime tracking.
+ if (SubExpr->getType()->isFunctionType())
+ return;
+ // Skip address-of on void expressions: GNU C permits them, but void itself
+ // has no origins to track.
+ if (IsCMode && SubExpr->getType()->isVoidType())
----------------
NeKon69 wrote:
I don't think this will ever be reached in C++. If we want to do something in similar for C++, it should be an assert instead.
https://github.com/llvm/llvm-project/pull/203270
More information about the cfe-commits
mailing list