omtcyf0 added a comment.

In http://reviews.llvm.org/D16535#362689, @alexfh wrote:

> In http://reviews.llvm.org/D16535#362685, @omtcyf0 wrote:
>
> > @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>::iterator it = std::begin(numbers),
> >                                     end = std::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?
>
>
> Kirill, the problem in your case may be related to the check seeing 
> incomplete AST due to compilation errors. Can you append `-- -std=c++11` to 
> your clang-tidy invocation and try again whether it will be able to parse the 
> file completely (i.e. without any "file not found" and other compilation 
> errors)?


Yes, you're right, it does suppress the warning.

However, running vanilla `run-clang-tidy.py` on the LLVM codebase still outputs 
such issues. Is it the `run-clang-tidy.py`'s fault? The compilation database 
contains the -std=c++11 specifiers, I assumed this gets added to the clang-tidy 
options while performing analysis of these sources, doesn't it?


Repository:
  rL LLVM

http://reviews.llvm.org/D16535



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to