diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-08-04 22:21:29 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-08-04 22:21:29 +0000 |
commit | a68340fd55e177a5849cb3adbf66aedce1f6e91b (patch) | |
tree | eb3efe95072fd00c391678246a1b4abac96027c5 | |
parent | 55db5b874416cde3f2601a717e25d0974bf02f80 (diff) |
Activate selectors in chained PCH. Chained PCH now works for Objective-C.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110262 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Frontend/PCHWriter.cpp | 6 | ||||
-rw-r--r-- | test/PCH/Inputs/chain-selectors1.h | 12 | ||||
-rw-r--r-- | test/PCH/Inputs/chain-selectors2.h | 11 | ||||
-rw-r--r-- | test/PCH/chain-selectors.m | 24 |
4 files changed, 52 insertions, 1 deletions
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp index 53c05c8fdf..d5750a1f50 100644 --- a/lib/Frontend/PCHWriter.cpp +++ b/lib/Frontend/PCHWriter.cpp @@ -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(); diff --git a/test/PCH/Inputs/chain-selectors1.h b/test/PCH/Inputs/chain-selectors1.h new file mode 100644 index 0000000000..37c1c00b57 --- /dev/null +++ b/test/PCH/Inputs/chain-selectors1.h @@ -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); +} diff --git a/test/PCH/Inputs/chain-selectors2.h b/test/PCH/Inputs/chain-selectors2.h new file mode 100644 index 0000000000..4d6b556630 --- /dev/null +++ b/test/PCH/Inputs/chain-selectors2.h @@ -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); +} diff --git a/test/PCH/chain-selectors.m b/test/PCH/chain-selectors.m new file mode 100644 index 0000000000..60db3f994b --- /dev/null +++ b/test/PCH/chain-selectors.m @@ -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}} +} |