Activate selectors in chained PCH. Chained PCH now works for Objective-C.

llvm-svn: 110262
This commit is contained in:
Sebastian Redl 2010-08-04 22:21:29 +00:00
parent 8732d966e1
commit 51c79d8740
4 changed files with 52 additions and 1 deletions

View File

@ -1752,6 +1752,9 @@ void PCHWriter::WriteReferencedSelectorsPool(Sema &SemaRef) {
RecordData Record;
// Note: this writes out all references even for a dependent PCH. But it is
// very tricky to fix, and given that @selector shouldn't really appear in
// headers, probably not worth it. It's not a correctness issue.
for (DenseMap<Selector, SourceLocation>::iterator S =
SemaRef.ReferencedSelectors.begin(),
E = SemaRef.ReferencedSelectors.end(); S != E; ++S) {
@ -2435,7 +2438,8 @@ void PCHWriter::WritePCHChain(Sema &SemaRef, MemorizeStatCalls *StatCalls,
Stream.ExitBlock();
WritePreprocessor(PP);
// FIXME: Method pool
WriteSelectors(SemaRef);
WriteReferencedSelectorsPool(SemaRef);
WriteIdentifierTable(PP);
WriteTypeDeclOffsets();

View File

@ -0,0 +1,12 @@
@interface X
-(void)f;
-(void)f2;
-(void)g:(int)p;
-(void)h:(int)p1 foo:(int)p2;
@end
void foo1() {
// FIXME: Can't verify warnings in headers
//(void)@selector(x);
(void)@selector(f);
}

View File

@ -0,0 +1,11 @@
@interface Y
-(void)f;
-(double)f2;
-(void)e;
@end
void foo2() {
// FIXME: Can't verify warnings in headers
//(void)@selector(y);
//(void)@selector(e);
}

View File

@ -0,0 +1,24 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -Wselector -include %S/Inputs/chain-selectors1.h -include %S/Inputs/chain-selectors2.h
// RUN: %clang_cc1 -x objective-c -emit-pch -o %t1 %S/Inputs/chain-selectors1.h
// RUN: %clang_cc1 -x objective-c -emit-pch -o %t2 %S/Inputs/chain-selectors2.h -include-pch %t1 -chained-pch
// RUN: %clang_cc1 -fsyntax-only -verify %s -Wselector -include-pch %t2
@implementation X
-(void)f {}
-(void)f2 {}
-(void)g: (int)p {}
-(void)h: (int)p1 foo: (int)p2 {}
@end
void bar() {
id a = 0;
[a nothing]; // expected-warning {{method '-nothing' not found}}
[a f];
// FIXME: Can't verify notes in headers
//[a f2];
(void)@selector(x); // expected-warning {{unimplemented selector}}
(void)@selector(y); // expected-warning {{unimplemented selector}}
(void)@selector(e); // expected-warning {{unimplemented selector}}
}