================ @@ -3596,6 +3596,16 @@ bool FunctionDecl::isNoReturn() const { return false; } +std::optional<bool> FunctionDecl::getAnalyzerNoReturn() const { + if (isNoReturn()) + return true; + + if (auto *Attr = getAttr<AnalyzerNoReturnAttr>()) + return Attr->getValue(); + + return std::nullopt; ---------------- negativ wrote:
We cannot use ` || hasAttr<AnalyzerNoReturnAttr>()` to return `true` here because these declarations are different: ```cpp // getAnalyzerNoReturn() => std::nullopt as we don't have explicit value of `analyzer_noreturn` attr void foo(); ``` ```cpp // getAnalyzerNoReturn() => `false`, this function 100% returns control back to caller void foo() __attribute__((analyzer_noreturn(false))); ``` ```cpp // getAnalyzerNoReturn() => `true`, this function is no-return void foo() __attribute__((analyzer_noreturn(true))); ``` https://github.com/llvm/llvm-project/pull/146355 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits