Summary:
Two issues in the previous code:
1. We'd just tack on `#compilation-database` so if there already are `#flavors`
in a Buck target then we get a malformed `#flavors#compilation-database`
instead of `#flavors,compilation-database`. There's already code to deal
with that for other flavors (`#infer-capture-all`), so extend and reuse that.
2. The code didn't work if there are spaces in target names (sigh). Harden the
code a bit so that it works. Unfortunately Buck doesn't escape spaces at all
in its `buck targets --show-output` output, so the parsing still relies on
there being no spaces in flavors to work correctly. Sample output:
```
$ buck targets --show-full-output //clang_compilation_database:Hel\ lo#compilation-database
Not using buckd because watchman isn't installed.
[+] PROCESSING BUCK FILES...0.1s [100%] 🐳 New buck daemon
//clang_compilation_database:Hel lo#compilation-database /home/jul/infer/infer/tests/build_systems/codetoanalyze/buck-out/gen/clang_compilation_database/__Hel lo#compilation-database.json
```
Also, some code in codetoanalyze/clang-compilation-database/ didn't compile, so
fix that.
Reviewed By: dulmarod
Differential Revision: D4714338
fbshipit-source-id: b8ae324
master
parent
89a28d4dcc
commit
0548b7bd5e
@ -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.
|
||||||
|
|
||||||
|
TESTS_DIR = ../..
|
||||||
|
|
||||||
|
SOURCE_DIR = ../codetoanalyze
|
||||||
|
|
||||||
|
ANALYZER = infer
|
||||||
|
INFER_OPTIONS = --report-custom-error --developer-mode --project-root $(SOURCE_DIR) --no-failures-allowed
|
||||||
|
SOURCES = $(wildcard $(SOURCE_DIR)/*.cpp $(SOURCE_DIR)/*.h)
|
||||||
|
OBJECTS = '$(SOURCE_DIR)/buck-out/gen/clang_compilation_database/__Hel lo\#compilation-database,x86_64.json'
|
||||||
|
INFERPRINT_OPTIONS = --issues-tests
|
||||||
|
CLEAN_EXTRA = $(SOURCE_DIR)/buck-out
|
||||||
|
|
||||||
|
include $(TESTS_DIR)/base.make
|
||||||
|
|
||||||
|
infer-out/report.json: $(CLANG_DEPS) $(SOURCES)
|
||||||
|
cd $(SOURCE_DIR) && \
|
||||||
|
$(call silent_on_success,\
|
||||||
|
$(INFER_BIN) -a $(ANALYZER) --stats $(INFER_OPTIONS) -o $(CURDIR)/$(@D) \
|
||||||
|
--buck-compilation-database no-deps -- buck build '//clang_compilation_database:Hel lo#x86_64')
|
@ -0,0 +1,4 @@
|
|||||||
|
clang_compilation_database/hello.cpp, test0, 2, NULL_DEREFERENCE, [start of procedure test0()]
|
||||||
|
clang_compilation_database/hello.cpp, test1, 2, NULL_DEREFERENCE, [start of procedure test1(),start of procedure deref1()]
|
||||||
|
clang_compilation_database/hello.cpp, test2, 2, NULL_DEREFERENCE, [start of procedure test2(),start of procedure deref2()]
|
||||||
|
clang_compilation_database/lib3.h, test, 1, NULL_DEREFERENCE, [start of procedure test(),start of procedure deref3()]
|
@ -0,0 +1,9 @@
|
|||||||
|
cxx_library(
|
||||||
|
name = 'Hel lo',
|
||||||
|
srcs = [
|
||||||
|
'hello.cpp', 'lib1.cpp', 'lib2.cpp', 'lib3.cpp',
|
||||||
|
],
|
||||||
|
compiler_flags = [
|
||||||
|
'-std=c++11',
|
||||||
|
],
|
||||||
|
)
|
Loading…
Reference in new issue