110 lines · c
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-exception5 6//7// testfilerunner.h8// testObjects9//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 have19 RR and GC capabilities20 we assume C++ friendly includes for C/ObjC even if C++ isn't used21 22 23 four compilers: C, ObjC, C++, ObjC++24 and for ObjC or ObjC++ we can compile25 RR, RR+GC, GC+RR, GC26 although to test RR+GC we need to build a shell "main" in both modes27 and/or run with GC disabled if possible.28 29 To maximize coverage we mark files with capabilities and then ask them to be30 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 mode41 DoGCRR = (1 << 7), // -fobjc-gc & run GC mode42 43 //DoDashG = (1 << 8),44 DoDashO = (1 << 9),45 DoDashOs = (1 << 10),46 DoDashO2 = (1 << 11),47 48 DoC99 = (1 << 12), // -std=c9949};50 51 52@class TestFileExeGenerator;53 54// this class will actually compile and/or run a target binary55// XXX we don't track which dynamic libraries requested/used nor set them up56@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@end78 79// this class generates an appropriate set of configurations to compile80// we don't track which gcc we use but we should XXX81@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. unresolved91 __strong char *radar; // for things already known to go wrong92 __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 do105+ (NSArray *)generatorsFromFILE:(FILE *)fd;106+ (NSArray *)generatorsFromPath:(NSString *)path;107@end108 109 110