Details
- Reviewers
dcoughlin zaks.anna NoQ - Commits
- rG40eb5130a564: [Analyzer] Document a gotcha: for C++ -analyze-function requires parameters in…
rC314573: [Analyzer] Document a gotcha: for C++ -analyze-function requires parameters in…
rL314573: [Analyzer] Document a gotcha: for C++ -analyze-function requires parameters in…
Diff Detail
- Repository
- rL LLVM
Event Timeline
Yeah, in D22856 i intended -analyze-function to work in pair with -analyzer-display-progress - you can always copy-paste the fully qualified name from there, even if it's an ObjC method or even an anonymous block. But i guess i failed to explain this in D22874.
I suggest something like: "This also works with C++ objects methods, functions in namespaces, and overloaded functions, Objective-C class and instance methods, and even blocks, but in these cases a fully qualified name should be used. Note: In C++ you always need to specify function arguments, even if it is a regular function. If you are not sure how to fully qualify the name, consult how it is displayed in the output of -analyzer-display-progress"
Or maybe just add an example with blocks below your text?:
If you're not sure how to specify function name, consult how -analyzer-display-progress displays it.
It even works with blocks which are anonymous but can be identified by line numbers:
$ clang -cc1 -fblocks -analyze -analyzer-checker=core test.c -analyzer-display-progress ANALYZE (Syntax): test.c foo ANALYZE (Syntax): test.c block (line: 2, col: 25) ANALYZE (Path, Inline_Regular): test.c foo ANALYZE (Path, Inline_Regular): test.c block (line: 2, col: 25) $ clang -cc1 -fblocks -analyze -analyzer-checker=core test.c -analyzer-display-progress -analyze-function "block (line: 2, col: 25)" ANALYZE (Syntax): test.c block (line: 2, col: 25) ANALYZE (Path, Inline_Regular): test.c block (line: 2, col: 25)
@NoQ To clarify: your proposed update is to checker_dev_manual, CC1Options.td stays the same, right?
In an ideal world of course we would like to warn the user if they try to use unqualified name to resolve a C++ identifier.
Or even resolve the name if no overloads exist (which is often the case for tests).
Though that's not the top priority.