2 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3 // See https://llvm.org/LICENSE.txt for license information.
4 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10 // Created by Blaine Garst on 9/24/08.
13 #import <Cocoa/Cocoa.h>
17 four source types: C, ObjC, C++, ObjC++,
18 and for ObjC or ObjC++ we have
19 RR and GC capabilities
20 we assume C++ friendly includes for C/ObjC even if C++ isn't used
23 four compilers: C, ObjC, C++, ObjC++
24 and for ObjC or ObjC++ we can compile
26 although to test RR+GC we need to build a shell "main" in both modes
27 and/or run with GC disabled if possible.
29 To maximize coverage we mark files with capabilities and then ask them to be
30 compiled with each variation of compiler and option.
31 If the file doesn't have the capability it politely refuses.
40 DoRRGC
= (1 << 6), // -fobjc-gc but main w/o so it runs in RR mode
41 DoGCRR
= (1 << 7), // -fobjc-gc & run GC mode
48 DoC99
= (1 << 12), // -std=c99
52 @
class TestFileExeGenerator
;
54 // this class will actually compile and/or run a target binary
55 // XXX we don't track which dynamic libraries requested/used nor set them up
56 @interface TestFileExe
: NSObject
{
57 NSPointerArray
*compileLine
;
60 TestFileExeGenerator
*generator
;
61 __strong
char *binaryName
;
62 __strong
char *sourceName
;
63 __strong
char *libraryPath
;
64 __strong
char *frameworkPath
;
66 @property
int options
;
67 @
property(assign
) NSPointerArray
*compileLine
;
68 @
property(assign
) TestFileExeGenerator
*generator
;
69 @property
bool shouldFail
;
70 @property __strong
char *binaryName
;
71 @property __strong
char *sourceName
;
72 @property __strong
char *libraryPath
;
73 @property __strong
char *frameworkPath
;
74 - (bool) compileUnlessExists
:(bool)skip
;
76 @
property(readonly
) __strong
char *radar
;
79 // this class generates an appropriate set of configurations to compile
80 // we don't track which gcc we use but we should XXX
81 @interface TestFileExeGenerator
: NSObject
{
89 bool supposedToNotCompile
;
90 bool open
; // this problem is still open - e.g. unresolved
91 __strong
char *radar
; // for things already known to go wrong
92 __strong
char *filename
;
93 __strong
char *compilerPath
;
94 __strong
char *errorString
;
95 __strong
char *warningString
;
96 NSPointerArray
*extraLibraries
;
98 @property
bool hasObjC
, hasRR
, hasGC
, hasCPlusPlus
, wantsC99
, supposedToNotCompile
, open
, wants32
, wants64
;
99 @
property(assign
) __strong
char *radar
;
100 @property __strong
char *filename
;
101 @property __strong
char *compilerPath
;
102 @property __strong
char *errorString
;
103 @property __strong
char *warningString
;
104 - (TestFileExe
*)lineForOptions
:(int)options
; // nil if no can do
105 + (NSArray
*)generatorsFromFILE
:(FILE *)fd
;
106 + (NSArray
*)generatorsFromPath
:(NSString
*)path
;