[Lldb-commits] [lldb] d1a1798 - [lldb] Replace unneeded use of Foundation with ObjectiveC in tests (NFC)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Sun Apr 4 20:04:51 PDT 2021


Author: Dave Lee
Date: 2021-04-04T20:04:41-07:00
New Revision: d1a1798e51a30fbf537e9fd8931a49b504f37a25

URL: https://github.com/llvm/llvm-project/commit/d1a1798e51a30fbf537e9fd8931a49b504f37a25
DIFF: https://github.com/llvm/llvm-project/commit/d1a1798e51a30fbf537e9fd8931a49b504f37a25.diff

LOG: [lldb] Replace unneeded use of Foundation with ObjectiveC in tests (NFC)

When referencing `NSObject`, it's enough to import `objc/NSObject.h`. Importing `Foundation` is unnecessary in these cases.

Differential Revision: https://reviews.llvm.org/D99867

Added: 
    

Modified: 
    lldb/test/API/commands/expression/context-object-objc/Makefile
    lldb/test/API/commands/expression/context-object-objc/main.m
    lldb/test/API/commands/expression/namespace_local_var_same_name_obj_c/main.mm
    lldb/test/API/commands/frame/recognizer/Makefile
    lldb/test/API/commands/frame/recognizer/main.m
    lldb/test/API/functionalities/type_lookup/Makefile
    lldb/test/API/functionalities/type_lookup/main.mm
    lldb/test/API/lang/objc/bitfield_ivars/Makefile
    lldb/test/API/lang/objc/bitfield_ivars/main.m
    lldb/test/API/lang/objc/blocks/Makefile
    lldb/test/API/lang/objc/blocks/ivars-in-blocks.h
    lldb/test/API/lang/objc/blocks/ivars-in-blocks.m
    lldb/test/API/lang/objc/conflicting-definition/Test/Test.h
    lldb/test/API/lang/objc/forward-decl/Container.h
    lldb/test/API/lang/objc/forward-decl/Makefile
    lldb/test/API/lang/objc/forward-decl/main.m
    lldb/test/API/lang/objc/foundation/my-base.m
    lldb/test/API/lang/objc/hidden-ivars/InternalDefiner.h
    lldb/test/API/lang/objc/ivar-IMP/Makefile
    lldb/test/API/lang/objc/ivar-IMP/myclass.h
    lldb/test/API/lang/objc/ivar-IMP/myclass.m
    lldb/test/API/lang/objc/ivar-IMP/repro.m
    lldb/test/API/lang/objc/modules-objc-property/main.m
    lldb/test/API/lang/objc/modules-objc-property/myModule.h
    lldb/test/API/lang/objc/objc-ivar-offsets/Makefile
    lldb/test/API/lang/objc/objc-ivar-offsets/objc-ivar-offsets.h
    lldb/test/API/lang/objc/objc-super/Makefile
    lldb/test/API/lang/objc/objc-super/class.m
    lldb/test/API/lang/objcxx/class-name-clash/myobject.mm
    lldb/test/API/python_api/class_members/main.mm
    lldb/test/API/python_api/objc_type/Makefile
    lldb/test/API/python_api/objc_type/main.m

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/commands/expression/context-object-objc/Makefile b/lldb/test/API/commands/expression/context-object-objc/Makefile
index a3198db9e8e88..11fce1e5c5219 100644
--- a/lldb/test/API/commands/expression/context-object-objc/Makefile
+++ b/lldb/test/API/commands/expression/context-object-objc/Makefile
@@ -1,3 +1,4 @@
 OBJC_SOURCES := main.m
-LD_EXTRAS := -framework Foundation
+LD_EXTRAS := -lobjc
+
 include Makefile.rules

