aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorAaron Puchert <aaronpuchert@alice-dsl.net>2020-10-28 23:23:09 +0100
committerAaron Puchert <aaronpuchert@alice-dsl.net>2020-10-28 23:32:57 +0100
commit5dbccc6c89c0f6c6dc6277cc304057f6d50b298d (patch)
tree228794223f34ce102f4c6b8dc9258f1b01bcca04 /clang/lib/Parse/ParseDecl.cpp
parent51f8d46491c7efd4e2054b036c13ef6266fceab3 (diff)
downloadllvm-5dbccc6c89c0f6c6dc6277cc304057f6d50b298d.zip
llvm-5dbccc6c89c0f6c6dc6277cc304057f6d50b298d.tar.gz
llvm-5dbccc6c89c0f6c6dc6277cc304057f6d50b298d.tar.bz2
Better source location for -Wignored-qualifiers on trailing return types
We collect the source location of a trailing return type in the parser, improving the location for regular functions and providing a location for lambdas, where previously there was none. Fixes PR47732. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D90129
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 01a1657..281cd6d 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -6429,6 +6429,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D,
CachedTokens *ExceptionSpecTokens = nullptr;
ParsedAttributesWithRange FnAttrs(AttrFactory);
TypeResult TrailingReturnType;
+ SourceLocation TrailingReturnTypeLoc;
/* LocalEndLoc is the end location for the local FunctionTypeLoc.
EndLoc is the end location for the function declarator.
@@ -6539,6 +6540,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D,
SourceRange Range;
TrailingReturnType =
ParseTrailingReturnType(Range, D.mayBeFollowedByCXXDirectInit());
+ TrailingReturnTypeLoc = Range.getBegin();
EndLoc = Range.getEnd();
}
} else if (standardAttributesAllowed()) {
@@ -6571,7 +6573,8 @@ void Parser::ParseFunctionDeclarator(Declarator &D,
DynamicExceptionRanges.data(), DynamicExceptions.size(),
NoexceptExpr.isUsable() ? NoexceptExpr.get() : nullptr,
ExceptionSpecTokens, DeclsInPrototype, StartLoc,
- LocalEndLoc, D, TrailingReturnType, &DS),
+ LocalEndLoc, D, TrailingReturnType, TrailingReturnTypeLoc,
+ &DS),
std::move(FnAttrs), EndLoc);
}