Commit Graph

357 Commits

Author SHA1 Message Date
Samuel Benzaquen 4fa2d57c6d [clang-tidy] Add check misc-multiple-statement-macro
Summary:
The check detects multi-statement macros that are used in unbraced conditionals.
Only the first statement will be part of the conditionals and the rest will fall
outside of it and executed unconditionally.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D18766

llvm-svn: 266369
2016-04-14 21:15:57 +00:00
Etienne Bergeron 47205aa773 [clang-tidy] Fix documentation generation.
Summary: The patch is fixing the generation of clang-tidy documentation.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D19121

llvm-svn: 266333
2016-04-14 16:08:04 +00:00
Alexander Kornienko 855d97e30c Complete support for C++ Core Guidelines Type.6: Always initialize a member variable.
Summary: Added the remaining features needed to satisfy C++ Core Guideline Type.6: Always initialize a member variable to cppcoreguidelines-pro-type-member-init. The check now flags all default-constructed uses of record types without user-provided default constructors that would leave their memory in an undefined state. The check suggests value initializing them instead.

Reviewers: flx, alexfh, aaron.ballman

Subscribers: klimek, aaron.ballman, LegalizeAdulthood, cfe-commits

Patch by Michael Miller!

Differential Revision: http://reviews.llvm.org/D18584

llvm-svn: 266191
2016-04-13 11:35:47 +00:00
Alexander Kornienko 4191b90c75 [clang-tidy] Add a readability-deleted-default clang-tidy check.
Checks if constructors and assignment operators that are marked '= default' are
actually deleted by the compiler.

Patch by Alex Pilkiewicz!

Differential Revision: http://reviews.llvm.org/D18961

llvm-svn: 266190
2016-04-13 11:33:40 +00:00
Eugene Zelenko 2f7ec9134d [Release Notes] Sort checks alphabetically.
llvm-svn: 265813
2016-04-08 17:21:27 +00:00
Alexander Kornienko 477e5d8d31 [clang-tidy] cppcoreguidelines-interfaces-global-init
Summary:
This check flags initializers of globals that access extern objects, and therefore can lead to order-of-initialization problems (this recommandation is part of CPP core guidelines).
Note that this only checks half of the guideline for now (it does not enforce using constexpr functions).

Reviewers: aaron.ballman, alexfh

Subscribers: aaron.ballman, etienneb, Eugene.Zelenko, cfe-commits

Patch by Clement Courbet!

Differential Revision: http://reviews.llvm.org/D18649

llvm-svn: 265774
2016-04-08 09:51:06 +00:00
Eugene Zelenko b869289cf3 Mention readability-static-definition-in-anonymous-namespace in release notes.
Consistency in using ` and ``.

Differential revision: http://reviews.llvm.org/D18797

llvm-svn: 265698
2016-04-07 17:28:35 +00:00
Etienne Bergeron a5fd19ba1e [clang-tidy] add new checker for string literal with NUL character.
Summary:
This patch adds the support for detecting suspicious string
literals and their //incorrect// usage.

The following example shows a incorrect character escaping leading 
to an embedded NUL character. 
```
  std::string str = "\0x42";   // Should be "\x42".
