[LLVMdev] sample of running google c++ lint script

reed kotler rkotler at mips.com
Mon Jun 4 17:56:12 PDT 2012


Just as an example, I picked totally at random, one c++ program to run 
the google code style checker.

There are clearly some valid points it found. I think it would good to 
start to adapt this tool
or write a new tool to do style checking and to start to better 
formalize the llvm rules.

I ran it against Target/Target.cpp

Target.cpp:0:  No copyright message found.  You should have a line: 
"Copyright [year] <Copyright Owner>"  [legal/copyright] [5]
Target.cpp:10:  Line ends in whitespace.  Consider deleting these extra 
spaces.  [whitespace/end_of_line] [4]
Target.cpp:22:  Found C++ system header after other header. Should be: 
Target.h, c system, c++ system, other.  [build/include_order] [4]
Target.cpp:24:  Do not use namespace using-directives.  Use 
using-declarations instead.  [build/namespaces] [5]
Target.cpp:26:  Is this a non-const reference? If so, make const or use 
a pointer.  [runtime/references] [2]
Target.cpp:65:  Use int16/int64/etc, rather than the C type long  
[runtime/int] [4]
Target.cpp:69:  Use int16/int64/etc, rather than the C type long  
[runtime/int] [4]
Target.cpp:73:  Use int16/int64/etc, rather than the C type long  
[runtime/int] [4]
Target.cpp:95:  Use int16/int64/etc, rather than the C type long  
[runtime/int] [4]
Target.cpp:100:  Lines should be <= 80 characters long  
[whitespace/line_length] [2]
Target.cpp:100:  Use int16/int64/etc, rather than the C type long  
[runtime/int] [4]
Target.cpp:49:  Add #include <string> for string  
[build/include_what_you_use] [4]
Done processing Target.cpp
Total errors found: 12



More information about the llvm-dev mailing list