Index: www/analyzer/faq.html =================================================================== --- www/analyzer/faq.html +++ www/analyzer/faq.html @@ -35,6 +35,7 @@
  • The analyzer assumes that a loop body is never entered. How can I tell it that the loop body will be entered at least once?
  • How can I suppress a specific analyzer warning?
  • How can I selectively exclude code the analyzer examines?
  • +
  • How can I run the analyzer on a single file from the command line?
  • @@ -220,6 +221,32 @@ false positives.

    +

    Q: How can I run the analyzer on a single file from command line?

    + +

    The clang command line option --analyze enables usage on a single +file:

    + +
    +clang --analyze myfile.c
    +
    + +

    All usual clang flags may be used, +e.g. a custom include directory may be specified:

    + +
    +clang --analyze -Iinclude myotherfile.c
    +
    + +

    HTML reports can be generated by passing a command line flag:

    + +
    +clang --analyze -Xclang -analyzer-output=html mythirdfile.c
    +
    + +

    By default, HTML reports are generated in a folder myfile.plist, +where myfile is replaced with a filename of the analyzed translation +unit.

    + Index: www/analyzer/scan-build.html =================================================================== --- www/analyzer/scan-build.html +++ www/analyzer/scan-build.html @@ -43,6 +43,12 @@ the best use of scan-build, which includes getting it to work when the aforementioned hack fails to work.

    +

    But what if I just need to analyze single file?

    + +

    This FAQ +answer +has all the details.

    + scan-build