```

The patch also add detection of truncated literal when a literal
is passed to a string constructor.

Reviewers: hokein, alexfh

Subscribers: LegalizeAdulthood, bcraig, Eugene.Zelenko, bkramer, cfe-commits

Differential Revision: http://reviews.llvm.org/D18783

llvm-svn: 265691
2016-04-07 16:16:36 +00:00
Alexander Kornienko b5485b8ade [docs] Update version (http://llvm.org/PR27253)
llvm-svn: 265655
2016-04-07 10:17:23 +00:00
Etienne Bergeron 500846c283 [clang-tidy] fix building clang-tidy documentation.
Summary:
The clang-tidy documentation can't be generated because of broken links.

```
Warning, treated as error:
/home/etienneb/llvm/llvm/tools/clang/tools/extra/docs/clang-tidy/checks/google-readability-function-size.rst:: WARNING: document isn't included in any toctree
```

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D18803

llvm-svn: 265539
2016-04-06 13:57:22 +00:00
Gabor Horvath 5273f615c4 [clang-tidy] Extension of checker misc-misplaced-widening-cast
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
2016-04-06 12:04:51 +00:00
Haojian Wu c253f8b06b [clang-tidy] Add a check to detect static definitions in anonymous namespace.
Summary: Fixes PR26595

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D18180

llvm-svn: 265384
2016-04-05 11:42:08 +00:00
Etienne Bergeron 009ec085db [clang-tidy] Fix documentation of misc-suspicious-missing-comma
Summary:
The clang-tidy documentation generation was broken since commit : http://reviews.llvm.org/D18457

I ran locally the documentation generation and I fixed errors related to that specific check.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D18764

llvm-svn: 265375
2016-04-05 01:41:02 +00:00
Alexander Kornienko 09464e63d8 [clang-tidy] fix a couple of modernize-use-override bugs
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
2016-04-04 14:31:36 +00:00
Eugene Zelenko 71d175b429 [Clang-tidy] Improve checks documentation consistency.
Differential revision: http://reviews.llvm.org/D18717

llvm-svn: 265205
2016-04-02 01:07:18 +00:00
Eugene Zelenko ba539dbad2 Update release notes with list of checks added since 3.8.
Fix some checks documentation style.

Differential revision: http://reviews.llvm.org/D18582

llvm-svn: 265072
2016-03-31 23:09:42 +00:00
Etienne Bergeron 3e4adf1762 [clang-tidy] Add a new checker to detect missing comma in initializer list.
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
2016-03-31 18:12:23 +00:00
Alexander Kornienko f85a69bb6f [docs] Fix a typo, change the style of the clang-tidy release notes a bit.
llvm-svn: 265008
2016-03-31 12:06:54 +00:00
Alexander Kornienko 259ce38315 note for top-level consts in function decls tidy
Summary: Add missing release note

Reviewers: alexfh

Subscribers: LegalizeAdulthood, cfe-commits

Patch by Matt Kulukundis!

Differential Revision: http://reviews.llvm.org/D18608

llvm-svn: 265007
2016-03-31 12:06:47 +00:00
Alexander Kornienko dbe0a1fd92 [docs] Added 3.8 clang-tidy release notes, fixed formatting.
llvm-svn: 264858
2016-03-30 12:05:33 +00:00
Alexander Kornienko e3ae0c6f19 [clang-tidy] readability check for const params in declarations
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
2016-03-30 11:31:33 +00:00
Samuel Benzaquen b2ccba5257 [clang-tidy] Add check to detect dangling references in value handlers.
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
2016-03-29 18:02:26 +00:00
Felix Berger 3c8edde141 [clang-tidy] Add performance check to flag function parameters of expensive 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
2016-03-29 02:42:38 +00:00
Richard Thomson 8930aab886 clang-tidy: Add check modernize-raw-string-literal
llvm-svn: 264539
2016-03-27 16:43:44 +00:00
Richard Thomson f95aa56c79 Add clang-tools-extra release notes
llvm-svn: 264531
2016-03-27 05:06:57 +00:00
Haojian Wu 6ccb1dd9f0 Add check for unneeded copies of locals
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
2016-03-23 09:33:07 +00:00
Felix Berger adfdc14832 [clang-tidy] Extend UnnecessaryCopyInitialization check to trigger on 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
2016-03-05 21:17:58 +00:00
Sylvestre Ledru 0b027eab7a fix some minor typos in the doc
llvm-svn: 262655
2016-03-03 20:57:16 +00:00
Sylvestre Ledru 4098de4062 Fix two minor syntax issues in the documentation
llvm-svn: 262654
2016-03-03 20:54:26 +00:00
Gabor Horvath f4336ac9eb [clang-tidy] Do not emit warnings from misc-suspicious-semicolon when the compilation fails.
llvm-svn: 262615
2016-03-03 13:08:11 +00:00
Alexander Kornienko c1f7f1a31f [docs] Fix docs to work with doxygen 1.8.11
llvm-svn: 262605
2016-03-03 10:45:59 +00:00
Gabor Horvath 577ad5f8b8 [clang-tidy] Documentation fixes.
llvm-svn: 262601
2016-03-03 10:27:32 +00:00
Alexander Kornienko 5d84978251 [clang-tidy] Minor change in the doc
llvm-svn: 261998
2016-02-26 10:24:29 +00:00
Alexander Kornienko 274220cda2 Remove a blank line at EOF. NFC
llvm-svn: 261940
2016-02-25 23:57:30 +00:00
Alexander Kornienko 1612fa07d3 Add a new check, readability-redundant-string-init, that checks unnecessary string initializations.
Reviewers: hokein, alexfh

Subscribers: cfe-commits

Patch by Shuai Wang!

Differential Revision: http://reviews.llvm.org/D17586

llvm-svn: 261939
2016-02-25 23:57:23 +00:00
Haojian Wu bd63972cff [clang-tidy] update links to Google Code Style in docs
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
2016-02-25 14:31:10 +00:00
Alexander Kornienko e4a75fd896 [clang-tidy] introduce modernize-deprecated-headers check
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
2016-02-24 13:36:34 +00:00
Alexander Kornienko ea9fd99215 [clang-tidy] Added a check for forward declaration in the potentially wrong 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
2016-02-24 13:35:32 +00:00
Alexander Kornienko 6bb4b88216 [clang-tidy] Updated docs on testing clang-tidy checks.
llvm-svn: 261622
2016-02-23 09:30:20 +00:00
Aaron Ballman 527a420550 Add a new check, cert-env33-c, that diagnoses uses of system(), popen(), and _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
2016-02-22 16:01:06 +00:00
Alexander Kornienko 10f3cf54cb [clang-tidy] Describe modules, link to LLVM development docs, other minor updates
llvm-svn: 261431
2016-02-20 11:42:13 +00:00
Aaron Ballman 611d2e4ee6 Add a new check, cert-flp30-c, that diagnoses loop induction expressions of 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
2016-02-19 14:03:20 +00:00
Sylvestre Ledru 4e89611168 fix an indent issue in the doc which causes sphinx to fail with some versions
llvm-svn: 260912
2016-02-15 20:38:54 +00:00
Felix Berger ffae543b39 [clang-tidy] ClangTidy check to flag uninitialized builtin and pointer fields.
Summary:
This patch is a continuation of http://reviews.llvm.org/D10553 by Jonathan B Coe.

The main additions are:

1. For C++11 the check suggests in-class field initialization as fix. This
makes the fields future proof towards the addition of new constructors.
2 For older language versions the fields are added in the right position
in the initializer list with more tests.
3. User documentation.

Reviewers: alexfh, jbcoe

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16517

llvm-svn: 260873
2016-02-15 04:27:56 +00:00
Felix Berger 1429412fe3 Improve documentation
llvm-svn: 260869
2016-02-15 03:27:54 +00:00
Samuel Benzaquen 51e1523d70 [clang-tidy] Add check performance-faster-string-find
Summary:
Add check performance-faster-string-find.
It replaces single character string literals to character literals in calls to string::find and friends.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16152

llvm-svn: 260712
2016-02-12 19:28:14 +00:00
Aaron Ballman f034a8c7d7 Reapply r260096.
Expand the simplify boolean expression check to handle implicit conversion of integral types to bool and improve the handling of implicit conversion of member pointers to bool.

Implicit conversion of member pointers are replaced with explicit comparisons to nullptr.

Implicit conversions of integral types are replaced with explicit comparisons to 0.

Patch by Richard Thomson.

llvm-svn: 260681
2016-02-12 15:09:05 +00:00
Gabor Horvath 8b6434e56e [clang-tidy] Add a check to find unintended semicolons that changes the semantics.
Reviewers: hokein, alexfh

Differential Revision: http://reviews.llvm.org/D16535

llvm-svn: 260503
2016-02-11 09:23:33 +00:00
Daniel Marjamaki ad3293744a [clang-tidy] Add 'misc-misplaced-widening-cast' check.
Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16310

llvm-svn: 260223
2016-02-09 14:08:49 +00:00
Haojian Wu 1e3c32b38a [clang-tidy] Fix assertion failure on `at` function in modernize-loop-convert.
Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16926

llvm-svn: 260107
2016-02-08 15:59:42 +00:00
Alexander Kornienko c1587dcf4d [clang-tidy] Reshuffled paragraphs a bit, added contents.
llvm-svn: 260100
2016-02-08 15:09:39 +00:00
Alexander Kornienko 7193d9fa95 [clang-tidy] Fix an error in .rst
llvm-svn: 260099
2016-02-08 15:09:34 +00:00
Alexander Kornienko a7faa5b92a [clang-tidy] Update documentation
Summary: We have 2 scripts add_new_check.py and rename_check.py to bootstrap a new check creation. There is also clang-query to aid with the matcher creation. These were not mentioned in the current document, add them so it's available to the masses.

Reviewers: alexfh

Patch by Deniz Türkoglu!

Differential Revision: http://reviews.llvm.org/D16944

llvm-svn: 260098
2016-02-08 15:09:28 +00:00
Aaron Ballman 54391c8ca6 Reverting r260096; it causes build bot failures:
http://bb.pgr.jp/builders/cmake-clang-tools-x86_64-linux/builds/23351
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/492

llvm-svn: 260097
2016-02-08 14:37:56 +00:00
Aaron Ballman f4490cab0d Expand the simplify boolean expression check to handle implicit conversion of integral types to bool and improve the handling of implicit conversion of member pointers to bool.
Implicit conversion of member pointers are replaced with explicit comparisons to nullptr.

Implicit conversions of integral types are replaced with explicit comparisons to 0.

Patch by Richard Thomson.

llvm-svn: 260096
2016-02-08 14:25:25 +00:00
Haojian Wu 25779e404b [clang-tidy] Move incorrect-roundings to upstream.
Summary: This is originally implemented by Jacques Pienaar.

Reviewers: alexfh

Subscribers: cfe-commits, jpienaar

Differential Revision: http://reviews.llvm.org/D16764

llvm-svn: 260084
2016-02-08 10:16:13 +00:00
Alexander Kornienko f1d54eb222 [clang-tidy] Reformatted docs + minor updates
llvm-svn: 260065
2016-02-08 00:19:29 +00:00
Alexander Kornienko 26e46d8fae [clang-tidy] Add non-constant references in function parameters check.
Summary: This is implemented originally by Alexander Kornienko.

Reviewers: alexfh

Subscribers: cfe-commits


Patch by Haojian Wu!

Differential Revision: http://reviews.llvm.org/D16717

llvm-svn: 259530
2016-02-02 17:27:01 +00:00
Aaron Ballman c3975b7d6a Add a new check, readability-redundant-control-flow, that check for some forms of redundant control flow statements. Currently checks for return statements at the end of a function with a void return type and continue statements at the end of looping statements.
Patch by Richard Thomson.

llvm-svn: 259362
2016-02-01 15:31:15 +00:00
Alexander Kornienko 5aebfe2e4a [clang-tidy] ForRangeCopyCheck that warns on and fixes unnecessary copies of loop variables.
Patch by Felix Berger!

Differential revision: http://reviews.llvm.org/D13849

llvm-svn: 259199
2016-01-29 15:54:26 +00:00
Alexander Kornienko 8ac20a8439 Fixed function params comparison. Updated docs and tests.
Summary: "checkParamTypes" may fail if the the type of some parameter is not canonical. Fixed it by comparing canonical types. And added "getCanonicalType()" and "getCanonicalDecl()" on more places to prevent potential fail.

Reviewers: alexfh

Subscribers: cfe-commits

Patch by Cong Liu!

Differential Revision: http://reviews.llvm.org/D16587

llvm-svn: 259197
2016-01-29 15:22:10 +00:00
Alexander Kornienko 40d307d120 [clang-tidy] Move implicit-cast-in-loop check to upstream.
Summary: This is implemented originally by Alex Pilkiewicz (pilki@google.com).

Reviewers: alexfh

Subscribers: cfe-commits

Patch by Haojian Wu!

Differential Revision: http://reviews.llvm.org/D16721

llvm-svn: 259195
2016-01-29 15:21:32 +00:00
Hans Wennborg 14bf877e6b docs/conf.py: update copyright year
llvm-svn: 258960
2016-01-27 18:29:16 +00:00
Alexander Kornienko 1b290adc43 [clang-tidy] Fix documentation.
Fixed broken links to cppcoreguidelines (anchors specified in the .md file
should be used, not automatic anchors generated by github).

Fixed formatting, array_view -> span, fixed sphinx errors in
misc-definitions-in-headers.rst.

llvm-svn: 258926
2016-01-27 11:37:19 +00:00
Alexander Kornienko e267dafc13 [clang-tidy] Use relative URL for redirection.
llvm-svn: 258925
2016-01-27 11:37:12 +00:00
Alexander Kornienko ad166f5dcc Add clang-tools-extra documentation to the CMake build.
llvm-svn: 258924
2016-01-27 11:37:08 +00:00
Chris Bieneman 2cc7fec76a Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"Now I am become Death, the destroyer of worlds."
-J. Robert Oppenheimer

Reviewers: chandlerc, grosbach, bob.wilson, echristo

Subscribers: cfe-commits, klimek

Differential Revision: http://reviews.llvm.org/D16475

llvm-svn: 258864
2016-01-26 21:31:36 +00:00
Alexander Kornienko e04dd2525c [clang-tidy] Python scripts shebang fixes
Summary:
This patch fixes shebang lines in Python script files.

Most Python scripts in LLVM & Clang are using this shebang line.

[[ https://mail.python.org/pipermail/tutor/2007-June/054816.html | Here]] is an explanaiton of why such line should be used instead of what is currently in these few files.

Reviewers: klimek, alexfh

Subscribers: cfe-commits

Patch by Kirill Bobyrev!

Differential Revision: http://reviews.llvm.org/D16270

llvm-svn: 258133
2016-01-19 16:10:39 +00:00
Alexander Kornienko 3c95377eb1 [clang-tidy] Fixed wording ("clang-tidy check", not "clang-tidy checker")
llvm-svn: 258098
2016-01-18 22:51:09 +00:00
Jonathan Roelofs d60388a985 Teach clang-tidy how to upgrade warnings into errors.
Similar in format to the `-checks=` argument, this new `-warnings-as-errors=`
argument upgrades any warnings emitted by the former to errors.

http://reviews.llvm.org/D15528

llvm-svn: 257642
2016-01-13 17:36:41 +00:00
Alexander Kornienko 98ba0813e6 Support virtual-near-miss check.
Summary: Virtual function override near miss detection. Function complete. Test complete. Do not conduct Fix for now.

Reviewers: alexfh

Subscribers: cfe-commits

Patch by Cong Liu!

Differential Revision: http://reviews.llvm.org/D15823

llvm-svn: 257599
2016-01-13 14:16:35 +00:00
Aaron Ballman f5f9bf415c Add documentation redirects for clang-tidy checkers that are exposed under multiple checker names. Updates the Python script for adding checks to properly handle these aliases.
llvm-svn: 257347
2016-01-11 16:48:26 +00:00
Alexander Kornienko b816ba0fb3 [clang-tidy] Add non-inline function definition and variable definition check in header files.
Summary: The new check will find all functionand variable definitions which may violate cpp one definition rule in header file.

Reviewers: aaron.ballman, alexfh

Subscribers: aaron.ballman, cfe-commits

Patch by Haojian Wu!

Differential Revision: http://reviews.llvm.org/D15710

llvm-svn: 257178
2016-01-08 16:37:11 +00:00
Eugene Zelenko 2f5baba613 Fix typo.
llvm-svn: 256780
2016-01-04 21:25:10 +00:00
Alexander Kornienko 1daf4cbc74 [clang-tidy] Fix capitalization of the message in the example
llvm-svn: 256559
2015-12-29 13:28:10 +00:00
Aaron Ballman 5910a00039 Orphaning these RST files; each one is retained only for link backwards compatibility.
llvm-svn: 256517
2015-12-28 19:59:15 +00:00
Aaron Ballman a6ab2efed2 Renaming CERT documentation files to use the CERT rule identifiers. This is for consistency with other checkers, where the documentation file name matches the checker name. NFC of the checkers.
llvm-svn: 256474
2015-12-27 19:14:55 +00:00
Alexander Kornienko ef064f8ace [clang-tidy] Added documentation for modernize-redundant-void-arg
llvm-svn: 256261
2015-12-22 18:13:00 +00:00
Alexander Kornienko 785e5223d3 [clang-tidy] Updates to documentation: formatting, titles, etc.
llvm-svn: 256259
2015-12-22 17:36:49 +00:00
Alexander Kornienko 677f3fb215 Updated year (2014-2015).
llvm-svn: 256254
2015-12-22 17:10:34 +00:00
Alexander Kornienko b60d291d79 [clang-tools-extra] Text formatting
llvm-svn: 256253
2015-12-22 17:08:57 +00:00
Alexander Kornienko 23f04fd469 Remove clang-modernize.
Summary:
clang-modernize transforms have moved to clang-tidy. Removing
the old tool now.

Reviewers: klimek

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D15606

llvm-svn: 255886
2015-12-17 11:49:19 +00:00
Gabor Horvath 454564a2d9 [clang-tidy] Check for suspicious string assignments.
It is possible to assign arbitrary integer types to strings.
Sometimes it is the result of missing to_string call or apostrophes.

Reviewers: alexfh

Differential Revision: http://reviews.llvm.org/D15411

llvm-svn: 255630
2015-12-15 08:47:20 +00:00
Matthias Gehre 37f10a0c25 [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index
Summary:
This is http://reviews.llvm.org/D13746 but instead of including <array>,
a stub is provided.
This check flags all array subscriptions on static arrays and
std::arrays that either have a non-compile-time-constant index or are
out of bounds.

Dynamic accesses into arrays are difficult for both tools and humans to
validate as safe. array_view is a bounds-checked, safe type for
accessing arrays of data. at() is another alternative that ensures
single accesses are bounds-checked. If iterators are needed to access an
array, use the iterators from an array_view constructed over the array.

This rule is part of the "Bounds safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds2-only-index-into-arrays-using-constant-expressions

Reviewers: alexfh, sbenza, bkramer, aaron.ballman

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D15030

llvm-svn: 255470
2015-12-13 22:08:26 +00:00
Aaron Ballman 43aef4cb9b Add a new checker, cert-err58-cpp, that checks for static or thread_local objects that use a throwing constructor.
This check corresponds to the CERT secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/ERR58-CPP.+Constructors+of+objects+with+static+or+thread+storage+duration+must+not+throw+exceptions

llvm-svn: 254415
2015-12-01 14:05:39 +00:00
NAKAMURA Takumi 67361cc2e1 Revert r253401, "[clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index"
cppcoreguidelines-pro-bounds-constant-array-index.cpp is failing in several hosts.

llvm-svn: 253428
2015-11-18 02:14:35 +00:00
Matthias Gehre 55020566ed [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index
Summary:
This check flags all array subscriptions on static arrays and
std::arrays that either have a non-compile-time-constant index or are
out of bounds.

Dynamic accesses into arrays are difficult for both tools and humans to
validate as safe. array_view is a bounds-checked, safe type for
accessing arrays of data. at() is another alternative that ensures
single accesses are bounds-checked. If iterators are needed to access an
array, use the iterators from an array_view constructed over the array.

This rule is part of the "Bounds safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds2-only-index-into-arrays-using-constant-expressions

Reviewers: alexfh, sbenza, bkramer, aaron.ballman

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13746

llvm-svn: 253401
2015-11-17 23:43:20 +00:00
Aaron Ballman 5a786ddf4c Add a new clang-tidy checker that flags throw expressions whose thrown type is not nothrow copy constructible. While the compiler is free to elide copy constructor calls in some cases, it is under no obligation to do so, which makes the code a portability concern as well as a security concern.
This checker corresponds to the CERT secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/ERR60-CPP.+Exception+objects+must+be+nothrow+copy+constructible

llvm-svn: 253246
2015-11-16 19:17:43 +00:00
Aaron Ballman e8607ef204 Rewording some of this documentation to describe the check instead of try to rationalize the behavior of the check. The links already provide sufficient rationale.
llvm-svn: 252496
2015-11-09 18:04:34 +00:00
Matthias Gehre eeb71758cc [clang-tidy] add new check cppcoreguidelines-pro-type-cstyle-cast
Summary:
This check flags all use of c-style casts that perform a static_cast
downcast, const_cast, or reinterpret_cast.

Use of these casts can violate type safety and cause the program to
access a
variable that is actually of type X to be accessed as if it were of an
unrelated type Z. Note that a C-style (T)expression cast means to
perform
the first of the following that is possible: a const_cast, a
static_cast, a
static_cast followed by a const_cast, a reinterpret_cast, or a
reinterpret_cast followed by a const_cast. This rule bans (T)expression
only when used to perform an unsafe cast.

This rule is part of the "Type safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type4-dont-use-c-style-texpression-casts-that-would-perform-a-static_cast-downcast-const_cast-or-reinterpret_cast.

Reviewers: alexfh, sbenza, bkramer, aaron.ballman

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D14096

llvm-svn: 252425
2015-11-08 21:10:39 +00:00
Matthias Gehre f33319699d [clang-tidy] Add new check cppcoreguidelines-pro-bounds-array-to-pointer-decay
Summary:
This check flags all array to pointer decays.

Pointers should not be used as arrays. array_view is a bounds-checked,
safe alternative to using pointers to access arrays.

This rule is part of the "Bounds safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds3-no-array-to-pointer-decay

Reviewers: alexfh, sbenza, bkramer, aaron.ballman

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13640

llvm-svn: 251358
2015-10-26 21:56:02 +00:00
Piotr Dziwinski 7f1b5099d7 [clang-tidy] Add check readability-implicit-bool-cast
Summary:
This is another check that I ported to clang-tidy from colobot-lint tool.

As previously discussed on cfe-dev mailing list, this is one of those
checks that I think is general and useful enough for contribution to
clang-tidy.

This patch contains implementation of check taken from colobot-lint, but
it is extended a great deal, including FixIt hints for automated
refactoring, exhaustive testcases, and user documentation.

Reviewers: sbenza, aaron.ballman, alexfh

Subscribers: Eugene.Zelenko

Differential Revision: http://reviews.llvm.org/D13635

llvm-svn: 251235
2015-10-25 15:31:25 +00:00
Matthias Gehre 27da23464f [clang-tidy] add check cppcoreguidelines-pro-type-vararg
Summary:
This check flags all calls to c-style vararg functions and all use
of va_list, va_start and va_arg.

Passing to varargs assumes the correct type will be read. This is
fragile because it cannot generally be enforced to be safe in the
language and so relies on programmer discipline to get it right.

This rule is part of the "Type safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type8-avoid-reading-from-varargs-or-passing-vararg-arguments-prefer-variadic-template-parameters-instead

This commits also reverts
  "[clang-tidy] add cert's VariadicFunctionDefCheck as cppcoreguidelines-pro-type-vararg-def"
because that check makes the SFINAE use of vararg functions impossible.

Reviewers: alexfh, sbenza, bkramer, aaron.ballman

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13787

llvm-svn: 250939
2015-10-21 20:09:02 +00:00
Angel Garcia Gomez 8dedeb0230 Add modernize-use-default check to clang-tidy.
Summary:
Add a check that replaces empty bodies of special member functions with '= default;'.
For now, it is only implemented for the default constructor and the destructor, which are the easier cases.
The copy-constructor and the copy-assignment operator cases will be implemented later.

I applied this check to the llvm code base and found 627 warnings (385 in llvm, 9 in compiler-rt, 220 in clang and 13 in clang-tools-extra).
Applying the fixes didn't break any build or test, it only caused a -Wpedantic warning in lib/Target/Mips/MipsOptionRecord.h:33 becaused it replaced
virtual ~MipsOptionRecord(){}; to virtual ~MipsOptionRecord()= default;;

Reviewers: klimek

Subscribers: george.burgess.iv, Eugene.Zelenko, alexfh, cfe-commits

Differential Revision: http://reviews.llvm.org/D13871

llvm-svn: 250897
2015-10-21 12:58:15 +00:00
Samuel Benzaquen daef163199 Added check uniqueptr-delete-release to replace "delete x.release()" with "x = nullptr"
Reviewers: alexfh

Differential Revision: http://reviews.llvm.org/D13179

llvm-svn: 250742
2015-10-19 21:49:51 +00:00
Matthias Gehre b785407c28 [clang-tidy] add check cppcoreguidelines-pro-type-union-access
Summary:
This check flags all access to members of unions. Passing unions as a
whole is not flagged.

Reading from a union member assumes that member was the last one
written, and writing to a union member assumes another member with a
nontrivial destructor had its destructor called. This is fragile because
it cannot generally be enforced to be safe in the language and so relies
on programmer discipline to get it right.

This rule is part of the "Type safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type7-avoid-accessing-members-of-raw-unions-prefer-variant-instead

Reviewers: alexfh, sbenza, bkramer, aaron.ballman

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13784

llvm-svn: 250537
2015-10-16 18:46:30 +00:00
Aaron Ballman af0159bafb Updating the documentation for the readability-inconsistent-declaration-parameter-name checker.
Patch by Piotr Dziwinski.

llvm-svn: 250194
2015-10-13 18:13:10 +00:00
Matthias Gehre dc48412c93 [clang-tidy] new check cppcoreguidelines-pro-bounds-pointer-arithmetic
Summary:
This check flags all usage of pointer arithmetic, because it could lead
to an
invalid pointer.
Subtraction of two pointers is not flagged by this check.

Pointers should only refer to single objects, and pointer arithmetic is
fragile and easy to get wrong. array_view is a bounds-checked, safe type
for accessing arrays of data.

This rule is part of the "Bounds safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds1-dont-use-pointer-arithmetic-use-array_view-instead

Depends on D13313

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13311

llvm-svn: 250116
2015-10-12 21:53:19 +00:00
Matthias Gehre a704d4bb27 [clang-tidy] add check cppcoreguidelines-pro-type-static-cast-downcast
Summary:
This check flags all usages of static_cast, where a base class is casted
to a derived class.
In those cases, a fixit is provided to convert the cast to a
dynamic_cast.

Use of these casts can violate type safety and cause the program to
access a variable that is actually of type X to be accessed as if it
were of an unrelated type Z.

This rule is part of the "Type safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type2-dont-use-static_cast-downcasts-use-dynamic_cast-instead

Depends on D13313

Reviewers: alexfh, sbenza, bkramer, aaron.ballman

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13368

llvm-svn: 250098
2015-10-12 20:46:53 +00:00
Aaron Ballman 20c1971db3 Added documentation for misc-throw-by-value-catch-by-reference.
Patch by Tobias Langner.

llvm-svn: 250034
2015-10-12 12:57:55 +00:00
Aaron Ballman e4b1765a0f Adding a checker (cert-err52-cpp) that detects use of setjmp or longjmp in C++ code. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/pages/viewpage.action?pageId=1834
llvm-svn: 249727
2015-10-08 19:54:43 +00:00
Aaron Ballman 0bf129823a Add checker for the C++ Core Guidelines: cppcoreguidelines-pro-type-const-cast.
Patch by Matthias Gehre!

llvm-svn: 249540
2015-10-07 12:24:57 +00:00
Aaron Ballman fc4e042bf5 Improved the misc-move-constructor-init check to identify arguments that are passed by value but copy assigned to class data members when the non-deleted move constructor is a better fit.
Patch by Felix Berger!

llvm-svn: 249429
2015-10-06 16:27:03 +00:00
Aaron Ballman aaa4080d21 Add a new module for the C++ Core Guidelines, and the first checker for those guidelines: cppcoreguidelines-pro-type-reinterpret-cast.
Patch by Matthias Gehre!

llvm-svn: 249399
2015-10-06 13:31:00 +00:00
Aaron Ballman 46bc30472b Adding a checker (cert-dcl50-cpp) that detects the definition of a C-style variadic function in C++ code. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/DCL50-CPP.+Do+not+define+a+C-style+variadic+function
llvm-svn: 249343
2015-10-05 20:08:59 +00:00
Angel Garcia Gomez 05ca3ec7d0 Update clang-tidy documentation.
Summary:
Improve modernize-use-auto documentation (https://llvm.org/bugs/show_bug.cgi?id=24962).
Add documentation for modernize-make-unique.

Reviewers: klimek

Subscribers: cfe-commits, alexfh

Differential Revision: http://reviews.llvm.org/D13346

llvm-svn: 249017
2015-10-01 14:50:40 +00:00
Aaron Ballman 8db15e4a4d Adding a checker (misc-non-copyable-objects) that detects situations where a non-copyable C type is being dereferenced, such as FILE or pthread_mutex_t. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/c/FIO38-C.+Do+not+copy+a+FILE+object
llvm-svn: 248907
2015-09-30 14:09:38 +00:00
Aaron Ballman de34985caa Adding a checker (misc-new-delete-overloads) that detects mismatched overloads of operator new and operator delete. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/DCL54-CPP.+Overload+allocation+and+deallocation+functions+as+a+pair+in+the+same+scope
llvm-svn: 248791
2015-09-29 13:12:21 +00:00
Aaron Ballman 176a1a3931 Fixing a sphinx warning.
llvm-svn: 248729
2015-09-28 19:27:37 +00:00
Alexander Kornienko 501e6cd283 [clang-tidy] Removed a stray empty line in the docs.
llvm-svn: 248699
2015-09-28 08:52:55 +00:00
Alexander Kornienko 91b53846f7 [clang-tidy] Updated misc-unused-raii documentation.
llvm-svn: 248594
2015-09-25 17:50:11 +00:00
Angel Garcia Gomez 415af0184c Replace references to "transform" with references to "check" where neccessary in the documentation.
Summary: Replace references to "transform" with references to "check" where neccessary in the documentation.

Reviewers: alexfh

Subscribers: cfe-commits, klimek

Differential Revision: http://reviews.llvm.org/D13006

llvm-svn: 248153
2015-09-21 12:53:30 +00:00
Alexander Kornienko 3e748fbd17 [clang-tidy] Fixed formatting of headings in the docs.
llvm-svn: 248151
2015-09-21 12:13:27 +00:00
Angel Garcia Gomez b22084e113 Update clang-tidy documentation.
Summary: Update documentation of the modernize module with clang-modernize's documentation.

Subscribers: cfe-commits, klimek, alexfh

Differential Revision: http://reviews.llvm.org/D12961

llvm-svn: 247987
2015-09-18 14:08:57 +00:00
Alexander Kornienko 63b0573a2c [clang-tidy] Added a style guide link.
llvm-svn: 247798
2015-09-16 13:54:16 +00:00
Alexander Kornienko 64aa388efa [clang-tidy] updated misc-sizeof-container docs.
llvm-svn: 247580
2015-09-14 16:56:57 +00:00
Alexander Kornienko 7532d3e93d [clang-tidy] Add misc-sizeof-container check to find sizeof() uses on stl
containers.

Summary:
sizeof(some_std_string) is likely to be an error. This check finds this
pattern and suggests using .size() instead.

Reviewers: djasper, klimek, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

Differential Revision: http://reviews.llvm.org/D12759

llvm-svn: 247297
2015-09-10 16:37:46 +00:00
Alexander Kornienko 11d4d6446e [clang-tidy] Add inconsistent declaration parameter name check
This is first of series of patches, porting code from my project colobot-lint,
as I mentioned recently in cfe-dev mailing list.

This patch adds a new check in readability module:
readability-inconsistent-declaration-parameter-name. I also added appropriate
testcases and documentation.

I chose readability module, as it seems it is the best place for it.

I think I followed the rules of LLVM coding guideline, but I may have missed
something, as I usually use other code formatting style.

http://reviews.llvm.org/D12462

Patch by Piotr Dziwinski!

llvm-svn: 247261
2015-09-10 10:07:11 +00:00
Alexander Kornienko f4e8b92ff5 Add a deprecation notice to the clang-modernize documentation.
Summary:
Add a deprecation notice to the clang-modernize documentation. Remove
the reference to the external JIRA tracker.

Reviewers: revane, klimek

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D12732

llvm-svn: 247258
2015-09-10 09:42:01 +00:00
Alexander Kornienko d3e098140f [clang-tidy] Automatically redirect to the new page.
llvm-svn: 247153
2015-09-09 15:23:39 +00:00
Alexander Kornienko 16bb65431c Add a redirection page to unbreak external links.
Apparently, there are some links to http://clang.llvm.org/extra/clang-tidy.html
in the wild. It's better to keep them working.

llvm-svn: 247007
2015-09-08 12:26:32 +00:00
Alexander Kornienko d96d89f6e5 [clang-tidy] Updated docs.
llvm-svn: 246996
2015-09-08 09:44:04 +00:00
Alexander Kornienko 84745524b3 [clang-tidy] Updated the check name in the doc.
llvm-svn: 246643
2015-09-02 12:01:51 +00:00
Alexander Kornienko 0ed6c478a4 [clang-tidy] Move misc-use-override and readability-shrink-to-fit to "modernize/"
These checks are focusing on migrating the code from C++98/03 to C++11, so they
belong to the modernize module.

llvm-svn: 246437
2015-08-31 13:17:43 +00:00
Alexander Kornienko aabfadef84 [clang-tidy] Move clang-tidy docs to a separate directory. Create doc files for checks
The doc files for checks have been generated from the corresponding header files
using the docs/clang-tidy/tools/dump_check_docs.py script. Committing the script
as well, but the intention is to move all the user-facing docs from header files
to the rST files and add links to .h files appropriately.

llvm-svn: 246173
2015-08-27 18:10:07 +00:00
Alexander Kornienko 8e9110c160 [clang-tidy] Mention check_clang_tidy.py instead of check_clang_tidy.sh in the docs.
llvm-svn: 245587
2015-08-20 18:16:13 +00:00
Aaron Ballman 5a4892b4fa Updating the documentation for clang-tidy. Removes some non-ASCII characters from the documentation, and removes shell-specific single quote characters as they cause issues for some shells (such as on Windows).
llvm-svn: 243266
2015-07-27 13:41:30 +00:00
Hans Wennborg 0b1f36e2c8 docs/conf.py: bump version to 3.8
llvm-svn: 242247
2015-07-14 23:37:08 +00:00
John Thompson 4018c62428 Added mechanism to modularize for doing a compilation precheck
to determine files that have comnpilation or dependency problems.
A new -display-file-lists option use this to display lists of good files
(no compile errors), problem files, and a combined list with
problem files preceded by a '#'.  The problem files list can be
used in the module map generation assistant mode to exclude
problem files.  The combined files list can be used during module
map development.  See added docs.

llvm-svn: 241880
2015-07-10 00:37:25 +00:00
John Thompson 81cf1e8931 Fixed option description. '=' is required.
llvm-svn: 238998
2015-06-04 01:12:56 +00:00
Justin Bogner e3acc8bc56 docs: Spell a couple of cmake options with =ON in the docs
Patch by Albert Astals Cid. Thanks!

llvm-svn: 237554
2015-05-18 05:05:49 +00:00
John Thompson f9f62b116f Changed option processing to implicitly use -x c++ if no other -x option specified. Added implicit -w option to disable compilation warnings, in particular to avoid warning on pragma once.
llvm-svn: 236625
2015-05-06 18:43:01 +00:00
Alexander Kornienko 01c2da1e09 Fixed script name in the clang-tidy documentation.
llvm-svn: 230198
2015-02-23 01:12:41 +00:00
John Thompson a5666cadbb Deleted module-map-checker, as it's been folded into modularize.
llvm-svn: 230014
2015-02-20 14:28:10 +00:00
John Thompson 8eb8d93672 Added module map coverage support, extracted from module-map-checker.
llvm-svn: 229869
2015-02-19 16:47:27 +00:00
John Thompson 9cb7964641 Added support for extracting headers from module maps as a source for the header list.
llvm-svn: 229692
2015-02-18 16:14:32 +00:00
John Thompson 469bbc002a Added support for multiple header list files, as a precursor for when we need to load multiple module maps.
llvm-svn: 228935
2015-02-12 16:22:09 +00:00
John Thompson ecd3b04cd7 Added -block-check-header-list-only option. This is a work-around for private includes that purposefully get included inside blocks.
llvm-svn: 228846
2015-02-11 16:58:36 +00:00
John Thompson e0aa5fea15 Renamed module.map to module.modulemap.
llvm-svn: 228692
2015-02-10 14:29:16 +00:00
John Thompson ae7f5518c3 The -I option needs a space, apparently, from the actual implementation.
llvm-svn: 228689
2015-02-10 13:51:17 +00:00
Hans Wennborg 859ea8056d docs/conf.py: bump version to 3.7
llvm-svn: 226015
2015-01-14 18:32:20 +00:00
Alexander Kornienko 5c423318c9 [clang-tidy] Update help messages and docs.
Fixed incorrect examples of configuration, clarified the usage of -dump-config.

llvm-svn: 223235
2014-12-03 14:03:03 +00:00
Alexander Kornienko e15b004922 [clang-tidy] Updated docs for r220826.
llvm-svn: 220830
2014-10-28 22:43:33 +00:00
Alexander Kornienko 44fe05beeb [clang-tidy] Documented check testing.
llvm-svn: 218962
2014-10-03 07:08:22 +00:00
Alexander Kornienko 04e9d9ce64 [clang-tidy] Updated documentation
Added an example of check-specific options.

llvm-svn: 218573
2014-09-27 21:47:01 +00:00
Alexander Kornienko 9d32634c61 [clang-tidy] Fix documentation.
Try using code-block: console for command-line usage examples.

llvm-svn: 218572
2014-09-27 21:33:33 +00:00
Alexander Kornienko 55d6274de1 [clang-tidy] Fix for the documentation.
llvm-svn: 218571
2014-09-27 21:27:05 +00:00
Alexander Kornienko e088a46a83 [clang-tidy] Updated documentation.
llvm-svn: 218570
2014-09-27 21:25:26 +00:00
Alexander Kornienko 09d811c575 Fixed a typo.
llvm-svn: 217377
2014-09-08 15:04:35 +00:00
Benjamin Kramer 13460075b3 [clang-tidy] Add a couple of paragraphs on run-clang-tidy.py to the docs.
Happy tidying.

llvm-svn: 217373
2014-09-08 14:56:37 +00:00
Benjamin Kramer 044ade8549 Move clang-tools-extra docs 1.5 years into the future.
llvm-svn: 217369
2014-09-08 14:04:49 +00:00
Alexander Kornienko c5ac729131 Added documentation on how clang diagnostics are reported by clang-tidy.
llvm-svn: 213147
2014-07-16 13:26:51 +00:00
Tobias Grosser 0fcf3cce2b [doc] Fix incorrect reference to clang-format -> clang-tidy
llvm-svn: 212755
2014-07-10 18:59:25 +00:00
Alp Toker 9d63b5eb7f Prospective build fix following clang r210518
llvm-svn: 210521
2014-06-10 09:58:45 +00:00
Alexander Kornienko 3ab3467cef Update clang-tidy documentation.
Summary:
Updated the help message, updated description of -checks=, removed
mentions of -disable-checks.

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D3793

llvm-svn: 208979
2014-05-16 13:07:18 +00:00
Alexander Kornienko 7c9b29f525 Normalized the usage of override in the doc.
llvm-svn: 202710
2014-03-03 13:36:30 +00:00
Craig Topper e67972c462 Revert a LLVM_OVERRIDE to 'override' change in documentation. My search and replace was a little overzealous.
llvm-svn: 202633
2014-03-02 10:24:34 +00:00
Craig Topper a3dbe84166 [C++11] Replace LLVM_OVERRIDE with 'override'
llvm-svn: 202632
2014-03-02 10:20:11 +00:00
Alexander Kornienko 84e30a7346 Adding documentation for clang-tidy.
Summary:
Contains a short user's manual and some instructions on writing
clang-tidy checks.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2880

llvm-svn: 202164
2014-02-25 16:46:13 +00:00
Alp Toker 58983f1398 Fix typo
llvm-svn: 198831
2014-01-09 01:39:49 +00:00
John Thompson e0756452a3 Initial checkin of new module-map-checker tool.
llvm-svn: 198693
2014-01-07 15:22:08 +00:00
NAKAMURA Takumi d40d387fb1 Update the copyright credits -- Happy new year 2014!
FIXME: Dragonegg may be updated at non-trivial changes.
llvm-svn: 198274
2014-01-01 08:27:31 +00:00
Alp Toker 9a5134e6be Fix a variety of user-visible and comment typos
llvm-svn: 196038
2013-12-01 05:08:12 +00:00
NAKAMURA Takumi 63bf66816c Trailing linefeed.
llvm-svn: 195357
2013-11-21 13:50:58 +00:00
John Thompson 5100e8e9ae Reworked moduleImport example with real data.
llvm-svn: 194885
2013-11-15 23:26:14 +00:00
John Thompson 41778fd28f pp-trace user documentation - beginnings
llvm-svn: 194081
2013-11-05 14:41:29 +00:00
John Thompson 1da6792242 pp-trace user documentation - beginnings
llvm-svn: 193842
2013-11-01 00:39:54 +00:00
John Thompson 5052eb7394 pp-trace user documentation - beginnings
llvm-svn: 193841
2013-11-01 00:38:04 +00:00
John Thompson 26ecaf95a2 Added module map generation docs and some clean-up.
llvm-svn: 192792
2013-10-16 13:44:21 +00:00
Edwin Vane c76c0dd952 Update clang-modernizer docs
Summary: Docs updated to reflect new behaviour and new options.

Differential Revision: http://llvm-reviews.chandlerc.com/D1841

llvm-svn: 192105
2013-10-07 15:56:25 +00:00
John Thompson 02bad9fbc3 Fix headers, use source quoting.
llvm-svn: 191211
2013-09-23 17:57:00 +00:00
John Thompson 8925d4622b Changed error messages to use source quoting.
llvm-svn: 191201
2013-09-23 14:17:27 +00:00
John Thompson 587f6db9e1 Added list of checks made.
llvm-svn: 191093
2013-09-20 16:47:33 +00:00
John Thompson 2d2d45e330 Added modularize documentation.
llvm-svn: 191091
2013-09-20 14:40:52 +00:00
Ariel J. Bernal 583d095fa4 Transform files in a compilation database if no sources are provided.
Compile all files in a compilation database or a subset determined by a
sub-directory so you  don't have to specify them manually.

llvm-svn: 190630
2013-09-12 20:10:59 +00:00
Ariel J. Bernal dfa4c7548b Point doxygen link to somthing useful.
llvm-svn: 190607
2013-09-12 15:26:44 +00:00
Edwin Vane 5a816f044c clang-modernize: Tweak docs after rename
* Removing sphinx warnings about docs not in a toctree.
* Adding more links to cpp11-migrate redirect docs.

llvm-svn: 190195
2013-09-06 19:27:19 +00:00
Edwin Vane 684daa90f2 clang-modernize: Update docs with -include/-exclude
-include/-exclude and friends have been marked as hidden options until this
point. This is no longer necessary. Update the docs to describe their effect.

Differential Revision: http://llvm-reviews.chandlerc.com/D1621

llvm-svn: 190194
2013-09-06 19:26:25 +00:00
Chandler Carruth d9063c46f5 Rename cpp11-migrate to clang-modernize.
There is no reason to expect this tool to be limited to C++11, it seems
very likely to be of on-going interest. It seems likely to be useful for
modernizing even as new libraries come out in TSes and other formats
than a complete standard. Fundamentally, we need something a bit more
general. After some discussion on the list, going with
'clang-modernize'.

I've tried to do a reasonably comprehensive job of fixing up the names,
but I may still have missed some. Feel free to poke me if you spot any
fallout here. Things I've tried reasonably hard to find and fix:

- cpp11-migrate -> clang-modernize
- Migrator -> Modernizer
- Clean up the introductory documentation that was C++11 specific.

I'll also point out that this tool continues to delight me. =] Also,
a huge thanks to those who have so carefully, thoroughly documented the
tool. The docs here are simply phenomenal. Every tool should be this
well documented. I hope I have updated the documentation reasonably
well, but I'm not very good at documentation, so review much
appreciated.

llvm-svn: 189960
2013-09-04 17:35:07 +00:00
Edwin Vane b225be2729 Rename clang-replace -> clang-apply-replacements
Made changes throughout clang-tools-extra for the renaming of
clang-replace to clang-apply-replacements as per feedback from
community.

llvm-svn: 189832
2013-09-03 17:58:19 +00:00
Guillaume Papin 81332632b1 cpp11-migrate: Add Pass-By-Value Transform
Currently only constructor parameters stored in class-local storage are modified
to make use of the pass-by-value idiom but this is a base that can be be further
improved to handle more situations.

This commit is the same as r189363 with additionnal fixes for the build issues.

llvm-svn: 189584
2013-08-29 13:42:13 +00:00
Eric Christopher 35c6b614ea Temporarily revert r189363 as it seems to be failing to build.
llvm-svn: 189387
2013-08-27 17:26:07 +00:00
Guillaume Papin dcdae946f3 cpp11-migrate: Add Pass-By-Value Transform
Currently only constructor parameters stored in class-local storage are modified
to make use of the pass-by-value idiom but this is a base that can be be further
improved to handle more situations.

llvm-svn: 189363
2013-08-27 16:11:26 +00:00
Edwin Vane 3bf14cebee Introducing new tool clang-replace
Introducing new tool 'clang-replace' that finds files containing
serialized Replacements and applies those changes after deduplication
and detecting conflicts.

Currently the tool does not apply changes. It stops just after the
deduplication and conflict report phase. Forthcoming patches will
complete functionality.

Both build systems updated for new tool.

Includes a conflict test case.

clang-replace added to Doxygen build.

Differential Revision: http://llvm-reviews.chandlerc.com/D1424

llvm-svn: 189008
2013-08-22 13:07:14 +00:00
Ariel J. Bernal 2203559c3e Use -std=c++11 when no compilation database is provided
Allow the migrator to be used without specifing --. If neither -- nor -p is
provided and no compilation database can be detecteded from the first source
file path then -std=c++11 is added as the only compiler argument.

llvm-svn: 188533
2013-08-16 04:40:44 +00:00
Guillaume Papin a3eede2cc2 cpp11-migrate: Add -for-compilers command line switch.
This change add a new option command line option -for-compilers that allows the
user to enable multiple transforms automatically.

Another difference is that now all transforms are enabled by default.

llvm-svn: 187360
2013-07-29 15:58:47 +00:00
Edwin Vane 571a64159b cp11-migrate: Integration with LibFormat
Adding a feature to optionally reformat code changed by the migrator. Like
LibFormat, can choose between built-in styles (LLVM, Mozilla, Google, Chromium)
or use a YAML-format config file.

Now with no dependency on iostream by the Reformatting.cpp LIT test.

Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 186938
2013-07-23 12:50:03 +00:00
Michael Gottesman 29e449f222 Revert "cp11-migrate: Integration with LibFormat"
This reverts commit r186866.

This breaks the build and the original author Guillaume Papin
<guillaume.papin@epitech.eu> asked me to revert so he could look at it more with
revane.

llvm-svn: 186873
2013-07-22 21:03:56 +00:00
Edwin Vane 55b0be72d1 cp11-migrate: Integration with LibFormat
Adding a feature to optionally reformat code changed by the migrator. Like
LibFormat, can choose between built-in styles (LLVM, Mozilla, Google, Chromium)
or use a YAML-format config file.

Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 186866
2013-07-22 20:26:29 +00:00
Edwin Vane 5ee6110817 cpp11-migrate: Add Replace-AutoPtr Transform
Add a new transform to replace uses of 'std::auto_ptr' by 'std::unique_ptr'.
Copy-ctor and assign-operator are wrapped with a call to 'std::move()'.

Note that until header modification is ready it is not that useful, that's why
it's marked as (EXPERIMENTAL) in the command line description and a "Known
Limitations" section is present in the transform documentation.

Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 185535
2013-07-03 13:21:24 +00:00
Edwin Vane 8d28646db6 cpp11-migrate: Fixing section markup
Adhering to LLVM's ReST style for section markup.

llvm-svn: 183981
2013-06-14 15:14:20 +00:00
Edwin Vane 573ec4f1aa cpp11-migrate: Docs refresh
* Documented new command-line options.
* Moved usage to a new page.
  * Usage now split into general options and transform-related options.
* Main Migrator page now contains getting started and getting involved
  information.
  * Also included a JIRA issue collector button for logging bugs.

llvm-svn: 183417
2013-06-06 14:30:14 +00:00
Edwin Vane ba6a0960ea cpp11-migrate: Add override specifier before comments on inline methods
This commit fixes a "FIXME" in the add-override transform. ' override' was
misplaced when a comment was between the function body and the end of the
'prototype'.

It also remove duplicated check for the main file from the last commit (and
fixes the typo in the comment above).

Author: Guillaume Papin <guillaume.papin@epitech.eu>
llvm-svn: 181806
2013-05-14 17:34:12 +00:00
Eric Christopher 6cddedca72 The option is spelled -use-auto, not -loop-convert.
llvm-svn: 180016
2013-04-22 14:39:46 +00:00
Edwin Vane 8ef7fa1e07 Adding the AddOverride transform for cpp11-migrate
This transform adds the override specifier to methods that overrides virtual
methods from a base class that don't already have this specifier.

Author: Philip Dunstan <phil@phildunstan.com>
llvm-svn: 179127
2013-04-09 20:49:49 +00:00
Tareq A. Siraj c2aa348dd0 Allow users to specify NULL like macros to be replaced
-use-nullptr only replaced macro named NULL and ignored any user defined
macros that behaved like NULL. This patch introduces -user-null-macros
command line option to let users specify their custom NULL like macros.

- Added a -user-null-macros command line option that takes a
  comma-separated list of user-defined macros to be replaced when using
  the -use-nullptr transform.
- Added documentation.
- Updated testcase to reflect current behavior.
- Whitespace fixes.

Reviewers: revane, klimek, gribozavr
llvm-svn: 178243
2013-03-28 16:06:59 +00:00
Edwin Vane 3cb833d45b Docs describing limitations of the cpp11-migrate Loop Convert Transform
Sam Panzer, author of loop convert, provided a list of limitations of the tool
to be documented. (Thanks Sam!)

The transform's limitations are now documented in the existing user doc.
Included are examples of the cases where the tool may change semantics.

Author: Jack Yang <jack.yang@intel.com>
llvm-svn: 178034
2013-03-26 16:44:29 +00:00
Sean Silva a7aedfa5db [docs] Clarify wording.
"This documentation" could be construed as the entire c-t-e docs
(despite being under a doxygen heading; people read "locally"
sometimes), which gives a bad impression.

llvm-svn: 176849
2013-03-12 02:40:05 +00:00
Edwin Vane bdcd1350c1 Adding -final-syntax-check to cpp11-migrate user docs
llvm-svn: 176758
2013-03-09 03:38:20 +00:00
Edwin Vane e4e7c24efc Splitting cpp11-migrate transform docs into sub-pages
Each transform belongs in its own sub-page now. Minor refactoring to reflect
new heading levels.

llvm-svn: 176757
2013-03-09 03:33:50 +00:00