Summary: Xcode's compilation databases follows a different convention than cmake's and escape the `"file"` and `"dir"` fields of each unit to make them shell-ready. We need to treat them differently when reading them. This adds a new `--clang-compilation-db-files-escaped` option and makes the code related to reading compilation databases deal correctly with both conventions. Reviewed By: akotulski Differential Revision: D4559239 fbshipit-source-id: 51120aemaster
parent
08aad39050
commit
cfd3770a8b
@ -0,0 +1,32 @@
|
||||
# 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 = ../..
|
||||
|
||||
ANALYZER = infer
|
||||
INFER_OPTIONS = --report-custom-error --developer-mode
|
||||
SOURCES = ../codetoanalyze/path\ with\ spaces/hel\ lo.c
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
CLEAN_EXTRA = compile_commands.json
|
||||
INFERPRINT_OPTIONS = --issues-tests
|
||||
|
||||
include $(TESTS_DIR)/base.make
|
||||
|
||||
../codetoanalyze/path\ with\ spaces/hel\ lo.c: ../codetoanalyze/path_with_spaces/hel_lo.c
|
||||
# make does not want to interpret "$(@D)" in the right way here...
|
||||
$(MKDIR_P) ../codetoanalyze/path\ with\ spaces/
|
||||
@cp "$<" "$@"
|
||||
@touch "$@"
|
||||
|
||||
compile_commands.json: compile_commands.json.in
|
||||
sed -e 's#%pwd%#$(CURDIR)#g' $< > $@ || $(REMOVE) $@
|
||||
|
||||
infer-out/report.json: compile_commands.json $(SOURCES) Makefile \
|
||||
../codetoanalyze/path\ with\ spaces/hel\ lo.c
|
||||
$(call silent_on_success,\
|
||||
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) --project-root $(TESTS_DIR) \
|
||||
--clang-compilation-db-files-escaped $<)
|
@ -0,0 +1,7 @@
|
||||
[
|
||||
{
|
||||
"command" : "clang -c hel\\ lo.c",
|
||||
"directory" : "%pwd%/../codetoanalyze/path\\ with\\ spaces",
|
||||
"file" : "hel\\ lo.c"
|
||||
}
|
||||
]
|
@ -0,0 +1 @@
|
||||
build_systems/codetoanalyze/path with spaces/hel lo.c, test_hel_lo, 2, NULL_DEREFERENCE, [start of procedure test_hel_lo()]
|
Loading…
Reference in new issue