[objc] Translate ObjCAvailabilityExpr

Reviewed By: sblackshear

Differential Revision: D5940985

fbshipit-source-id: 1e22357
master
Dulma Churchill 7 years ago committed by Facebook Github Bot
parent ea4d97ecf8
commit 67b08f666f

@ -3263,6 +3263,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
-> no_op_trans trans_state.succ_nodes
(* vector instructions for OpenCL etc. we basically ignore these for now; just translate the
sub-expressions *)
| ObjCAvailabilityCheckExpr (_, _, expr_info, _)
-> trans_into_undefined_expr trans_state expr_info
| ExtVectorElementExpr (_, stmts, _)
| ShuffleVectorExpr (_, stmts, _)
| UserDefinedLiteral (_, stmts, _)
@ -3305,7 +3307,6 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
| MSPropertySubscriptExpr _
| NoInitExpr _
| OMPArraySectionExpr _
| ObjCAvailabilityCheckExpr _
| ObjCIsaExpr _
| ObjCSubscriptRefExpr _
| UnresolvedLookupExpr _

@ -48,6 +48,7 @@ SOURCES_DEFAULT = \
shared/memory_leaks_benchmark/MemoryLeakExample.m \
shared/memory_leaks_benchmark/RetainReleaseExample.m \
shared/memory_leaks_benchmark/arc_methods.m \
shared/npe/Available_expr.m \
shared/npe/Nonnull_attribute_example.m \
shared/property/GetterExample.m \
shared/property/PropertyAttributes.m \

@ -125,4 +125,5 @@ codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m, MemoryLeak
codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m, MemoryLeakExample_test1NoLeak, 2, Assert_failure, [start of procedure test1NoLeak]
codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m, MemoryLeakExample_test2:, 1, MEMORY_LEAK, [start of procedure test2:]
codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m, MemoryLeakExample_test2NoLeak, 2, Assert_failure, [start of procedure test2NoLeak]
codetoanalyze/objc/shared/npe/Available_expr.m, Available_expr_test_no_bug, 3, NULL_DEREFERENCE, [start of procedure test_no_bug,Condition is true]
codetoanalyze/objc/shared/npe/Nonnull_attribute_example.m, NonnullC_initWithCoder:and:, 2, UNINITIALIZED_VALUE, [start of procedure initWithCoder:and:,start of procedure getA,return from a call to NonnullA_getA]

@ -26,6 +26,7 @@ SOURCES = \
../shared/block/BlockVar.m \
../shared/memory_leaks_benchmark/ArcExample.m \
../shared/memory_leaks_benchmark/arc_methods.m \
../shared/npe/Available_expr.m \
../shared/npe/Nonnull_attribute_example.m \
include $(TESTS_DIR)/clang-frontend.make

@ -0,0 +1,25 @@
/*
* Copyright (c) 2017 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Foundation/NSObject.h>
@interface Available_expr : NSObject
@end
@implementation Available_expr
- (int)test_no_bug {
int* p = NULL;
if (@available(macOS 10.13, iOS 11.0, *)) {
return *p;
}
return 0;
}
@end

@ -0,0 +1,35 @@
/* @generated */
digraph iCFG {
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_1" [label="1: Start Available_expr_test_no_bug\nFormals: self:Available_expr*\nLocals: p:int* \n DECLARE_LOCALS(&return,&p); [line 17]\n " color=yellow style=filled]
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_1" -> "test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_8" ;
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_2" [label="2: Exit Available_expr_test_no_bug \n " color=yellow style=filled]
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_3" [label="3: Return Stmt \n *&return:int=0 [line 22]\n " shape="box"]
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_3" -> "test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_2" ;
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_4" [label="4: + \n " ]
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_4" -> "test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_3" ;
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_5" [label="5: Prune (true branch) \n PRUNE(n$0, true); [line 19]\n " shape="invhouse"]
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_5" -> "test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_7" ;
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_6" [label="6: Prune (false branch) \n PRUNE(!n$0, false); [line 19]\n " shape="invhouse"]
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_6" -> "test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_4" ;
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_7" [label="7: Return Stmt \n n$1=*&p:int* [line 20]\n n$2=*n$1:int [line 20]\n *&return:int=n$2 [line 20]\n " shape="box"]
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_7" -> "test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_2" ;
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_8" [label="8: DeclStmt \n *&p:int*=null [line 18]\n " shape="box"]
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_8" -> "test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_5" ;
"test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_8" -> "test_no_bug#Available_expr#instance.a4aa786abeb2b17541abfe8ecf02c88f_6" ;
}
Loading…
Cancel
Save