]> granicus.if.org Git - clang/commit
Unify handling of string literal arguments for attributes and add fixits.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 13 Sep 2013 15:35:43 +0000 (15:35 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 13 Sep 2013 15:35:43 +0000 (15:35 +0000)
commit1a343e26c76bb09d95b12c3693b19718f4811005
tree4999daeea116219373a0cffb99708f40800afb19
parent2b33b7e978f5e47b6f0a1f264b77eb110966edf0
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)));
                            ^

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190699 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaDeclAttr.cpp
test/FixIt/fixit.c