Comments (11)
Workaround
Generate a json compilation database
If you add the following parameter to
xctool
:-reporter json-compilation-database:compile_commands.json
xcpretty
:-r json-compilation-database -o compile_commands.json
This'll enable you to use one of the following commands:
Depending on how you generate this file you use one of the following options:
xcpretty
andxctool
:--clang-compilation-db-files-escaped
- reason: the files in the json are escaped : 'file\ with\ spaces'
cmake
:--clang-compilation-db-files
Granted, it'd be a 2 step process, but it'll work 👍
NB Commonly, the build output will be stored in a file called 'xcodebuild.log'. If you need a different reporter for e.g. your test, you can still do that, generate the compile_commands.json
using that log file, and launch infer using that generated compile_commands.json
Concretely:
xctool.sh --<whatever parameters you need> -reporter json-compilation-database:compile_commands.json
orxcodebuild --<whatever parameters> | tee xcodebuild.log | xcpretty -r junit -o junit.xml
as usualcat xcodebuild.log | xcpretty -r json-compilation-database -o compile_commands.json &> /dev/null
- the last part pipes the output to
/dev/null
, as otherwise it'd be displayed on screen again, convoluting your build log.
- the last part pipes the output to
infer --skip-analysis-in-path Pods --clang-compilation-db-files-escaped compile_commands.json
Thanks @jvillard for the assistance 🖖
from infer.
bash-3.2$ infer run --skip-analysis-in-path Pods --compilation-database-escaped compile_commands.json
Capturing using compilation database...
Starting translating and linting 45 files
error: error reading '/Users/ziroom/Library/Developer/Xcode/DerivedData/Example-ghajruwcoslwhscqfuynkquodwys/Index/DataStore'
error: error reading '/Users/ziroom/Library/Developer/Xcode/DerivedData/Example-ghajruwcoslwhscqfuynkquodwys/Index/DataStore'
error: error reading '/Users/ziroom/Library/Developer/Xcode/DerivedData/Example-ghajruwcoslwhscqfuynkquodwys/Index/DataStore'
1 error generated.
1 error generated.
error: error reading '/Users/ziroom/Library/Developer/Xcode/DerivedData/Example-ghajruwcoslwhscqfuynkquodwys/Index/DataStore'
1 error generated.
1 error generated.
Uncaught Internal Error: (Bi_inbuf.End_of_input)
Error backtrace:
Raised at file "src/bi_inbuf.ml", line 49, characters 6-24
Called from file "src/bi_io.ml" (inlined), line 508, characters 12-35
Called from file "atd/clang_ast_b.ml", line 27643, characters 7-24
Called from file "clang/Capture.ml", line 56, characters 8-39
Called from file "clang/Capture.ml" (inlined), line 101, characters 6-35
Called from file "clang/Capture.ml", line 170, characters 26-73
Re-raised at file "istd/IExn.ml" (inlined), line 18, characters 15-63
Called from file "clang/Capture.ml" (inlined), line 102, characters 4-60
from infer.
this sounds like the better option... I certainly see why they specifically excluded options not supported by the open source compiler, but Infer is basically unusable to most of us using xcode and @import
from infer.
xctool still uses clang -- which needs their plugin, which enabled by the open source clang, so ... still won't work unfortunately.
I got pretty far adding xctool myself, but was stopped by the -fmodules
issue
from infer.
+1 . xctool is better than xcodebuild.
from infer.
Thanks for reporting this. I think this should be doable, we'll take a look.
from infer.
@loufranco FYI the @import
issue has been fixed in the latest version of Infer (v0.1.1).
from infer.
+1
from infer.
+1
from infer.
+1
from infer.
Closing as the compilation database approach is the best option there. This workflow has been documented on the infer website.
from infer.
Related Issues (20)
- C Simple memory leak cannot be detected HOT 1
- [java] DEADLOCK: False Negative in Infer analysis results after converting anonymous classes to lambda expressions HOT 1
- [java] STARVATION: False Negative in Infer analysis results after converting anonymous classes to lambda expressions HOT 1
- False positive of Infer/Pulse when `std::unique_ptr` is used with no throw `new` HOT 2
- how to use --custom-symbols?
- How to check custom malloc and free functions for memory leak?
- can infer find out all suspecious bugs? HOT 2
- java: Infer injects outdated, buggy maven-compiler-plugin version 3.8.0
- False positive memory leak on loop HOT 4
- Dockerfile: US-ASCII locale causes crash on UTF-8 input
- How to add extra nullability condition to NULL_DEREFERENCE checking
- Is Adding a C++ Infer Port to the VSCode Plugin on the Roadmap? HOT 3
- [java] A false negative about the rule NULL_DEREFERENCE
- [java] A false positive about the rule THREAD_SAFETY_VIOLATION
- `--biabduction-unsafe-malloc` doesn't assume that `calloc()` and `realloc()` never return null HOT 1
- Error building the `Resource Leak analysis` lab in docker
- False positive Uninitialized Value in C code
- Need help when using infer run or capture during maven compilation HOT 1
- Query on --changed-files-index option HOT 3
- Meta leak HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from infer.