1//
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
5
6//
7// testfilerunner.h
8// testObjects
9//
10// Created by Blaine Garst on 9/24/08.
11//
12
13#import <Cocoa/Cocoa.h>
14
15/*
16 variations:
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
21
22
23 four compilers: C, ObjC, C++, ObjC++
24 and for ObjC or ObjC++ we can compile
25 RR, RR+GC, GC+RR, GC
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.
28
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.
32*/
33
34enum options {
35 Do64 = (1 << 0),
36 DoCPP = (1 << 1),
37 DoOBJC = (1 << 3),
38 DoGC = (1 << 4),
39 DoRR = (1 << 5),
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
42
43 //DoDashG = (1 << 8),
44 DoDashO = (1 << 9),
45 DoDashOs = (1 << 10),
46 DoDashO2 = (1 << 11),
47
48 DoC99 = (1 << 12), // -std=c99
49};
50
51
52@class TestFileExeGenerator;
53
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;
58 int options;
59 bool shouldFail;
60 TestFileExeGenerator *generator;
61 __strong char *binaryName;
62 __strong char *sourceName;
63 __strong char *libraryPath;
64 __strong char *frameworkPath;
65}
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;
75- (bool) run;
76@property(readonly) __strong char *radar;
77@end
78
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 {
82 bool hasObjC;
83 bool hasRR;
84 bool hasGC;
85 bool hasCPlusPlus;
86 bool wantsC99;
87 bool wants64;
88 bool wants32;
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;
97}
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;
107@end
108
109
110

source code of compiler-rt/test/BlocksRuntime/testfilerunner.h