mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-07 08:34:59 +00:00
Patch to prevent crash on use of objc2 syntax.
llvm-svn: 44617
This commit is contained in:
parent
d5db92ba97
commit
b31a2f2a47
@ -106,6 +106,8 @@ Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
|
||||
}
|
||||
if (isa<TypedefDecl>(D))
|
||||
return Diag(Loc, diag::err_unexpected_typedef, II.getName());
|
||||
if (isa<ObjcInterfaceDecl>(D))
|
||||
return Diag(Loc, diag::err_unexpected_interface, II.getName());
|
||||
|
||||
assert(0 && "Invalid decl");
|
||||
abort();
|
||||
|
@ -392,6 +392,8 @@ DIAG(err_matching, ERROR,
|
||||
"to match this '%0'")
|
||||
|
||||
/// Objective-C parser diagnostics
|
||||
DIAG(err_unexpected_interface, ERROR,
|
||||
"unexpected interface name '%0': expected expression")
|
||||
DIAG(err_objc_no_attributes_on_category, ERROR,
|
||||
"attributes may not be specified on a category")
|
||||
DIAG(err_objc_missing_end, ERROR,
|
||||
|
10
clang/test/Parser/check-objc2-syntax-1.m
Normal file
10
clang/test/Parser/check-objc2-syntax-1.m
Normal file
@ -0,0 +1,10 @@
|
||||
// RUN: clang -fsyntax-only -verify %s
|
||||
|
||||
@interface Subclass
|
||||
+ (int)magicNumber;
|
||||
@end
|
||||
|
||||
int main (void) {
|
||||
return Subclass.magicNumber; // expected-error {{unexpected interface name 'Subclass': expected expression}}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user