aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/DeclSpec.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/Sema/DeclSpec.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/Sema/DeclSpec.cpp')
-rw-r--r--clang/lib/Sema/DeclSpec.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp
index dc37474..b139855 100644
--- a/clang/lib/Sema/DeclSpec.cpp
+++ b/clang/lib/Sema/DeclSpec.cpp
@@ -181,6 +181,8 @@ DeclaratorChunk DeclaratorChunk::getFunction(bool hasProto,
SourceLocation LocalRangeEnd,
Declarator &TheDeclarator,
TypeResult TrailingReturnType,
+ SourceLocation
+ TrailingReturnTypeLoc,
DeclSpec *MethodQualifiers) {
assert(!(MethodQualifiers && MethodQualifiers->getTypeQualifiers() & DeclSpec::TQ_atomic) &&
"function cannot have _Atomic qualifier");
@@ -210,6 +212,7 @@ DeclaratorChunk DeclaratorChunk::getFunction(bool hasProto,
I.Fun.HasTrailingReturnType = TrailingReturnType.isUsable() ||
TrailingReturnType.isInvalid();
I.Fun.TrailingReturnType = TrailingReturnType.get();
+ I.Fun.TrailingReturnTypeLoc = TrailingReturnTypeLoc.getRawEncoding();
I.Fun.MethodQualifiers = nullptr;
I.Fun.QualAttrFactory = nullptr;