forked from OSchip/llvm-project
objective-c: Provide a 'fixit' when class was used
to declare a static object. // rdar://9603056 llvm-svn: 135970
This commit is contained in:
parent
d48db2115a
commit
9a14c21cfd
|
@ -3937,7 +3937,8 @@ void Sema::CheckVariableDeclaration(VarDecl *NewVD,
|
|||
QualType T = NewVD->getType();
|
||||
|
||||
if (T->isObjCObjectType()) {
|
||||
Diag(NewVD->getLocation(), diag::err_statically_allocated_object);
|
||||
Diag(NewVD->getLocation(), diag::err_statically_allocated_object)
|
||||
<< FixItHint::CreateInsertion(NewVD->getLocation(), "*");
|
||||
return NewVD->setInvalidDecl();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
// Objective-C recovery
|
||||
// RUN: cp %s %t
|
||||
// RUN: %clang_cc1 -fixit -x objective-c %t || true
|
||||
// RUN: %clang_cc1 -fsyntax-only -Werror -x objective-c %t
|
||||
|
||||
// Objective-C++ recovery
|
||||
// RUN: cp %s %t
|
||||
// RUN: %clang_cc1 -fixit -x objective-c++ %t || true
|
||||
// RUN: %clang_cc1 -fsyntax-only -Werror -x objective-c++ %t
|
||||
// rdar://9603056
|
||||
|
||||
@interface NSArray
|
||||
+ (id) arrayWithObjects;
|
||||
@end
|
||||
|
||||
int main() {
|
||||
NSArray pluginNames = [NSArray arrayWithObjects];
|
||||
}
|
Loading…
Reference in New Issue