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;
   }


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;
   }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to