Specify to clang to use x86_64 to build models and tests for ObjectiveCxx

master
martinoluca 10 years ago
parent c92bfc1093
commit 721cc1957c

@ -43,10 +43,10 @@ $(CPP_MODELS_FILE): $(CPP_MODELS_SOURCES) $(INFERANALYZE) $(INFERCLANG)
make -C $(CPP_MODELS) install make -C $(CPP_MODELS) install
$(OBJC_MODELS_FILE): $(OBJC_MODELS_SOURCES) $(INFERANALYZE) $(INFERCLANG) $(OBJC_MODELS_FILE): $(OBJC_MODELS_SOURCES) $(INFERANALYZE) $(INFERCLANG)
ifeq ($(PLATFORM), Darwin) ifneq (, $(shell which xcode-select 2>&-))
make -C $(OBJC_MODELS) install make -C $(OBJC_MODELS) install
else else
@echo "Platform $(PLATFORM) not supported for objc models, skipping." @echo "Xcode not installed or platform $(PLATFORM) not supported for objc models, skipping."
endif endif
clean: clean:

@ -5,7 +5,7 @@ C_OBJECTS=$(C_SOURCES:.c=.o)
CC=clang CC=clang
XCODE_PATH=$(shell xcode-select -p) XCODE_PATH=$(shell xcode-select -p)
IPHONE_SIMULATOR_PATH=$(XCODE_PATH)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk IPHONE_SIMULATOR_PATH=$(XCODE_PATH)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
FLAGS=-x objective-c -c -mios-simulator-version-min=8.2 -isysroot $(IPHONE_SIMULATOR_PATH) FLAGS=--target=x86_64-apple-darwin14 -x objective-c -c -mios-simulator-version-min=8.2 -isysroot $(IPHONE_SIMULATOR_PATH)
default: test default: test
@ -23,8 +23,8 @@ clean:
rm -rf $(M_OBJECTS) rm -rf $(M_OBJECTS)
rm -rf $(C_OBJECTS) rm -rf $(C_OBJECTS)
.m.o: %.o: %.m
$(CC) $(FLAGS) $< -o $@ $(CC) $(FLAGS) $< -o $@
.c.o: %.o: %.c
$(CC) $(FLAGS) $< -o $@ $(CC) $(FLAGS) $< -o $@

