Skip to content

Commit b6f0130

Browse files
author
v01dxyz
committed
FunctionDecl::getFunctionTypeLoc: ignore function type attributes
1 parent eb3f1ae commit b6f0130

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

clang/lib/AST/Decl.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3876,8 +3876,17 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
38763876

38773877
FunctionTypeLoc FunctionDecl::getFunctionTypeLoc() const {
38783878
const TypeSourceInfo *TSI = getTypeSourceInfo();
3879-
return TSI ? TSI->getTypeLoc().IgnoreParens().getAs<FunctionTypeLoc>()
3880-
: FunctionTypeLoc();
3879+
3880+
if (!TSI)
3881+
return FunctionTypeLoc();
3882+
3883+
TypeLoc TL = TSI->getTypeLoc().IgnoreParens();
3884+
3885+
// ignore function type attributes
3886+
while (auto ATL = TL.getAs<AttributedTypeLoc>())
3887+
TL = ATL.getModifiedLoc();
3888+
3889+
return TL.getAs<FunctionTypeLoc>();
38813890
}
38823891

38833892
SourceRange FunctionDecl::getReturnTypeSourceRange() const {

0 commit comments

Comments
 (0)