зеркало из https://github.com/microsoft/clang-1.git
Fix silly bug in objc_gc attribute parsing and add test case
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55286 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
a88b509d23
Коммит
6e14a8f2ac
|
@ -467,7 +467,7 @@ static void HandleVisibilityAttr(Decl *d, const AttributeList &Attr, Sema &S) {
|
|||
}
|
||||
|
||||
static void HandleObjCGCAttr(Decl *d, const AttributeList &Attr, Sema &S) {
|
||||
if (!Attr.getParameterName()) {
|
||||
if (!Attr.getParameterName()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string,
|
||||
"objc_gc", std::string("1"));
|
||||
return;
|
||||
|
@ -486,7 +486,7 @@ static void HandleObjCGCAttr(Decl *d, const AttributeList &Attr, Sema &S) {
|
|||
|
||||
if (TypeLen == 4 && !memcmp(TypeStr, "weak", 4))
|
||||
type = ObjCGCAttr::Weak;
|
||||
else if (TypeLen == 5 && !memcmp(TypeStr, "strong", 5))
|
||||
else if (TypeLen == 6 && !memcmp(TypeStr, "strong", 6))
|
||||
type = ObjCGCAttr::Strong;
|
||||
else {
|
||||
S.Diag(Attr.getLoc(), diag::warn_attribute_type_not_supported,
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: clang -fsyntax-only -verify %s
|
||||
static id __attribute((objc_gc(weak))) a;
|
||||
static id __attribute((objc_gc(strong))) b;
|
||||
|
||||
static id __attribute((objc_gc())) c; // expected-error{{'objc_gc' attribute requires parameter 1 to be a string}}
|
||||
static id __attribute((objc_gc(123))) d; // expected-error{{'objc_gc' attribute requires parameter 1 to be a string}}
|
||||
static id __attribute((objc_gc(foo, 456))) e; // expected-error{{attribute requires 1 argument(s)}}
|
||||
static id __attribute((objc_gc(hello))) f; // expected-warning{{'objc_gc' attribute argument not supported: 'hello'}}
|
Загрузка…
Ссылка в новой задаче