@ -1,5 +1,5 @@
digraph iCFG { digraph iCFG {
32 [label="32: Call _fun___objc_release \n n$23=*&a:class A * [line 70]\n n$24=_fun___objc_release(n$23:class A *) [line 70]\n REMOVE_TEMPS(n$23,n$24); [line 70]\n NULLIFY(&a,false); [line 70]\n APPLY_ABSTRACTION; [line 70]\n " shape="box"] 32 [label="32: Call _fun___objc_release \n n$23=*&a:class A * [line 70]\n _fun___objc_release(n$23:class A *) [line 70]\n REMOVE_TEMPS(n$23); [line 70]\n NULLIFY(&a,false); [line 70]\n APPLY_ABSTRACTION; [line 70]\n " shape="box"]
32 -> 29 ; 32 -> 29 ;

@ -17,7 +17,7 @@
@end @end
void __objc_release(A*); // infer builtin
A* g; A* g;

@ -14,11 +14,11 @@ digraph iCFG {
23 -> 26 ; 23 -> 26 ;
22 [label="22: DeclStmt \n n$13=_fun_NSNumber_numberWithBool:(1:signed char ) [line 37]\n *&n:class NSNumber *=n$13 [line 37]\n REMOVE_TEMPS(n$13); [line 37]\n NULLIFY(&n,false); [line 37]\n " shape="box"] 22 [label="22: DeclStmt \n n$13=_fun_NSNumber_numberWithBool:(1:_Bool ) [line 37]\n *&n:class NSNumber *=n$13 [line 37]\n REMOVE_TEMPS(n$13); [line 37]\n NULLIFY(&n,false); [line 37]\n " shape="box"]
22 -> 21 ; 22 -> 21 ;
21 [label="21: Return Stmt \n n$12=_fun_NSNumber_numberWithBool:(1:signed char ) [line 38]\n *&return:class NSNumber *=n$12 [line 38]\n REMOVE_TEMPS(n$12); [line 38]\n APPLY_ABSTRACTION; [line 38]\n " shape="box"] 21 [label="21: Return Stmt \n n$12=_fun_NSNumber_numberWithBool:(1:_Bool ) [line 38]\n *&return:class NSNumber *=n$12 [line 38]\n REMOVE_TEMPS(n$12); [line 38]\n APPLY_ABSTRACTION; [line 38]\n " shape="box"]
21 -> 20 ; 21 -> 20 ;

@ -3,15 +3,15 @@ digraph iCFG {
11 -> 7 ; 11 -> 7 ;
10 [label="10: ConditinalStmt Branch \n n$4=*&b:signed char [line 24]\n DECLARE_LOCALS(&SIL_temp_conditional___7); [line 24]\n *&SIL_temp_conditional___7:int =n$4 [line 24]\n REMOVE_TEMPS(n$4); [line 24]\n NULLIFY(&b,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] 10 [label="10: ConditinalStmt Branch \n n$4=*&b:_Bool [line 24]\n DECLARE_LOCALS(&SIL_temp_conditional___7); [line 24]\n *&SIL_temp_conditional___7:int =n$4 [line 24]\n REMOVE_TEMPS(n$4); [line 24]\n NULLIFY(&b,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"]
10 -> 7 ; 10 -> 7 ;
9 [label="9: Prune (false branch) \n n$3=*&b:signed char [line 24]\n PRUNE((n$3 == 0), false); [line 24]\n REMOVE_TEMPS(n$3); [line 24]\n " shape="invhouse"] 9 [label="9: Prune (false branch) \n n$3=*&b:_Bool [line 24]\n PRUNE((n$3 == 0), false); [line 24]\n REMOVE_TEMPS(n$3); [line 24]\n " shape="invhouse"]
9 -> 11 ; 9 -> 11 ;
8 [label="8: Prune (true branch) \n n$3=*&b:signed char [line 24]\n PRUNE((n$3 != 0), true); [line 24]\n REMOVE_TEMPS(n$3); [line 24]\n " shape="invhouse"] 8 [label="8: Prune (true branch) \n n$3=*&b:_Bool [line 24]\n PRUNE((n$3 != 0), true); [line 24]\n REMOVE_TEMPS(n$3); [line 24]\n " shape="invhouse"]
8 -> 10 ; 8 -> 10 ;
@ -26,7 +26,7 @@ digraph iCFG {
5 [label="5: Exit A_test5: \n " color=yellow style=filled] 5 [label="5: Exit A_test5: \n " color=yellow style=filled]
4 [label="4: Start A_test5:\nFormals: self:class A * b:signed char \nLocals: \n DECLARE_LOCALS(&return); [line 23]\n " color=yellow style=filled] 4 [label="4: Start A_test5:\nFormals: self:class A * b:_Bool \nLocals: \n DECLARE_LOCALS(&return); [line 23]\n " color=yellow style=filled]
4 -> 8 ; 4 -> 8 ;

@ -1,16 +1,16 @@
digraph iCFG { digraph iCFG {
6 [label="6: BinaryOperatorStmt: Assign \n n$2=*&self:class ASDisplayNode * [line 14]\n n$3=*&opaque:signed char [line 14]\n *n$2._opaque:signed char =n$3 [line 14]\n REMOVE_TEMPS(n$2,n$3); [line 14]\n NULLIFY(&opaque,false); [line 14]\n NULLIFY(&self,false); [line 14]\n APPLY_ABSTRACTION; [line 14]\n " shape="box"] 6 [label="6: BinaryOperatorStmt: Assign \n n$2=*&self:class ASDisplayNode * [line 14]\n n$3=*&opaque:_Bool [line 14]\n *n$2._opaque:_Bool =n$3 [line 14]\n REMOVE_TEMPS(n$2,n$3); [line 14]\n NULLIFY(&opaque,false); [line 14]\n NULLIFY(&self,false); [line 14]\n APPLY_ABSTRACTION; [line 14]\n " shape="box"]
6 -> 5 ; 6 -> 5 ;
5 [label="5: Exit ASDisplayNode_setOpaque: \n " color=yellow style=filled] 5 [label="5: Exit ASDisplayNode_setOpaque: \n " color=yellow style=filled]
4 [label="4: Start ASDisplayNode_setOpaque: (generated)\nFormals: self:class ASDisplayNode * opaque:signed char \nLocals: \n DECLARE_LOCALS(&return); [line 14]\n " color=yellow style=filled] 4 [label="4: Start ASDisplayNode_setOpaque: (generated)\nFormals: self:class ASDisplayNode * opaque:_Bool \nLocals: \n DECLARE_LOCALS(&return); [line 14]\n " color=yellow style=filled]
4 -> 6 ; 4 -> 6 ;
3 [label="3: Return Stmt \n n$0=*&self:class ASDisplayNode * [line 14]\n n$1=*n$0._opaque:signed char [line 14]\n *&return:signed char =n$1 [line 14]\n REMOVE_TEMPS(n$0,n$1); [line 14]\n NULLIFY(&self,false); [line 14]\n APPLY_ABSTRACTION; [line 14]\n " shape="box"] 3 [label="3: Return Stmt \n n$0=*&self:class ASDisplayNode * [line 14]\n n$1=*n$0._opaque:_Bool [line 14]\n *&return:_Bool =n$1 [line 14]\n REMOVE_TEMPS(n$0,n$1); [line 14]\n NULLIFY(&self,false); [line 14]\n APPLY_ABSTRACTION; [line 14]\n " shape="box"]
3 -> 2 ; 3 -> 2 ;

@ -3,7 +3,7 @@ digraph iCFG {
6 -> 5 ; 6 -> 5 ;
5 [label="5: Message Call: setRunning: \n n$3=*&honda:class Car * [line 14]\n _fun_Car_setRunning:(n$3:class Car *,1:signed char ) virtual [line 14]\n REMOVE_TEMPS(n$3); [line 14]\n " shape="box"] 5 [label="5: Message Call: setRunning: \n n$3=*&honda:class Car * [line 14]\n _fun_Car_setRunning:(n$3:class Car *,1:_Bool ) virtual [line 14]\n REMOVE_TEMPS(n$3); [line 14]\n " shape="box"]
5 -> 4 ; 5 -> 4 ;

@ -64,7 +64,7 @@ digraph iCFG {
35 -> 37 ; 35 -> 37 ;
34 [label="34: Return Stmt \n n$15=*&object:class B * [line 80]\n n$14=_fun_B_isC:(n$15:class B *,sizeof(class A ):unsigned long ) virtual [line 80]\n *&return:signed char =n$14 [line 80]\n REMOVE_TEMPS(n$14,n$15); [line 80]\n NULLIFY(&object,false); [line 80]\n APPLY_ABSTRACTION; [line 80]\n " shape="box"] 34 [label="34: Return Stmt \n n$15=*&object:class B * [line 80]\n n$14=_fun_B_isC:(n$15:class B *,sizeof(class A ):unsigned long ) virtual [line 80]\n *&return:_Bool =n$14 [line 80]\n REMOVE_TEMPS(n$14,n$15); [line 80]\n NULLIFY(&object,false); [line 80]\n APPLY_ABSTRACTION; [line 80]\n " shape="box"]
34 -> 33 ; 34 -> 33 ;
@ -170,7 +170,7 @@ digraph iCFG {
6 -> 7 ; 6 -> 7 ;
5 [label="5: Return Stmt \n *&return:signed char =1 [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] 5 [label="5: Return Stmt \n *&return:_Bool =1 [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"]
5 -> 4 ; 5 -> 4 ;

@ -52,7 +52,7 @@ public class InferRunner {
"/dependencies/java/jackson/jackson-2.2.3.jar", "/dependencies/java/jackson/jackson-2.2.3.jar",
}; };
private static final String IOS_ISYSROOT_SUFFIX = private static final String IPHONESIMULATOR_ISYSROOT_SUFFIX =
"/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"; "/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
private static HashMap<String, InferResults> inferResultsMap = private static HashMap<String, InferResults> inferResultsMap =
@ -200,6 +200,7 @@ public class InferRunner {
} }
ImmutableList<String> clangCmd = new ImmutableList.Builder<String>() ImmutableList<String> clangCmd = new ImmutableList.Builder<String>()
.add("clang") .add("clang")
.add("--target=x86_64-apple-darwin14")
.add("-x") .add("-x")
.add(getClangLangOption(lang)) .add(getClangLangOption(lang))
.add(getStdParam(lang)) .add(getStdParam(lang))
@ -279,39 +280,39 @@ public class InferRunner {
public static ImmutableList<String> createObjCInferCommandFrontend( public static ImmutableList<String> createObjCInferCommandFrontend(
TemporaryFolder folder, TemporaryFolder folder,
String sourceFile) { String sourceFile) throws IOException, InterruptedException {
return createClangInferCommand( return createClangInferCommand(
folder, folder,
sourceFile, sourceFile,
Language.ObjC, Language.ObjC,
false, false,
null, getXcodeRoot() + IPHONESIMULATOR_ISYSROOT_SUFFIX,
null, null,
false); false);
} }
public static ImmutableList<String> createObjCInferCommandFrontendArc( public static ImmutableList<String> createObjCInferCommandFrontendArc(
TemporaryFolder folder, TemporaryFolder folder,
String sourceFile) { String sourceFile) throws IOException, InterruptedException {
return createClangInferCommand( return createClangInferCommand(
folder, folder,
sourceFile, sourceFile,
Language.ObjC, Language.ObjC,
false, false,
null, getXcodeRoot() + IPHONESIMULATOR_ISYSROOT_SUFFIX,
null, null,
true); true);
} }
public static ImmutableList<String> createObjCPPInferCommandFrontend( public static ImmutableList<String> createObjCPPInferCommandFrontend(
TemporaryFolder folder, TemporaryFolder folder,
String sourceFile) { String sourceFile) throws IOException, InterruptedException {
return createClangInferCommand( return createClangInferCommand(
folder, folder,
sourceFile, sourceFile,
Language.ObjCPP, Language.ObjCPP,
false, false,
null, getXcodeRoot() + IPHONESIMULATOR_ISYSROOT_SUFFIX,
null, null,
false); false);
} }
@ -344,13 +345,13 @@ public class InferRunner {
public static ImmutableList<String> createObjCInferCommand( public static ImmutableList<String> createObjCInferCommand(
TemporaryFolder folder, TemporaryFolder folder,
String sourceFile) { String sourceFile) throws IOException, InterruptedException {
return createClangInferCommand( return createClangInferCommand(
folder, folder,
sourceFile, sourceFile,
Language.ObjC, Language.ObjC,
true, true,
null, getXcodeRoot() + IPHONESIMULATOR_ISYSROOT_SUFFIX,
null, null,
false); false);
} }
@ -359,26 +360,26 @@ public class InferRunner {
TemporaryFolder folder, TemporaryFolder folder,
String sourceFile, String sourceFile,
String ml_bucket, String ml_bucket,
boolean arc) { boolean arc) throws IOException, InterruptedException {
return createClangInferCommand( return createClangInferCommand(
folder, folder,
sourceFile, sourceFile,
Language.ObjC, Language.ObjC,
true, true,
null, getXcodeRoot() + IPHONESIMULATOR_ISYSROOT_SUFFIX,
ml_bucket, ml_bucket,
arc); arc);
} }
public static ImmutableList<String> createObjCPPInferCommand( public static ImmutableList<String> createObjCPPInferCommand(
TemporaryFolder folder, TemporaryFolder folder,
String sourceFile) { String sourceFile) throws IOException, InterruptedException {
return createClangInferCommand( return createClangInferCommand(
folder, folder,
sourceFile, sourceFile,
Language.ObjCPP, Language.ObjCPP,
true, true,
null, getXcodeRoot() + IPHONESIMULATOR_ISYSROOT_SUFFIX,
null, null,
false); false);
} }
@ -391,7 +392,7 @@ public class InferRunner {
sourceFile, sourceFile,
Language.ObjC, Language.ObjC,
false, false,
getXcodeRoot() + IOS_ISYSROOT_SUFFIX, getXcodeRoot() + IPHONESIMULATOR_ISYSROOT_SUFFIX,
null, null,
false); false);
} }
@ -404,7 +405,7 @@ public class InferRunner {
sourceFile, sourceFile,
Language.ObjC, Language.ObjC,
true, true,
getXcodeRoot() + IOS_ISYSROOT_SUFFIX, getXcodeRoot() + IPHONESIMULATOR_ISYSROOT_SUFFIX,
null, null,
false); false);
} }
@ -419,7 +420,7 @@ public class InferRunner {
sourceFile, sourceFile,
Language.ObjC, Language.ObjC,
true, true,
getXcodeRoot() + IOS_ISYSROOT_SUFFIX, getXcodeRoot() + IPHONESIMULATOR_ISYSROOT_SUFFIX,
bucket, bucket,
arc); arc);
} }

@ -29,7 +29,7 @@ platform=`uname`
if [ -e "$INFER_BIN/InferClang" ]; then if [ -e "$INFER_BIN/InferClang" ]; then
TARGETS_TO_COMPILE+=('clang') TARGETS_TO_COMPILE+=('clang')
TARGETS_TO_TEST+=('c' 'cpp') TARGETS_TO_TEST+=('c' 'cpp')
if [ $platform == 'Darwin' ]; then if command -v xcode-select > /dev/null; then
TARGETS_TO_TEST+=('objc') TARGETS_TO_TEST+=('objc')
fi fi
fi fi

Loading…
Cancel
Save