From: Ted Kremenek Date: Tue, 19 Jun 2012 00:37:39 +0000 (+0000) Subject: Sink definition of IBOutlet, IBOutletCollection, and IBAction into X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3065cf9ecc883715edbd3bf875acb2cab531138e;p=clang 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 9eb970af26..bd08f5c09d 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -377,6 +377,11 @@ static void InitializePredefinedMacros(const TargetInfo &TI, 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 51a5912d44..589fcf57f4 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 @@ typedef struct objc_selector *SEL; //===------------------------------------------------------------------------=== // 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 84d25ab634..86a36161f9 100755 --- a/tools/scan-build/ccc-analyzer +++ b/tools/scan-build/ccc-analyzer @@ -182,11 +182,6 @@ sub Analyze { } 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);