Reviewed By: jberdine Differential Revision: D4329214 fbshipit-source-id: 4d4ced5master
parent
b7bf84e757
commit
eafe1158a6
@ -0,0 +1,42 @@
|
||||
# Copyright (c) 2016 - 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.
|
||||
|
||||
TESTS_DIR = ../..
|
||||
|
||||
CMAKE_DIR = ../codetoanalyze/cmake
|
||||
CMAKE_BUILD_DIR = $(CMAKE_DIR)/_build
|
||||
CMAKE_ANALYZE_DIR = $(CMAKE_DIR)/_build_infer
|
||||
|
||||
ANALYZER = infer
|
||||
CLEAN_EXTRA = $(CMAKE_BUILD_DIR) $(CMAKE_ANALYZE_DIR)
|
||||
INFER_OPTIONS = --project-root $(CMAKE_DIR)
|
||||
SOURCES = $(CMAKE_DIR)/hello.c
|
||||
OBJECTS = $(CMAKE_BUILD_DIR)/CMakeFiles/Hello.dir/hello.c.o
|
||||
INFERPRINT_OPTIONS = --issues-tests
|
||||
|
||||
include $(TESTS_DIR)/base.make
|
||||
|
||||
$(CMAKE_BUILD_DIR)/Makefile: $(CMAKE_DIR)/CMakeLists.txt
|
||||
@$(MKDIR_P) $(CMAKE_BUILD_DIR)
|
||||
@cd $(CMAKE_BUILD_DIR) && \
|
||||
$(CMAKE) ..
|
||||
|
||||
$(OBJECTS): $(SOURCES) $(CMAKE_BUILD_DIR)/Makefile
|
||||
cd $(CMAKE_BUILD_DIR) && \
|
||||
$(MAKE)
|
||||
|
||||
infer-out/report.json: $(SOURCES) $(CMAKE_DIR)/CMakeLists.txt $(CLANG_DEPS)
|
||||
# nuke the build dir and recreate everything to avoid stale compilation/analysis results
|
||||
@$(REMOVE_DIR) $(CMAKE_ANALYZE_DIR) && \
|
||||
$(MKDIR_P) $(CMAKE_ANALYZE_DIR) && \
|
||||
cd $(CMAKE_ANALYZE_DIR) && \
|
||||
$(call silent_on_success,\
|
||||
$(INFER_BIN) -a compile $(INFER_OPTIONS) -- cmake ..)
|
||||
$(call silent_on_success,\
|
||||
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -- $(MAKE) -C $(CMAKE_ANALYZE_DIR))
|
||||
# cmake makes all paths absolute
|
||||
@sed -i -e 's#$(abspath $(CMAKE_DIR))/##g' $@
|
@ -0,0 +1 @@
|
||||
hello.c, test, 2, NULL_DEREFERENCE, [start of procedure test()]
|
@ -1,7 +0,0 @@
|
||||
[
|
||||
{
|
||||
"bug_type": "NULL_DEREFERENCE",
|
||||
"file": "hello.c",
|
||||
"procedure": "test"
|
||||
}
|
||||
]
|
Loading…
Reference in new issue