Summary: @public Make c frontend understand CXXNullPtrLiteralExpr. Note that the implementation differs from GNUNullExpr Test Plan: Create function that returns nullptr: int* getPtr() {return nullptr;} look at specs: InferPrint infer-out/specs/getPtr\{831F\}.specs Procedure: getPtr int *getPtr() Timestamp: 1 Status: INACTIVE Phase: RE_EXECUTION Dependency_map: TIME:0.002853 s TIMEOUT:N SYMOPS:10 CALLS:1,0 ERRORS: --------------------------- 1 of 1 [nvisited: 1] --------------------------- PRE: POST 1 of 1: return = null: ---------------------------------------------------------------- Add test for itmaster
parent
119521bd83
commit
819227d97d
@ -0,0 +1 @@
|
||||
int* getPtr() {return nullptr;}
|
@ -0,0 +1,13 @@
|
||||
digraph iCFG {
|
||||
3 [label="3: Return Stmt \n *&return:int *=null [line 1]\n APPLY_ABSTRACTION; [line 1]\n " shape="box"]
|
||||
|
||||
|
||||
3 -> 2 ;
|
||||
2 [label="2: Exit getPtr \n " color=yellow style=filled]
|
||||
|
||||
|
||||
1 [label="1: Start getPtr\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 1]\n " color=yellow style=filled]
|
||||
|
||||
|
||||
1 -> 3 ;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2013- Facebook.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
package frontend.cpp;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.DebuggableTemporaryFolder;
|
||||
import utils.InferException;
|
||||
import utils.InferRunner;
|
||||
|
||||
public class LiteralsTest {
|
||||
|
||||
@Rule
|
||||
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
||||
|
||||
@Test
|
||||
public void whenCaptureRunCommaThenDotFilesAreTheSame()
|
||||
throws InterruptedException, IOException, InferException {
|
||||
String literal_src =
|
||||
"infer/tests/codetoanalyze/cpp/frontend/literals/nullptr.cpp";
|
||||
|
||||
String literal_dotty =
|
||||
"infer/tests/codetoanalyze/cpp/frontend/literals/nullptr.dot";
|
||||
|
||||
ImmutableList<String> inferCmd =
|
||||
InferRunner.createCPPInferCommandFrontend(
|
||||
folder,
|
||||
literal_src);
|
||||
File newDotFile = InferRunner.runInferFrontend(inferCmd);
|
||||
assertThat(
|
||||
"In the capture of " + literal_src +
|
||||
" the dotty files should be the same.",
|
||||
newDotFile, dotFileEqualTo(literal_dotty));
|
||||
}
|
||||
}
|
Loading…
Reference in new issue