diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-09-13 15:35:43 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-09-13 15:35:43 +0000 |
commit | 6ee1562cfcacd68f98c8c8e02bc30050f5ca992b (patch) | |
tree | b1270b4716a34d2a2d917617982d1761299bf7a5 /clang/test/FixIt/fixit.c | |
parent | 34bdbbdf97ca3a8fdfc53850a4b065951d7fa2ca (diff) | |
download | bcm5719-llvm-6ee1562cfcacd68f98c8c8e02bc30050f5ca992b.tar.gz bcm5719-llvm-6ee1562cfcacd68f98c8c8e02bc30050f5ca992b.zip |
Unify handling of string literal arguments for attributes and add fixits.
This fixes a couple of latent crashes for invalid attributes and also adds a
fixit hint to turn identifiers into string literals if one was expected. It then
proceeds recovery as if the identifier was a literal. Diagnostic locations are
also changed to point at the literal instead of the attribute if the error
concerns the argument. PR17175.
For example:
hidden.c:1:40: error: 'visibility' attribute requires a string
extern int x __attribute__((visibility(hidden)));
^
" "
hidden.c:2:29: error: visibility does not match previous declaration
extern int x __attribute__((visibility("default")));
^
hidden.c:1:29: note: previous attribute is here
extern int x __attribute__((visibility(hidden)));
^
llvm-svn: 190699
Diffstat (limited to 'clang/test/FixIt/fixit.c')
-rw-r--r-- | clang/test/FixIt/fixit.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/test/FixIt/fixit.c b/clang/test/FixIt/fixit.c index 00adb19e50c..6443fe53c2a 100644 --- a/clang/test/FixIt/fixit.c +++ b/clang/test/FixIt/fixit.c @@ -115,3 +115,5 @@ struct noSemiAfterStruct { enum noSemiAfterEnum { e1 } // expected-error {{expected ';' after enum}} + +int PR17175 __attribute__((visibility(hidden))); // expected-error {{'visibility' attribute requires a string}} |