Sink definition of IBOutlet, IBOutletCollection, and IBAction into
the compiler predefines buffer. These are essentially part of
the Objective-C language.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158690 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
index 9eb970a..bd08f5c 100644
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -377,6 +377,11 @@
if (LangOpts.NeXTRuntime)
Builder.defineMacro("__NEXT_RUNTIME__");
+
+ Builder.defineMacro("IBOutlet", "__attribute__((iboutlet))");
+ Builder.defineMacro("IBOutletCollection(ClassName)",
+ "__attribute__((iboutletcollection(ClassName)))");
+ Builder.defineMacro("IBAction", "void)__attribute__((ibaction)");
}
// darwin_constant_cfstrings controls this. This is also dependent
diff --git a/test/Analysis/MissingDealloc.m b/test/Analysis/MissingDealloc.m
index 51a5912..589fcf5 100644
--- a/test/Analysis/MissingDealloc.m
+++ b/test/Analysis/MissingDealloc.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.osx.cocoa.Dealloc '-DIBOutlet=__attribute__((iboutlet))' %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.osx.cocoa.Dealloc %s -verify
typedef signed char BOOL;
@protocol NSObject
- (BOOL)isEqual:(id)object;
@@ -53,10 +53,6 @@
//===------------------------------------------------------------------------===
// Don't warn about iVars that are IBOutlets.
-#ifndef IBOutlet
-#define IBOutlet
-#endif
-
@class NSWindow;
@interface HasOutlet : NSObject {
diff --git a/tools/scan-build/ccc-analyzer b/tools/scan-build/ccc-analyzer
index 84d25ab..86a3616 100755
--- a/tools/scan-build/ccc-analyzer
+++ b/tools/scan-build/ccc-analyzer
@@ -182,11 +182,6 @@
}
else {
$Cmd = $Clang;
- if ($Lang eq "objective-c" || $Lang eq "objective-c++") {
- push @Args,'-DIBOutlet=__attribute__((iboutlet))';
- push @Args,'-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection)))';
- push @Args,'-DIBAction=void)__attribute__((ibaction)';
- }
# Create arguments for doing regular parsing.
my $SyntaxArgs = GetCCArgs("-fsyntax-only", \@Args);