[clang] [clang-tools-extra] FunctionDecl::getFunctionTypeLoc: ignore function type attributes (PR #118420)

Robert Dazi via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 12 11:51:49 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
----------------
v01dXYZ wrote:

I don't know. But to implement it in its updated form, I mimicked `getAsAdjusted`. So currently, it supports `ParenType` and `AttributedType`. I think I should add `MacroQualifiedType` for example.

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


More information about the cfe-commits mailing list