diff  --git a/lldb/test/API/commands/expression/context-object-objc/main.m b/lldb/test/API/commands/expression/context-object-objc/main.m
index 5c495b24894f7..dd63b7bd86879 100644
--- a/lldb/test/API/commands/expression/context-object-objc/main.m
+++ b/lldb/test/API/commands/expression/context-object-objc/main.m
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 
 @interface ObjcClass : NSObject {
     int field;

diff  --git a/lldb/test/API/commands/expression/namespace_local_var_same_name_obj_c/main.mm b/lldb/test/API/commands/expression/namespace_local_var_same_name_obj_c/main.mm
index 70e9598eefbb0..62e4475425ab8 100644
--- a/lldb/test/API/commands/expression/namespace_local_var_same_name_obj_c/main.mm
+++ b/lldb/test/API/commands/expression/namespace_local_var_same_name_obj_c/main.mm
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 @interface Util : NSObject
 + (void)debugPrintErrorStatic;
 - (void)debugPrintError;

diff  --git a/lldb/test/API/commands/frame/recognizer/Makefile b/lldb/test/API/commands/frame/recognizer/Makefile
index 8248c01fe6a8c..09f6bd59a2fb3 100644
--- a/lldb/test/API/commands/frame/recognizer/Makefile
+++ b/lldb/test/API/commands/frame/recognizer/Makefile
@@ -1,9 +1,5 @@
 OBJC_SOURCES := main.m
-
 CFLAGS_EXTRAS := -g0 # No debug info.
 MAKE_DSYM := NO
 
-
-
-LD_EXTRAS := -framework Foundation
 include Makefile.rules

diff  --git a/lldb/test/API/commands/frame/recognizer/main.m b/lldb/test/API/commands/frame/recognizer/main.m
index 5d064c2564ddc..6546692bba772 100644
--- a/lldb/test/API/commands/frame/recognizer/main.m
+++ b/lldb/test/API/commands/frame/recognizer/main.m
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <stdio.h>
 
 void foo(int a, int b)
 {

diff  --git a/lldb/test/API/functionalities/type_lookup/Makefile b/lldb/test/API/functionalities/type_lookup/Makefile
index 876340159d9c8..547bb7eae5bf7 100644
--- a/lldb/test/API/functionalities/type_lookup/Makefile
+++ b/lldb/test/API/functionalities/type_lookup/Makefile
@@ -1,8 +1,5 @@
 OBJCXX_SOURCES := main.mm
-
 CFLAGS_EXTRAS := -w
+LD_EXTRAS := -lobjc
 
-
-
-LD_EXTRAS := -framework Foundation
 include Makefile.rules

diff  --git a/lldb/test/API/functionalities/type_lookup/main.mm b/lldb/test/API/functionalities/type_lookup/main.mm
index 663bd11f2a18d..88da46db04681 100644
--- a/lldb/test/API/functionalities/type_lookup/main.mm
+++ b/lldb/test/API/functionalities/type_lookup/main.mm
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 
 class MyCPPClass {
 public:

diff  --git a/lldb/test/API/lang/objc/bitfield_ivars/Makefile b/lldb/test/API/lang/objc/bitfield_ivars/Makefile
index a68dad547ec63..1b3b326cda108 100644
--- a/lldb/test/API/lang/objc/bitfield_ivars/Makefile
+++ b/lldb/test/API/lang/objc/bitfield_ivars/Makefile
@@ -1,4 +1,4 @@
 OBJC_SOURCES := main.m
-LD_EXTRAS = -framework Foundation
+LD_EXTRAS = -lobjc
 
 include Makefile.rules

diff  --git a/lldb/test/API/lang/objc/bitfield_ivars/main.m b/lldb/test/API/lang/objc/bitfield_ivars/main.m
index ce0ca31b76698..75d3239a248bf 100644
--- a/lldb/test/API/lang/objc/bitfield_ivars/main.m
+++ b/lldb/test/API/lang/objc/bitfield_ivars/main.m
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 
 typedef struct {
     unsigned char fieldOne : 1;

diff  --git a/lldb/test/API/lang/objc/blocks/Makefile b/lldb/test/API/lang/objc/blocks/Makefile
index df76ed3069fcf..14af79a2bccb7 100644
--- a/lldb/test/API/lang/objc/blocks/Makefile
+++ b/lldb/test/API/lang/objc/blocks/Makefile
@@ -1,4 +1,4 @@
 OBJC_SOURCES := ivars-in-blocks.m main.m
-LD_EXTRAS := -lobjc -framework Foundation
+LD_EXTRAS := -lobjc
 
 include Makefile.rules

diff  --git a/lldb/test/API/lang/objc/blocks/ivars-in-blocks.h b/lldb/test/API/lang/objc/blocks/ivars-in-blocks.h
index 1ceac3361ac0e..cf5eba73f314f 100644
--- a/lldb/test/API/lang/objc/blocks/ivars-in-blocks.h
+++ b/lldb/test/API/lang/objc/blocks/ivars-in-blocks.h
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 
 @interface IAmBlocky : NSObject
 {

diff  --git a/lldb/test/API/lang/objc/blocks/ivars-in-blocks.m b/lldb/test/API/lang/objc/blocks/ivars-in-blocks.m
index 1098a9136ae22..37d266fefb22b 100644
--- a/lldb/test/API/lang/objc/blocks/ivars-in-blocks.m
+++ b/lldb/test/API/lang/objc/blocks/ivars-in-blocks.m
@@ -1,4 +1,5 @@
 #import "ivars-in-blocks.h"
+#import <stdio.h>
 
 typedef int (^my_block_ptr_type) (int);
 

diff  --git a/lldb/test/API/lang/objc/conflicting-definition/Test/Test.h b/lldb/test/API/lang/objc/conflicting-definition/Test/Test.h
index 73928c5fb0da6..ff50ddba08246 100644
--- a/lldb/test/API/lang/objc/conflicting-definition/Test/Test.h
+++ b/lldb/test/API/lang/objc/conflicting-definition/Test/Test.h
@@ -1,5 +1,5 @@
-#import <Foundation/Foundation.h>
 #import <Test/Foo.h>
+#import <objc/NSObject.h>
 
 @interface Test : NSObject {
 @public

diff  --git a/lldb/test/API/lang/objc/forward-decl/Container.h b/lldb/test/API/lang/objc/forward-decl/Container.h
index 85bbd06b161c6..2b53e28c74fc2 100644
--- a/lldb/test/API/lang/objc/forward-decl/Container.h
+++ b/lldb/test/API/lang/objc/forward-decl/Container.h
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 
 @class ForwardDeclaredClass;
 

diff  --git a/lldb/test/API/lang/objc/forward-decl/Makefile b/lldb/test/API/lang/objc/forward-decl/Makefile
index cfae251ead4b0..252dfb69699d1 100644
--- a/lldb/test/API/lang/objc/forward-decl/Makefile
+++ b/lldb/test/API/lang/objc/forward-decl/Makefile
@@ -1,8 +1,6 @@
 DYLIB_NAME := Container
 DYLIB_OBJC_SOURCES := Container.m
 OBJC_SOURCES := main.m
+LD_EXTRAS := -lobjc
 
-
-
-LD_EXTRAS := -framework Foundation
 include Makefile.rules

diff  --git a/lldb/test/API/lang/objc/forward-decl/main.m b/lldb/test/API/lang/objc/forward-decl/main.m
index 8e5256e952308..7b652485a657f 100644
--- a/lldb/test/API/lang/objc/forward-decl/main.m
+++ b/lldb/test/API/lang/objc/forward-decl/main.m
@@ -1,5 +1,6 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 #import "Container.h"
+#import <stdio.h>
 
 int main(int argc, const char * argv[])
 {

diff  --git a/lldb/test/API/lang/objc/foundation/my-base.m b/lldb/test/API/lang/objc/foundation/my-base.m
index 0c316b244f269..4147ac1764a57 100644
--- a/lldb/test/API/lang/objc/foundation/my-base.m
+++ b/lldb/test/API/lang/objc/foundation/my-base.m
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 #import "my-base.h"
 @implementation MyBase
 #if __OBJC2__

diff  --git a/lldb/test/API/lang/objc/hidden-ivars/InternalDefiner.h b/lldb/test/API/lang/objc/hidden-ivars/InternalDefiner.h
index 59652d4b09c0c..f5d8e015aa636 100644
--- a/lldb/test/API/lang/objc/hidden-ivars/InternalDefiner.h
+++ b/lldb/test/API/lang/objc/hidden-ivars/InternalDefiner.h
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 #import <stdint.h>
 
 @interface InternalDefiner : NSObject {

diff  --git a/lldb/test/API/lang/objc/ivar-IMP/Makefile b/lldb/test/API/lang/objc/ivar-IMP/Makefile
index 5d920f4421368..91d46662e1062 100644
--- a/lldb/test/API/lang/objc/ivar-IMP/Makefile
+++ b/lldb/test/API/lang/objc/ivar-IMP/Makefile
@@ -1,5 +1,5 @@
 OBJC_SOURCES := myclass.m repro.m
-LD_EXTRAS := -framework Foundation
+LD_EXTRAS := -lobjc
 
 include Makefile.rules
 

diff  --git a/lldb/test/API/lang/objc/ivar-IMP/myclass.h b/lldb/test/API/lang/objc/ivar-IMP/myclass.h
index da28d1e051810..2dfa3dd07e3e7 100644
--- a/lldb/test/API/lang/objc/ivar-IMP/myclass.h
+++ b/lldb/test/API/lang/objc/ivar-IMP/myclass.h
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 
 @interface MyClass : NSObject
 {}

diff  --git a/lldb/test/API/lang/objc/ivar-IMP/myclass.m b/lldb/test/API/lang/objc/ivar-IMP/myclass.m
index 85b2fcfe9b3c6..6515180f9220b 100644
--- a/lldb/test/API/lang/objc/ivar-IMP/myclass.m
+++ b/lldb/test/API/lang/objc/ivar-IMP/myclass.m
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 #import "myclass.h"
 
 @implementation MyClass

diff  --git a/lldb/test/API/lang/objc/ivar-IMP/repro.m b/lldb/test/API/lang/objc/ivar-IMP/repro.m
index 14f911f07dd83..289ee5f6fea24 100644
--- a/lldb/test/API/lang/objc/ivar-IMP/repro.m
+++ b/lldb/test/API/lang/objc/ivar-IMP/repro.m
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 #import "myclass.h"
 
 int main() {

diff  --git a/lldb/test/API/lang/objc/modules-objc-property/main.m b/lldb/test/API/lang/objc/modules-objc-property/main.m
index c0f58f41b7640..54d69c04894e5 100644
--- a/lldb/test/API/lang/objc/modules-objc-property/main.m
+++ b/lldb/test/API/lang/objc/modules-objc-property/main.m
@@ -1,4 +1,4 @@
- at import Foundation;
+ at import ObjectiveC;
 @import myModule;
 
 int main() {

diff  --git a/lldb/test/API/lang/objc/modules-objc-property/myModule.h b/lldb/test/API/lang/objc/modules-objc-property/myModule.h
index 07b40ccc2f659..4377d30a52db7 100644
--- a/lldb/test/API/lang/objc/modules-objc-property/myModule.h
+++ b/lldb/test/API/lang/objc/modules-objc-property/myModule.h
@@ -1,7 +1,7 @@
 #ifndef MYMODULE
 #define MYMODULE
 
- at import Foundation;
+ at import ObjectiveC;
 
 @interface MyClass : NSObject
 - (int) propConflict;

diff  --git a/lldb/test/API/lang/objc/objc-ivar-offsets/Makefile b/lldb/test/API/lang/objc/objc-ivar-offsets/Makefile
index 5408f4199f2ad..83821a6bd264d 100644
--- a/lldb/test/API/lang/objc/objc-ivar-offsets/Makefile
+++ b/lldb/test/API/lang/objc/objc-ivar-offsets/Makefile
@@ -1,4 +1,4 @@
 OBJC_SOURCES := objc-ivar-offsets.m main.m
-LD_EXTRAS := -lobjc -framework Foundation
+LD_EXTRAS := -lobjc
 
 include Makefile.rules

diff  --git a/lldb/test/API/lang/objc/objc-ivar-offsets/objc-ivar-offsets.h b/lldb/test/API/lang/objc/objc-ivar-offsets/objc-ivar-offsets.h
index 99bbd427b0648..6592c0fa8ae61 100644
--- a/lldb/test/API/lang/objc/objc-ivar-offsets/objc-ivar-offsets.h
+++ b/lldb/test/API/lang/objc/objc-ivar-offsets/objc-ivar-offsets.h
@@ -1,4 +1,5 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
+#import <stdint.h>
 
 @interface BaseClass : NSObject
 {

diff  --git a/lldb/test/API/lang/objc/objc-super/Makefile b/lldb/test/API/lang/objc/objc-super/Makefile
index e6db3dee37bfa..6df044b98f4ad 100644
--- a/lldb/test/API/lang/objc/objc-super/Makefile
+++ b/lldb/test/API/lang/objc/objc-super/Makefile
@@ -1,4 +1,4 @@
 OBJC_SOURCES := class.m
-LD_EXTRAS := -lobjc -framework Foundation
+LD_EXTRAS := -lobjc
 
 include Makefile.rules

diff  --git a/lldb/test/API/lang/objc/objc-super/class.m b/lldb/test/API/lang/objc/objc-super/class.m
index b55b649aaaec7..a3000879bc2fa 100644
--- a/lldb/test/API/lang/objc/objc-super/class.m
+++ b/lldb/test/API/lang/objc/objc-super/class.m
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 
 @interface Foo : NSObject {
 }

diff  --git a/lldb/test/API/lang/objcxx/class-name-clash/myobject.mm b/lldb/test/API/lang/objcxx/class-name-clash/myobject.mm
index 051c4e5eb1d58..5c407463e2382 100644
--- a/lldb/test/API/lang/objcxx/class-name-clash/myobject.mm
+++ b/lldb/test/API/lang/objcxx/class-name-clash/myobject.mm
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 
 @interface MyObject : NSObject
 @end

diff  --git a/lldb/test/API/python_api/class_members/main.mm b/lldb/test/API/python_api/class_members/main.mm
index b84f4d3d4b4f4..723cb6102170e 100644
--- a/lldb/test/API/python_api/class_members/main.mm
+++ b/lldb/test/API/python_api/class_members/main.mm
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 
 class Base {
 public:

diff  --git a/lldb/test/API/python_api/objc_type/Makefile b/lldb/test/API/python_api/objc_type/Makefile
index 8b322ff320bb0..5f07431ec00a1 100644
--- a/lldb/test/API/python_api/objc_type/Makefile
+++ b/lldb/test/API/python_api/objc_type/Makefile
@@ -1,8 +1,5 @@
 OBJC_SOURCES := main.m
-
 CFLAGS_EXTRAS := -w
+LD_EXTRAS := -lobjc
 
-
-
-LD_EXTRAS := -framework Foundation
 include Makefile.rules

diff  --git a/lldb/test/API/python_api/objc_type/main.m b/lldb/test/API/python_api/objc_type/main.m
index 941442f4da397..6075622edcfcd 100644
--- a/lldb/test/API/python_api/objc_type/main.m
+++ b/lldb/test/API/python_api/objc_type/main.m
@@ -1,4 +1,4 @@
-#import <Foundation/Foundation.h>
+#import <objc/NSObject.h>
 
 @interface Foo: NSObject
 {}


        


More information about the lldb-commits mailing list