[PATCH] D16535: [clang-tidy] Check to find unintended semicolons that changes the semantics.

Kirill Bobyrev via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 26 04:10:28 PST 2016


omtcyf0 added a subscriber: omtcyf0.
omtcyf0 added a comment.

@xazax.hun did you actually run the tool on the LLVM codebase?

Because this check generates **tons** of false-positive reports during codebase analysis.

See the minimal example below.

  omtcyf0-laptop:playground omtcyf0$ cat main.cpp 
  #include <vector>
  
  int main() {
    std::vector<int> numbers = {1, 2, 3, 4, 5, 6};
    for (std::vector<int>::const_iterator it = begin(numbers), end = end(numbers);
         it != end; ++it) {
      (*it)++;
    }
    return 0;
  }
  omtcyf0-laptop:playground omtcyf0$ /Users/omtcyf0/Documents/dev/build/Release/llvm/bin/clang-tidy -checks=misc-suspicious-semicolon main.cpp 
  Error while trying to load a compilation database:
  Could not auto-detect compilation database for file "main.cpp"
  No compilation database found in /Users/omtcyf0/Documents/dev/playground or any parent directory
  json-compilation-database: Error while opening JSON database: No such file or directory
  Running without flags.
  1 warning and 1 error generated.
  Error while processing /Users/omtcyf0/Documents/dev/playground/main.cpp.
  /Users/omtcyf0/Documents/dev/playground/main.cpp:6:17: warning: potentially unintended semicolon [misc-suspicious-semicolon]
         it != end; ++it) {
                  ^
  /usr/include/wchar.h:89:10: error: 'stdarg.h' file not found [clang-diagnostic-error]
  #include <stdarg.h>
           ^

And this is happening all over the LLVM codebase, because there is nothing bad there.

Can you please fix that?


Repository:
  rL LLVM

http://reviews.llvm.org/D16535





More information about the cfe-commits mailing list