summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Fix FP with readability-redundant-string-init for default argumentsEtienne Bergeron2016-04-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: Clang-tidy is reporting a warning of redundant string initialisation on a string parameter initialized with empty string. See bug: 27087 The reported example is: ``` #include <string> void fn(std::string a = ""); ``` Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18829 llvm-svn: 265671
* [clang-tidy] Assertion fix in misc-misplaced-widening-cast check.Gabor Horvath2016-04-061-3/+3
| | | | llvm-svn: 265544
* [clang-tidy] filter plugins and plugin arguments of the command-lineEtienne Bergeron2016-04-061-16/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch remove the plugin argument from the command-line. Loading plugins was making clang-tidy to fail when running over chromium (linux). Example of a command-line executed when running clang-tidy over chromium (from the compilation database). ``` ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/WebKit/Source/core/fetch/webcore_shared.Resource.o.d -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 -D_FILE_OFFSET_BITS=64 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=264915-1 -DCOMPONENT_BUILD -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_AURA=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_DEFAULT_RENDER_THEME=1 -DUSE_LIBJPEG_TURBO=1 -DUSE_X11=1 -DUSE_CLIPBOARD_AURAX11=1 -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1 -DENABLE_PEPPER_CDMS -DENABLE_NOTIFICATIONS -DENABLE_TOPCHROME_MD=1 -DUSE_UDEV -DFIELDTRIAL_TESTING_ENABLED -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PDF=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_MDNS=1 -DENABLE_SERVICE_DISCOVERY=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DBLINK_CORE_IMPLEMENTATION=1 -DBLINK_IMPLEMENTATION=1 -DINSIDE_BLINK -DGL_GLEXT_PROTOTYPES -DMOJO_USE_SYSTEM_IMPL -DCHROME_PNG_WRITE_SUPPORT -DPNG_USER_CONFIG -DENABLE_LAYOUT_UNIT_IN_INLINE_BOXES=0 -DENABLE_OILPAN=1 -DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1 -DENABLE_INPUT_MULTIPLE_FIELDS_UI=1 -DWTF_USE_ICCJPEG=1 -DWTF_USE_QCMSLIB=1 -DWTF_USE_WEBAUDIO_FFMPEG=1 -DWTF_USE_DEFAULT_RENDER_THEME=1 -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DU_NOEXCEPT= -DSKIA_DLL -DGR_GL_IGNORE_ES3_MSAA=0 -DSK_SUPPORT_GPU=1 -DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS -DLIBXML_STATIC -DLIBXSLT_STATIC -DV8_SHARED -DUSING_V8_SHARED -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_NSS_VERIFIER=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -D_DEBUG -D_GLIBCXX_DEBUG=1 -Igen -I../../third_party/WebKit/Source -Igen/blink -I../../third_party/WebKit -I../../third_party/WebKit/Source/core/testing -I../../third_party/WebKit/Source/core/testing/v8 -I../.. -I../../skia/config -I../../third_party/khronos -I../../gpu -Igen/angle -I../../third_party/angle/include -I../../third_party/ffmpeg -Igen/third_party/WebKit -I../../third_party/iccjpeg -I../../third_party/libpng -I../../third_party/libwebp -I../../third_party/ots/include -I../../third_party/zlib -I../../third_party/libjpeg_turbo -I../../third_party/icu/source/i18n -I../../third_party/icu/source/common -I../../skia/ext -I../../third_party/skia/include/core -I../../third_party/skia/include/effects -I../../third_party/skia/include/pdf -I../../third_party/skia/include/gpu -I../../third_party/skia/include/lazy -I../../third_party/skia/include/pathops -I../../third_party/skia/include/pipe -I../../third_party/skia/include/ports -I../../third_party/skia/include/utils -I../../third_party/libxml/linux/include -I../../third_party/libxml/src/include -I../../third_party/libxslt -I../../third_party/npapi -I../../third_party/npapi/bindings -I../../third_party/qcms/src -I../../third_party/snappy/linux -I../../third_party/snappy/src -I../../v8/include -fstack-protector --param=ssp-buffer-size=4 -Werror -pthread -fno-strict-aliasing -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC -Xclang -load -Xclang /home/etienneb/chromium/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-templates -Xclang -plugin-arg-find-bad-constructs -Xclang follow-macro-expansion -fcolor-diagnostics -B/home/etienneb/chromium/src/third_party/binutils/Linux_x64/Release/bin -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register -Wno-inconsistent-missing-override -Wno-shift-negative-value -Wglobal-constructors -Wexit-time-destructors -fno-strict-aliasing -Xclang -load -Xclang /home/etienneb/chromium/src/third_party/llvm-build/Release+Asserts/lib/libBlinkGCPlugin.so -Xclang -add-plugin -Xclang blink-gc-plugin -Xclang -plugin-arg-blink-gc-plugin -Xclang enable-oilpan -Xclang -plugin-arg-blink-gc-plugin -Xclang warn-raw-ptr -pthread -I/home/etienneb/chromium/src/build/linux/debian_wheezy_amd64-sysroot/usr/include/glib-2.0 -I/home/etienneb/chromium/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib/x86_64-linux-gnu/glib-2.0/include -m64 -march=x86-64 --sysroot=/home/etienneb/chromium/src/build/linux/debian_wheezy_amd64-sysroot -O0 -g -funwind-tables -gsplit-dwarf -g0 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -c ../../third_party/WebKit/Source/core/fetch/Resource.cpp -o obj/third_party/WebKit/Source/core/fetch/webcore_shared.Resource.o ``` The plugins are added with the following arguments: ``` -Xclang -load -Xclang /home/etienneb/chromium/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-templates -Xclang -plugin-arg-find-bad-constructs -Xclang follow-macro-expansion ``` Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18806 llvm-svn: 265542
* [clang-tidy] Extension of checker misc-misplaced-widening-castGabor Horvath2016-04-063-30/+113
| | | | | | | | | | | | | | | | | | Summary: Existing checker misc-misplaced-widening-cast was extended: - New use cases: casted expression as lhs or rhs of a logical comparison or function argument - New types: beside int, long and long long various char types, short and int128 added - New option to check implicit casts: forgetting a cast is at least as common and as dangerous as misplacing it. This option can be disabled. This patch depends on AST Matcher patches D17986 and D18243 and also contains fix for checker misc-bool-pointer-implicit-conversion needed because of the fix in the AST Matcher patch. Reviewers: hokein, alexfh Subscribers: o.gyorgy, xazax.hun, cfe-commits Differential Revision: http://reviews.llvm.org/D17987 llvm-svn: 265532
* [clang-tidy] Add a check to detect static definitions in anonymous namespace.Haojian Wu2016-04-054-0/+111
| | | | | | | | | | | | Summary: Fixes PR26595 Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18180 llvm-svn: 265384
* [clang-tidy] Reduce false-positive ratio in misc-suspicious-missing-comma check.Etienne Bergeron2016-04-042-6/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch is adding detection of common string literal patterns that should not trigger warnings. [*] Add a limit on the number of concatenated token, [*] Add support for parenthese sequence of tokens, [*] Add detection of valid indentation. As an example, this code will no longer trigger a warning: ``` const char* Array[] = { "first literal" "indented literal" "indented literal", "second literal", [...] ``` Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18695 llvm-svn: 265303
* [clang-tidy] fix a couple of modernize-use-override bugsAlexander Kornienko2016-04-041-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix for __declspec attributes and const=0 without space This patch is to address 2 problems I found with Clang-tidy:modernize-use-override. 1: missing spaces on pure function decls. Orig: void pure() const=0 Problem: void pure() constoverride =0 Fixed: void pure() const override =0 2: This is ms-extension specific, but possibly applies to other attribute types. The override is placed before the attribute which doesn’t work well with declspec as this attribute can be inherited or placed before the method identifier. Orig: class __declspec(dllexport) X : public Y { void p(); }; Problem: class override __declspec(dllexport) class X : public Y { void p(); }; Fixed: class __declspec(dllexport) class X : public Y { void p() override; }; Patch by Robert Bolter! Differential Revision: http://reviews.llvm.org/D18396 llvm-svn: 265298
* [clang-tidy] Don't delete unused parameter in class override method in ↵Haojian Wu2016-04-011-10/+12
| | | | | | | | | | | | | | anonymous namespace. Summary: Fixes PR26740. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17926 llvm-svn: 265117
* [clang-tidy] Add a new checker to detect missing comma in initializer list.Etienne Bergeron2016-03-314-0/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This checker is able to detect missing comma in an array of string literals. ``` const char* A[] = { "abc", "def" // missing comma (no compiler warnings) "ghi", }; ``` The ratio of false-positive is reduced by restricting the size of the array considered and the ratio of missing comma. To validate the quantity of false positive, the checker was tried over LLVM and chromium code and detected these cases: [[ http://reviews.llvm.org/D18454 | http://reviews.llvm.org/D18454 ]] [[https://codereview.chromium.org/1807753002/ | https://codereview.chromium.org/1807753002/]] [[https://codereview.chromium.org/1826193002/ | https://codereview.chromium.org/1826193002/]] [[https://codereview.chromium.org/1805713002/ | https://codereview.chromium.org/1805713002/]] Reviewers: alexfh Subscribers: LegalizeAdulthood, szdominik, xazax.hun, cfe-commits Differential Revision: http://reviews.llvm.org/D18457 llvm-svn: 265033
* [clang-tidy] Fix MSVC build.Alexander Kornienko2016-03-301-1/+2
| | | | llvm-svn: 264862
* [clang-tidy] Adjust dangling references check to ASTMatcher changes.Gabor Horvath2016-03-301-9/+10
| | | | llvm-svn: 264859
* [clang-tidy] readability check for const params in declarationsAlexander Kornienko2016-03-304-0/+108
| | | | | | | | | | | | | | Summary: Adds a clang-tidy warning for top-level consts in function declarations. Reviewers: hokein, sbenza, alexfh Subscribers: cfe-commits Patch by Matt Kulukundis! Differential Revision: http://reviews.llvm.org/D18408 llvm-svn: 264856
* [clang-tidy] Add check to detect dangling references in value handlers.Samuel Benzaquen2016-03-294-0/+232
| | | | | | | | | | | | | | | | | | | | | | Summary: Add check misc-dangling-handle to detect dangling references in value handlers like std::experimental::string_view. It provides a configuration option to specify other handle types that should also be checked. Right now it detects: - Construction from temporaries. - Assignment from temporaries. - Return statements from temporaries or locals. - Insertion into containers from temporaries. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17811 llvm-svn: 264759
* [clang-tidy] Add performance check to flag function parameters of expensive ↵Felix Berger2016-03-294-0/+127
| | | | | | | | | | | | to copy types that can be safely converted to const references. Reviewers: alexfh Subscribers: fowles, cfe-commits Differential Revision: http://reviews.llvm.org/D17491 llvm-svn: 264694
* clang-tidy: Add check modernize-raw-string-literalRichard Thomson2016-03-274-0/+189
| | | | llvm-svn: 264539
* [clang-tidy] Add support for different char-types for the ↵Etienne Bergeron2016-03-241-14/+14
| | | | | | | | | | | | | | | | | | | | | readability-redundant-string-cstr checker. Summary: The current checker is able to recognize std::string but does not recognize other string variants. This patch is adding the support for any string defined with basic_string without considering the the underlying char type. The most common variant is: 'std::wstring' based on 'wchar_t'. There are also other string variants added to the standard: u16string, u32string, etc... Reviewers: alexfh Subscribers: mamai, dblaikie, cfe-commits Differential Revision: http://reviews.llvm.org/D18412 llvm-svn: 264325
* [clang-tidy] misc-assign-operator-signature checker checks return value of ↵Gabor Horvath2016-03-241-7/+8
| | | | | | | | | | | | | | all assign operators The return value of every assign operator should be Type&, not only for copy and move assign operators. Patch by Adam Balogh! Reviewers: hokein, alexfh Differential Revision: http://reviews.llvm.org/D18264 llvm-svn: 264251
* Add check for unneeded copies of localsHaojian Wu2016-03-232-29/+88
| | | | | | | | | | | | | | Summary: Extends the UnnecessaryCopyInitialization to detect copies of local variables and parameters that are unneeded. Patch by Matt Kulukundis! Reviewers: alexfh, hokein Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18149 llvm-svn: 264146
* [clang-tidy] Fix redundant-string-cstr check with msvc 14 headers.Etienne Bergeron2016-03-221-19/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The string constructors are not defined using optional parameters and are not recognize by the checker. The constructor defined in the MSVC header is defined with 1 parameter. Therefore, patterns are not recognized by the checker. The current patch add support to accept constructor with only one parameter. Repro on a Visual Studio 14 installation with the following code: ``` void f1(const std::string &s) { f1(s.c_str()); } ``` In the xstring.h header, the constructors are defined this way: ``` basic_string(const _Myt& _Right) [...] basic_string(const _Myt& _Right, const _Alloc& _Al) [...] ``` The CXXConstructExpr to recognize only contains 1 parameter. ``` CXXConstructExpr 0x3f1a070 <C:\src\llvm\examples\test.cc:6:6, col:14> 'const std::string':'const class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char> >' 'void (const char *) __attribute__((thiscall))' `-CXXMemberCallExpr 0x3f1a008 <col:6, col:14> 'const char *' `-MemberExpr 0x3f19fe0 <col:6, col:8> '<bound member function type>' .c_str 0x3cc22f8 `-DeclRefExpr 0x3f19fc8 <col:6> 'const std::string':'const class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char> >' lvalue ParmVar 0x3f19c80 's' 'const std::string &' ``` Reviewers: aaron.ballman, alexfh Subscribers: aemerson Differential Revision: http://reviews.llvm.org/D18285 llvm-svn: 264075
* [clang-tidy] Skip reporting of not applicable fixes.Etienne Bergeron2016-03-221-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Invalid source location are causing clang-tidy to crash when manipulating an invalid file. Macro definitions on the command line have locations in a virtual buffer and therefore don't have a corresponding valid FilePath. A recent patch added path conversion to absolute path. As the FilePath may now be empty, the result of makeAbsolutePath may incorrectly be the folder WorkingDir. The crash occurs in getLocation which is not able to find the appropriate FileEntry (null pointer). ``` SmallString<128> FixAbsoluteFilePath = Fix.getFilePath(); Files.makeAbsolutePath(FixAbsoluteFilePath); FixLoc = getLocation(FixAbsoluteFilePath, Fix.getOffset()); ``` With relative path, the code was not crashing because getLocation was skipping empty path. Example of code: ``` int main() { return X; } ``` With the given command-line: ``` clang-tidy test.cc --checks=misc-macro-* -- -DX=0+0 ``` Reviewers: alexfh, aaron.ballman Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D18262 llvm-svn: 264073
* [clang-tidy] Fix redundant-string-init check with msvc 14 headers.Etienne Bergeron2016-03-221-15/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The string constructors are not defined using optional parameters and are not recognized by the redundant-string-init checker. The following patch fixes the redundant-string-init checker for the Visual Studio 14 headers file. The matcher now accept both variant (with 1 and 2 parameters). Also added new unittests. Similar issue than: [[ http://reviews.llvm.org/D18285 | review ]] In the xstring.h header, the constructors are defined this way: ``` basic_string(const _Myt& _Right) [...] basic_string(const _Myt& _Right, const _Alloc& _Al) [...] ``` Reviewers: alexfh, hokein Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18293 llvm-svn: 264069
* Moving files that were placed in the wrong directory from r264049.Aaron Ballman2016-03-222-60/+0
| | | | llvm-svn: 264050
* Fix crashes from delayed template parsing code that assumed getBody() would ↵Aaron Ballman2016-03-224-8/+71
| | | | | | | | return non-null. Patch by Etienne Bergeron. llvm-svn: 264049
* [clang-tidy] Fix check broken in rL263822.Samuel Benzaquen2016-03-211-1/+2
| | | | | | Add names missing from rL263822 and add tests to prevent future omissions. llvm-svn: 263963
* [clang-tidy] Update check for API change in r263895.Benjamin Kramer2016-03-201-2/+4
| | | | | | | for range stmts now have split begin and ends, just apply OR to the condition. Should unbreak the build. llvm-svn: 263900
* [clang-tidy] Use hasAnyName() instead of matchesName().Samuel Benzaquen2016-03-181-5/+8
| | | | | | | | | matchesName() uses regular expressions and it is very slow. hasAnyName() gives the same result and it is much faster. A benchmark (with all the checks enabled) shows a ~5% speed up of clang-tidy. llvm-svn: 263822
* [clang-tidy] Fix "Name is not a simple identifier" assertion in ↵Haojian Wu2016-03-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | `modernize-loop-convert` check. Summary: Fix assertion failure: "Name is not a simple identifier". `Decl::GetName` assumes the name should be an identifier. When the check processes the function calling statement with speciail key name like 'it.operator->()', it will trigger the assert in `GetName`. Rather than using `Decl::GetName`, we use `getNameAsString` which works with special key names in C++. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18141 llvm-svn: 263426
* [clang-tidy] Make 'modernize-use-nullptr' check ignores NULL marcos used in ↵Haojian Wu2016-03-111-0/+6
| | | | | | | | | | | | other macros. Reviewers: bkramer, alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17958 llvm-svn: 263221
* [docs] Clean up doxygen comments a bit.Alexander Kornienko2016-03-061-23/+23
| | | | llvm-svn: 262787
* [clang-tidy] Extend UnnecessaryCopyInitialization check to trigger on ↵Felix Berger2016-03-058-122/+247
| | | | | | | | | | | | | | | | non-const copies that can be safely converted to const references. Summary: Move code shared between UnnecessaryCopyInitialization and ForRangeCopyCheck into utilities files. Add more test cases for UnnecessaryCopyInitialization and disable fixes inside of macros. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17488 llvm-svn: 262781
* [clang-tidy] Make 'modernize-use-nullptr' check work on multiple nested ↵Haojian Wu2016-03-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit cast expressions. Summary: For some test cases like: ``` int func(int, void*, void*); (double)func(0, 0, 0); ``` The AST contains several `ImplicitCastExpr`s, so we should not only check on the first sub expression. ``` `-CStyleCastExpr 0x7fe43a088938 <line:6:3, col:24> 'double' <NoOp> `-ImplicitCastExpr 0x7fe43a088920 <col:11, col:24> 'double' <IntegralToFloating> `-CallExpr 0x7fe43a0888a0 <col:11, col:24> 'int' |-ImplicitCastExpr 0x7fe43a088888 <col:11> 'int (*)(int, void *, void *)' <FunctionToPointerDecay> | `-DeclRefExpr 0x7fe43a0887d8 <col:11> 'int (int, void *, void *)' lvalue Function 0x7fe43a0886f0 'func1' 'int (int, void *, void *)' |-IntegerLiteral 0x7fe43a088800 <col:17> 'int' 0 |-ImplicitCastExpr 0x7fe43a0888e0 <col:20> 'void *' <NullToPointer> | `-IntegerLiteral 0x7fe43a088820 <col:20> 'int' 0 `-ImplicitCastExpr 0x7fe43a0888f8 <col:23> 'void *' <NullToPointer> `-IntegerLiteral 0x7fe43a088840 <col:23> 'int' 0 ``` Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17849 llvm-svn: 262698
* [clang-tidy] Do not emit warnings from misc-suspicious-semicolon when the ↵Gabor Horvath2016-03-031-1/+4
| | | | | | compilation fails. llvm-svn: 262615
* [clang-tidy] Add "clang-tidy as a clang plugin" skeleton.Benjamin Kramer2016-03-034-0/+144
| | | | | | | | | | | | | | | | | This doesn't really do much at the moment. You can load it via libclang and set the -checks via an extra command line argument as illustrated in the test case. Support for other options (including headers check) is currently missing. Also when using this with libclang some checks may not work with the precompiled preamble in place. This can be used to easily show clang-tidy warnings in an editor integration as all that's needed is adding command line flags that are passed into libclang. Warnings and FixIts are exposed via the existing CXDiagnostic machinery. Differential Revision: http://reviews.llvm.org/D17807 llvm-svn: 262595
* [clang-tidy] Fix an assertion failure of "SLocEntry::getExpansion()" when ↵Haojian Wu2016-03-021-2/+3
| | | | | | | | | | | | | | IncludeInserter handles macro header file. Summary: Also Fixes PR24749. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17805 llvm-svn: 262484
* [clang-tidy] Make 'modernize-pass-by-value' fix work on header files.Haojian Wu2016-03-021-5/+6
| | | | | | | | | | Reviewers: alexfh Subscribers: jbcoe, cfe-commits Differential Revision: http://reviews.llvm.org/D17756 llvm-svn: 262470
* IdentifierNamingCheck.cpp: try to fix MSVC buildHans Wennborg2016-02-291-4/+4
| | | | | | | | | It was failing to build with: clang-tidy\readability\IdentifierNamingCheck.cpp(640): error C2882: 'format' : illegal use of namespace identifier in expression llvm-svn: 262257
* [clang-tidy] Fix an assertion failure in `modernize-use-nullptr` check.Haojian Wu2016-02-261-1/+1
| | | | | | | | | | Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17640 llvm-svn: 262024
* [clang-tidy] Fix a crash issue when clang-tidy runs with compilation database.Haojian Wu2016-02-263-6/+60
| | | | | | | | | | | | | | | | | | | | | Summary: The clang-tidy will trigger an assertion if it's not in the building directory. TEST: cd <llvm-repo>/ ./build/bin/clang-tidy --checks=-*,modernize-use-nullptr -p build tools/clang/tools/extra/clang-tidy/ClangTidy.cpp The crash issue is gone after applying this patch. Fixes PR24834, PR26241 Reviewers: bkramer, alexfh Subscribers: rizsotto.mailinglist, cfe-commits Differential Revision: http://reviews.llvm.org/D17335 llvm-svn: 261991
* Add a new check, readability-redundant-string-init, that checks unnecessary ↵Alexander Kornienko2016-02-256-4/+101
| | | | | | | | | | | | | | string initializations. Reviewers: hokein, alexfh Subscribers: cfe-commits Patch by Shuai Wang! Differential Revision: http://reviews.llvm.org/D17586 llvm-svn: 261939
* [clang-tidy] update links to Google Code Style in docsHaojian Wu2016-02-257-7/+7
| | | | | | | | | | | | | | Summary: Because of the recent Google Code shutdown links to the Google Code Style up there are no longer relevant. Reviewers: alexfh, hokein Subscribers: cfe-commits Patch by Kirill Bobyrev! Differential Revision: http://reviews.llvm.org/D17602 llvm-svn: 261868
* [clang-tidy] Another attempt to fix MSVC buildAlexander Kornienko2016-02-251-13/+17
| | | | llvm-svn: 261811
* Trying to fix MSVC buildAlexander Kornienko2016-02-241-23/+14
| | | | llvm-svn: 261806
* [clang-tidy] introduce modernize-deprecated-headers checkAlexander Kornienko2016-02-244-0/+156
| | | | | | | | | | | | | | | | | Summary: This patch introduces the modernize-deprecated-headers check, which is supposed to replace deprecated C library headers with the C++ STL-ones. For information see documentation; for exmaples see the test cases. Reviewers: Eugene.Zelenko, LegalizeAdulthood, alexfh Subscribers: cfe-commits Patch by Kirill Bobyrev! Differential Revision: http://reviews.llvm.org/D17484 llvm-svn: 261738
* [clang-tidy] Added a check for forward declaration in the potentially wrong ↵Alexander Kornienko2016-02-244-0/+237
| | | | | | | | | | | | | | | | | namespace Adds a new check "misc-forward-declaration-namespace". In check, A forward declaration is considerred in a potentially wrong namespace if there is any definition/declaration with the same name exists in a different namespace. Reviewers: akuegel, hokein, alexfh Patch by Eric Liu! Differential Revision: http://reviews.llvm.org/D17195 llvm-svn: 261737
* Add a new check, cert-env33-c, that diagnoses uses of system(), popen(), and ↵Aaron Ballman2016-02-224-0/+88
| | | | | | _popen() to execute a command processor. This check corresponds to the CERT secure coding rule: https://www.securecoding.cert.org/confluence/pages/viewpage.action?pageId=2130132 llvm-svn: 261530
* Add a new check, cert-flp30-c, that diagnoses loop induction expressions of ↵Aaron Ballman2016-02-194-1/+77
| | | | | | floating-point type. This check corresponds to the CERT secure coding rule: https://www.securecoding.cert.org/confluence/display/c/FLP30-C.+Do+not+use+floating-point+variables+as+loop+counters llvm-svn: 261324
* [clang-tidy] Match the type against the get() method we are calling,Samuel Benzaquen2016-02-171-5/+5
| | | | | | | | | instead of a get() method we find in the class. The duck typed smart pointer class could have overloaded get() methods and we should only skip the one that matches. llvm-svn: 261102
* [clang-tidy] Fix an assert failure in `modernize-loop-convert`.Haojian Wu2016-02-161-1/+3
| | | | | | | | | | | | | | Summary: The test code will trigger following an assert failure: assert.h assertion failed at LoopConvertUtils.cpp:560 in bool clang::tidy::modernize::ForLoopIndexUseVisitor::TraverseMemberExpr(clang::MemberExpr*): ExprType->isPointerType() && "Operator-> returned non-pointer type" Reviewers: alexfh Differential Revision: http://reviews.llvm.org/D17287 llvm-svn: 260953
* [clang-tidy] Fix an assert failure of ForStmt in ↵Haojian Wu2016-02-161-2/+2
| | | | | | | | | | | | `readability-braces-around-statements` check. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17134 llvm-svn: 260952
* [clang-tidy] Enhance modernize-redundant-void-arg check to apply fixes to ↵Alexander Kornienko2016-02-161-22/+10
| | | | | | | | | | | | header files Fixes http://llvm.org/PR25894 Patch by Richard Thomson! Differential revision: http://reviews.llvm.org/D16953 llvm-svn: 260948
OpenPOWER on IntegriCloud