[PATCH] D75844: [clang] Set begin loc on GNU attribute parsed attrs
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 9 05:52:18 PDT 2020
tbaeder created this revision.
tbaeder added reviewers: tstellar, serge-sans-paille.
tbaeder added a project: clang.
Herald added a subscriber: cfe-commits.
Otherwise the source range of the passed-in ParsedAttributesWithRange
ends up being invalid and the resulting error messages rather useless.
For example:
error: fallthrough annotation in unreachable code [-Werror,-Wimplicit-fallthrough]
Instead of the more useful error message, which is produced with this
commit:
./test.c:8:5: error: fallthrough annotation in unreachable code [-Werror,-Wimplicit-fallthrough]
__attribute__((fallthrough));
^
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75844
Files:
clang/lib/Parse/ParseStmt.cpp
Index: clang/lib/Parse/ParseStmt.cpp
===================================================================
--- clang/lib/Parse/ParseStmt.cpp
+++ clang/lib/Parse/ParseStmt.cpp
@@ -235,6 +235,7 @@
case tok::kw___attribute: {
GNUAttributeLoc = Tok.getLocation();
+ Attrs.Range.setBegin(GNUAttributeLoc);
ParseGNUAttributes(Attrs);
goto Retry;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75844.249069.patch
Type: text/x-patch
Size: 366 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200309/c5f31eb9/attachment.bin>
More information about the cfe-commits
mailing list