[clang] FunctionDecl::getFunctionTypeLoc: ignore function type attributes (PR #118420)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 3 11:23:13 PST 2024
================
@@ -3876,8 +3876,17 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
FunctionTypeLoc FunctionDecl::getFunctionTypeLoc() const {
const TypeSourceInfo *TSI = getTypeSourceInfo();
- return TSI ? TSI->getTypeLoc().IgnoreParens().getAs<FunctionTypeLoc>()
- : FunctionTypeLoc();
+
+ if (!TSI)
+ return FunctionTypeLoc();
+
+ TypeLoc TL = TSI->getTypeLoc().IgnoreParens();
+
+ // ignore function type attributes
+ while (auto ATL = TL.getAs<AttributedTypeLoc>())
+ TL = ATL.getModifiedLoc();
----------------
erichkeane wrote:
I don't THINK we want this? We want to keep around the 'type' as modified by the attributed type (so if it is no_return, we want to make sure we have a noreturn function type for example). So I would think we would want the `Equivalent` type here?
https://github.com/llvm/llvm-project/pull/118420
More information about the cfe-commits
mailing list