xref: /aosp_15_r20/external/compiler-rt/test/BlocksRuntime/testfilerunner.h (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot //
2*7c3d14c8STreehugger Robot //                     The LLVM Compiler Infrastructure
3*7c3d14c8STreehugger Robot //
4*7c3d14c8STreehugger Robot // This file is distributed under the University of Illinois Open Source
5*7c3d14c8STreehugger Robot // License. See LICENSE.TXT for details.
6*7c3d14c8STreehugger Robot 
7*7c3d14c8STreehugger Robot //
8*7c3d14c8STreehugger Robot //  testfilerunner.h
9*7c3d14c8STreehugger Robot //  testObjects
10*7c3d14c8STreehugger Robot //
11*7c3d14c8STreehugger Robot //  Created by Blaine Garst on 9/24/08.
12*7c3d14c8STreehugger Robot //
13*7c3d14c8STreehugger Robot 
14*7c3d14c8STreehugger Robot #import <Cocoa/Cocoa.h>
15*7c3d14c8STreehugger Robot 
16*7c3d14c8STreehugger Robot /*
17*7c3d14c8STreehugger Robot     variations:
18*7c3d14c8STreehugger Robot         four source types:  C, ObjC, C++, ObjC++,
19*7c3d14c8STreehugger Robot           and for ObjC or ObjC++ we have
20*7c3d14c8STreehugger Robot              RR and GC capabilities
21*7c3d14c8STreehugger Robot         we assume C++ friendly includes for C/ObjC even if C++ isn't used
22*7c3d14c8STreehugger Robot 
23*7c3d14c8STreehugger Robot 
24*7c3d14c8STreehugger Robot         four compilers: C, ObjC, C++, ObjC++
25*7c3d14c8STreehugger Robot           and for ObjC or ObjC++ we can compile
26*7c3d14c8STreehugger Robot               RR, RR+GC, GC+RR, GC
27*7c3d14c8STreehugger Robot           although to test RR+GC we need to build a shell "main" in both modes
28*7c3d14c8STreehugger Robot           and/or run with GC disabled if possible.
29*7c3d14c8STreehugger Robot 
30*7c3d14c8STreehugger Robot     To maximize coverage we mark files with capabilities and then ask them to be
31*7c3d14c8STreehugger Robot     compiled with each variation of compiler and option.
32*7c3d14c8STreehugger Robot     If the file doesn't have the capability it politely refuses.
33*7c3d14c8STreehugger Robot */
34*7c3d14c8STreehugger Robot 
35*7c3d14c8STreehugger Robot enum options {
36*7c3d14c8STreehugger Robot     Do64   = (1 << 0),
37*7c3d14c8STreehugger Robot     DoCPP  = (1 << 1),
38*7c3d14c8STreehugger Robot     DoOBJC = (1 << 3),
39*7c3d14c8STreehugger Robot     DoGC   = (1 << 4),
40*7c3d14c8STreehugger Robot     DoRR   = (1 << 5),
41*7c3d14c8STreehugger Robot     DoRRGC = (1 << 6),  // -fobjc-gc but main w/o so it runs in RR mode
42*7c3d14c8STreehugger Robot     DoGCRR = (1 << 7),  // -fobjc-gc & run GC mode
43*7c3d14c8STreehugger Robot 
44*7c3d14c8STreehugger Robot     //DoDashG = (1 << 8),
45*7c3d14c8STreehugger Robot     DoDashO = (1 << 9),
46*7c3d14c8STreehugger Robot     DoDashOs = (1 << 10),
47*7c3d14c8STreehugger Robot     DoDashO2 = (1 << 11),
48*7c3d14c8STreehugger Robot 
49*7c3d14c8STreehugger Robot     DoC99 = (1 << 12), // -std=c99
50*7c3d14c8STreehugger Robot };
51*7c3d14c8STreehugger Robot 
52*7c3d14c8STreehugger Robot 
53*7c3d14c8STreehugger Robot @class TestFileExeGenerator;
54*7c3d14c8STreehugger Robot 
55*7c3d14c8STreehugger Robot // this class will actually compile and/or run a target binary
56*7c3d14c8STreehugger Robot // XXX we don't track which dynamic libraries requested/used nor set them up
57*7c3d14c8STreehugger Robot @interface TestFileExe : NSObject {
58*7c3d14c8STreehugger Robot     NSPointerArray *compileLine;
59*7c3d14c8STreehugger Robot     int options;
60*7c3d14c8STreehugger Robot     bool shouldFail;
61*7c3d14c8STreehugger Robot     TestFileExeGenerator *generator;
62*7c3d14c8STreehugger Robot     __strong char *binaryName;
63*7c3d14c8STreehugger Robot     __strong char *sourceName;
64*7c3d14c8STreehugger Robot     __strong char *libraryPath;
65*7c3d14c8STreehugger Robot     __strong char *frameworkPath;
66*7c3d14c8STreehugger Robot }
67*7c3d14c8STreehugger Robot @property int options;
68*7c3d14c8STreehugger Robot @property(assign) NSPointerArray *compileLine;
69*7c3d14c8STreehugger Robot @property(assign) TestFileExeGenerator *generator;
70*7c3d14c8STreehugger Robot @property bool shouldFail;
71*7c3d14c8STreehugger Robot @property __strong char *binaryName;
72*7c3d14c8STreehugger Robot @property __strong char *sourceName;
73*7c3d14c8STreehugger Robot @property __strong char *libraryPath;
74*7c3d14c8STreehugger Robot @property __strong char *frameworkPath;
75*7c3d14c8STreehugger Robot - (bool) compileUnlessExists:(bool)skip;
76*7c3d14c8STreehugger Robot - (bool) run;
property(readonly)77*7c3d14c8STreehugger Robot @property(readonly) __strong char *radar;
78*7c3d14c8STreehugger Robot @end
79*7c3d14c8STreehugger Robot 
80*7c3d14c8STreehugger Robot // this class generates an appropriate set of configurations to compile
81*7c3d14c8STreehugger Robot // we don't track which gcc we use but we should XXX
82*7c3d14c8STreehugger Robot @interface TestFileExeGenerator : NSObject {
83*7c3d14c8STreehugger Robot     bool hasObjC;
84*7c3d14c8STreehugger Robot     bool hasRR;
85*7c3d14c8STreehugger Robot     bool hasGC;
86*7c3d14c8STreehugger Robot     bool hasCPlusPlus;
87*7c3d14c8STreehugger Robot     bool wantsC99;
88*7c3d14c8STreehugger Robot     bool wants64;
89*7c3d14c8STreehugger Robot     bool wants32;
90*7c3d14c8STreehugger Robot     bool supposedToNotCompile;
91*7c3d14c8STreehugger Robot     bool open;              // this problem is still open - e.g. unresolved
92*7c3d14c8STreehugger Robot     __strong char *radar; // for things already known to go wrong
93*7c3d14c8STreehugger Robot     __strong char *filename;
94*7c3d14c8STreehugger Robot     __strong char *compilerPath;
95*7c3d14c8STreehugger Robot     __strong char *errorString;
96*7c3d14c8STreehugger Robot     __strong char *warningString;
97*7c3d14c8STreehugger Robot     NSPointerArray *extraLibraries;
98*7c3d14c8STreehugger Robot }
99*7c3d14c8STreehugger Robot @property bool hasObjC, hasRR, hasGC, hasCPlusPlus, wantsC99, supposedToNotCompile, open, wants32, wants64;
100*7c3d14c8STreehugger Robot @property(assign) __strong char *radar;
101*7c3d14c8STreehugger Robot @property __strong char *filename;
102*7c3d14c8STreehugger Robot @property __strong char *compilerPath;
103*7c3d14c8STreehugger Robot @property __strong char *errorString;
104*7c3d14c8STreehugger Robot @property __strong char *warningString;
105*7c3d14c8STreehugger Robot - (TestFileExe *)lineForOptions:(int)options; // nil if no can do
106*7c3d14c8STreehugger Robot + (NSArray *)generatorsFromFILE:(FILE *)fd;
107*7c3d14c8STreehugger Robot + (NSArray *)generatorsFromPath:(NSString *)path;
108*7c3d14c8STreehugger Robot @end
109*7c3d14c8STreehugger Robot 
110*7c3d14c8STreehugger Robot 
111