diff options
author | Adrian Prantl <aprantl@apple.com> | 2019-11-04 14:28:14 -0800 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2019-11-08 08:23:22 -0800 |
commit | 2073dd2da702baca447efaf1879cb6151e8c6100 (patch) | |
tree | 9ec90e6d822e23671983144f24051873e521ede9 /clang/test/CodeGenObjC | |
parent | 8d22100f66c4170510c6ff028c60672acfe1cff9 (diff) | |
download | bcm5719-llvm-2073dd2da702baca447efaf1879cb6151e8c6100.tar.gz bcm5719-llvm-2073dd2da702baca447efaf1879cb6151e8c6100.zip |
Redeclare Objective-C property accessors inside the ObjCImplDecl in which they are synthesized.
This patch is motivated by (and factored out from)
https://reviews.llvm.org/D66121 which is a debug info bugfix. Starting
with DWARF 5 all Objective-C methods are nested inside their
containing type, and that patch implements this for synthesized
Objective-C properties.
1. SemaObjCProperty populates a list of synthesized accessors that may
need to inserted into an ObjCImplDecl.
2. SemaDeclObjC::ActOnEnd inserts forward-declarations for all
accessors for which no override was provided into their
ObjCImplDecl. This patch does *not* synthesize AST function
*bodies*. Moving that code from the static analyzer into Sema may
be a good idea though.
3. Places that expect all methods to have bodies have been updated.
I did not update the static analyzer's inliner for synthesized
properties to point back to the property declaration (see
test/Analysis/Inputs/expected-plists/nullability-notes.m.plist), which
I believed to be more bug than a feature.
Differential Revision: https://reviews.llvm.org/D68108
rdar://problem/53782400
Diffstat (limited to 'clang/test/CodeGenObjC')
-rw-r--r-- | clang/test/CodeGenObjC/debug-info-synthesis.m | 4 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/debug-property-synth.m | 8 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/debuginfo-properties.m | 25 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/instance-method-metadata.m | 3 |
4 files changed, 19 insertions, 21 deletions
diff --git a/clang/test/CodeGenObjC/debug-info-synthesis.m b/clang/test/CodeGenObjC/debug-info-synthesis.m index f9542562828..7fbbc6dd318 100644 --- a/clang/test/CodeGenObjC/debug-info-synthesis.m +++ b/clang/test/CodeGenObjC/debug-info-synthesis.m @@ -30,8 +30,8 @@ int main(int argc, char *argv[]) { } } -// CHECK: ![[FILE:.*]] = !DIFile(filename: "{{[^"]+}}foo.h" +// CHECK: ![[FILE:.*]] = !DIFile(filename: "foo.m" // CHECK: !DISubprogram(name: "-[Foo setDict:]" // CHECK-SAME: file: ![[FILE]], -// CHECK-SAME: line: 8, +// CHECK-SAME: line: 7, // CHECK-SAME: DISPFlagLocalToUnit | DISPFlagDefinition diff --git a/clang/test/CodeGenObjC/debug-property-synth.m b/clang/test/CodeGenObjC/debug-property-synth.m index 124c61ea88c..ddcf4d998c5 100644 --- a/clang/test/CodeGenObjC/debug-property-synth.m +++ b/clang/test/CodeGenObjC/debug-property-synth.m @@ -7,6 +7,10 @@ @interface I { int _p1; } +@property int p1; +@end + +@implementation I // Test that the linetable entries for the synthesized getter and // setter are correct. // @@ -22,10 +26,6 @@ // CHECK: ![[DBG1]] = !DILocation(line: [[@LINE+3]], // CHECK: !DISubprogram(name: "-[I setP1:]",{{.*}} line: [[@LINE+2]],{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition // CHECK: ![[DBG2]] = !DILocation(line: [[@LINE+1]], -@property int p1; -@end - -@implementation I @synthesize p1 = _p1; @end diff --git a/clang/test/CodeGenObjC/debuginfo-properties.m b/clang/test/CodeGenObjC/debuginfo-properties.m index c0de620abd9..53f5e2de890 100644 --- a/clang/test/CodeGenObjC/debuginfo-properties.m +++ b/clang/test/CodeGenObjC/debuginfo-properties.m @@ -11,19 +11,6 @@ @protocol HasASelection <NSObject> @property (nonatomic, retain) Selection* selection; -// CHECK: !DISubprogram(name: "-[MyClass selection]" -// CHECK-SAME: line: [[@LINE-2]] -// CHECK-SAME: DISPFlagLocalToUnit | DISPFlagDefinition -// CHECK: !DISubprogram(name: "-[MyClass setSelection:]" -// CHECK-SAME: line: [[@LINE-5]] -// CHECK-SAME: DISPFlagLocalToUnit | DISPFlagDefinition -// CHECK: !DISubprogram(name: "-[OtherClass selection]" -// CHECK-SAME: line: [[@LINE-8]] -// CHECK-SAME: DISPFlagLocalToUnit | DISPFlagDefinition -// CHECK: !DISubprogram(name: "-[OtherClass setSelection:]" -// CHECK-SAME: line: [[@LINE-11]] -// CHECK-SAME: DISPFlagLocalToUnit | DISPFlagDefinition - @end @interface MyClass : NSObject <HasASelection> { @@ -33,6 +20,12 @@ @implementation MyClass @synthesize selection = _selection; +// CHECK: !DISubprogram(name: "-[MyClass selection]" +// CHECK-SAME: line: [[@LINE-2]] +// CHECK-SAME: DISPFlagLocalToUnit | DISPFlagDefinition +// CHECK: !DISubprogram(name: "-[MyClass setSelection:]" +// CHECK-SAME: line: [[@LINE-5]] +// CHECK-SAME: DISPFlagLocalToUnit | DISPFlagDefinition @end @interface OtherClass : NSObject <HasASelection> { @@ -41,4 +34,10 @@ @end @implementation OtherClass @synthesize selection = _selection; +// CHECK: !DISubprogram(name: "-[OtherClass selection]" +// CHECK-SAME: line: [[@LINE-2]] +// CHECK-SAME: DISPFlagLocalToUnit | DISPFlagDefinition +// CHECK: !DISubprogram(name: "-[OtherClass setSelection:]" +// CHECK-SAME: line: [[@LINE-5]] +// CHECK-SAME: DISPFlagLocalToUnit | DISPFlagDefinition @end diff --git a/clang/test/CodeGenObjC/instance-method-metadata.m b/clang/test/CodeGenObjC/instance-method-metadata.m index 96f499c9fa9..e08de8fdace 100644 --- a/clang/test/CodeGenObjC/instance-method-metadata.m +++ b/clang/test/CodeGenObjC/instance-method-metadata.m @@ -1,6 +1,5 @@ // REQUIRES: x86-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S -o %t %s -// RUN: FileCheck < %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S %s -o - | FileCheck %s // rdar://9072317 |