summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix the rst doc, unbreak buildbot.Haojian Wu2019-09-161-0/+1
| | | | llvm-svn: 371968
* [clang-tidy] performance-inefficient-vector-operation: Support proto ↵Haojian Wu2019-09-161-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | repeated field Summary: Finds calls that add element to protobuf repeated field in a loop without calling Reserve() before the loop. Calling Reserve() first can avoid unnecessary memory reallocations. A new option EnableProto is added to guard this feature. Patch by Cong Liu! Reviewers: gribozavr, alexfh, hokein, aaron.ballman Reviewed By: hokein Subscribers: lebedev.ri, xazax.hun, Eugene.Zelenko, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D67135 llvm-svn: 371963
* Add a bugprone-argument-comment option: IgnoreSingleArgument.Alexander Kornienko2019-09-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add bugprone-argument-comment option: IgnoreSingleArgument. When true, the check will ignore the single argument. Sometimes, it's not necessary to add comment to single argument. For example: > std::string name("Yubo Xie"); > pScreen->SetWidth(1920); > pScreen->SetHeight(1080); This option can ignore such single argument in bugprone-argument-comment check. Reviewers: alexfh Reviewed By: alexfh Subscribers: cfe-commits Tags: #clang Patch by Yubo Xie. Differential Revision: https://reviews.llvm.org/D67056 llvm-svn: 371075
* [clang-tidy] Add llvm-prefer-register-over-unsigned to clang-tidyDaniel Sanders2019-08-302-0/+28
| | | | | | | | | | | | | | | | | Summary: This clang-tidy check is looking for unsigned integer variables whose initializer starts with an implicit cast from llvm::Register and changes the type of the variable to llvm::Register (dropping the llvm:: where possible). Reviewers: arsenm, bogner Subscribers: jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, mgorny, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D65919 llvm-svn: 370512
* [clang-tidy] readability-identifier-naming shouldn't complain about CRTP ↵Sam McCall2019-08-281-0/+4
| | | | | | | | | | | | | | pseudo-overrides Reviewers: ilya-biryukov Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66864 llvm-svn: 370193
* Fix documentation build after rL369568Yuanfang Chen2019-08-211-5/+5
| | | | llvm-svn: 369578
* [clang-tidy] Check for dynamically initialized statics in headers.Yuanfang Chen2019-08-212-0/+28
| | | | | | | | | | | | Finds instances where variables with static storage are initialized dynamically in header files. Reviewed By: aaron.ballman, alexfh Patch by Charles Zhang! Differential Revision: https://reviews.llvm.org/D62829 llvm-svn: 369568
* [clang-tidy] Adding static analyzer check to list of clang-tidy checksNathan Huckleberry2019-08-0286-0/+993
| | | | | | | | | | | | | | | | | | | Summary: Since clang-tidy supports use of the static analyzer there should be documentation of how to invoke the static analyzer checks. Reviewers: JonasToth, aaron.ballman, NoQ, Szelethus Reviewed By: aaron.ballman Subscribers: nickdesaulniers, lebedev.ri, jfb, NoQ, Eugene.Zelenko, xazax.hun, baloghadamsoftware, a.sidorin, Szelethus, donat.nagy, dkrupp, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64454 llvm-svn: 367694
* [clang-tidy] Fix the documentation for linuxkernel-must-use-errs.Tom Roeder2019-07-301-8/+10
| | | | | | | | | | | | | | | | | | | Summary: This changes ReleaseNotes.txt to have the first sentence of the full documentation from linuxkernel-must-use-errs.rst. This addresses a comment from the review of rL367071 in https://reviews.llvm.org/D59963. Reviewers: Eugene.Zelenko Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65343 llvm-svn: 367333
* [clang-tidy]: Google: new check 'google-upgrade-googletest-case'Eric Fiselier2019-07-292-0/+54
| | | | | | | | | | | Introduce a new check to upgrade user code based on API changes in Googletest. The check finds uses of old Googletest APIs with "case" in their name and replaces them with the new APIs named with "suite". Patch by Alex Strelnikov (strel@google.com) Reviewed as D62977. llvm-svn: 367263
* [clang-tidy] Add a module for the Linux kernel.Tom Roeder2019-07-252-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Now that clang is going to be able to build the Linux kernel again on x86, and we have gen_compile_commands.py upstream for generating compile_commands.json, clang-tidy can be used on the Linux kernel source. To that end, this commit adds a new clang-tidy module to be used for checks specific to Linux kernel source. The Linux kernel follows its own style of C, and it will be useful to separate those checks into their own module. This also adds an initial check that makes sure that return values from the kernel error functions like PTR_ERR and ERR_PTR are checked. It also makes sure that any functions that directly return values from these functions are checked. Subscribers: xazax.hun, gribozavr, Eugene.Zelenko, lebedev.ri, mgorny, jdoerfert, cfe-commits Tags: #clang, #clang-tools-extra Reviewers: aaron.ballman, alexfh, hokein, JonasToth Differential Revision: https://reviews.llvm.org/D59963 llvm-svn: 367071
* Update documentation for all CERT checks that correspond to a recommendation.Aaron Ballman2019-07-224-5/+31
| | | | | | CERT removed their C++ secure coding recommendations from public view and so the links within that documentation are stale. This updates various pieces of documentation to make this more clear, and to help add substance where our docs deferred to CERT's wiki. llvm-svn: 366687
* [clang-tidy] initial version of readability-convert-member-functions-to-staticMatthias Gehre2019-07-162-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Finds non-static member functions that can be made ``static``. I have run this check (repeatedly) over llvm-project. It made 1708 member functions ``static``. Out of those, I had to exclude 22 via ``NOLINT`` because their address was taken and stored in a variable of pointer-to-member type (e.g. passed to llvm::StringSwitch). It also made 243 member functions ``const``. (This is currently very conservative to have no false-positives and can hopefully be extended in the future.) You can find the results here: https://github.com/mgehre/llvm-project/commits/static_const_eval Reviewers: alexfh, aaron.ballman Subscribers: mgorny, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61749 llvm-svn: 366265
* [clang-tidy] new check: bugprone-posix-returnDmitri Gribenko2019-07-032-0/+21
| | | | | | | | | | | | | | | | | | | | Summary: Checks if any calls to posix functions (except posix_openpt) expect negative return values. These functions return either 0 on success or an errno on failure, which is positive only. Reviewers: JonasToth, gribozavr, alexfh, hokein Reviewed By: gribozavr Subscribers: Eugene.Zelenko, lebedev.ri, llozano, george.burgess.iv, xazax.hun, srhines, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63623 Patch by Jian Cai. llvm-svn: 365007
* Fixed two issues in clang-tidy -help.Alexander Kornienko2019-07-011-105/+105
| | | | | | HeaderFilter -> HeaderFilterRegex llvm-svn: 364837
* [clang-tidy] Update documentation for Qt Creator integration.Nikolai Kosjar2019-06-251-2/+4
| | | | | | | | | | Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63763 llvm-svn: 364315
* [clang-tidy] Fix a typo in the doc.Haojian Wu2019-06-211-1/+1
| | | | llvm-svn: 364010
* [clang-tidy] Split fuchsia-default-argumentsJulie Hockett2019-06-183-8/+23
| | | | | | | | | | | | Splits fuchsia-default-arguments check into two checks. fuchsia-default-arguments-calls warns if a function or method is called with default arguments. fuchsia-default-arguments-declarations warns if a function or method is declared with default parameters. Committed on behalf of @diegoast (Diego Astiazarán). Resolves b38051. Differential Revision: https://reviews.llvm.org/D62437 llvm-svn: 363712
* [docs] Fix another bot warning by adding a blank line to separate the ↵Don Hinton2019-06-161-0/+1
| | | | | | `option::` command from the text below. llvm-svn: 363520
* [docs] Fix a few problems with clang-tool docs to get the bots green again.Don Hinton2019-06-161-0/+1
| | | | llvm-svn: 363518
* android: add a close-on-exec check on pipe()George Burgess IV2019-06-062-0/+21
| | | | | | | | | | | On Android, pipe() is better to be replaced by pipe2() with O_CLOEXEC flag to avoid file descriptor leakage. Patch by Jian Cai! Differential Revision: https://reviews.llvm.org/D61967 llvm-svn: 362673
* android: add a close-on-exec check on pipe2()George Burgess IV2019-06-062-0/+22
| | | | | | | | | | | On Android, pipe2() is better to set O_CLOEXEC flag to avoid file descriptor leakage. Patch by Jian Cai! Differential Revision: https://reviews.llvm.org/D62049 llvm-svn: 362672
* Fix sphinx "Malformed option description" warningSimon Pilgrim2019-05-241-1/+1
| | | | llvm-svn: 361616
* [clang-tidy] Add option "LiteralInitializers" to ↵Matthias Gehre2019-05-241-0/+4
| | | | | | | | cppcoreguidelines-pro-type-member-init Differential Revision: D24892 llvm-svn: 361601
* [clang-tidy]: Add cert-oop54-cpp alias for bugprone-unhandled-self-assignmentTamas Zolnai2019-05-233-1/+20
| | | | | | | | | | | | | | | | | | | | Summary: Added WarnOnlyIfThisHasSuspiciousField option to allow to catch any copy assignment operator independently from the container class's fields. Added the cert alias using this option. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: mgorny, Eugene.Zelenko, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62192 llvm-svn: 361550
* [clang-tidy] New check calling out uses of +new in Objective-C codeDmitri Gribenko2019-05-232-0/+30
| | | | | | | | | | | | | | | | | | | | | Summary: Google's Objective-C style guide forbids calling or overriding +new to instantiate objects. This check warns on violations. Style guide reference: https://google.github.io/styleguide/objcguide.html#do-not-use-new Patch by Michael Wyman. Reviewers: benhamilton, aaron.ballman, JonasToth, gribozavr, ilya-biryukov, stephanemoore, mwyman Reviewed By: aaron.ballman, gribozavr, stephanemoore, mwyman Subscribers: stephanemoore, xazax.hun, Eugene.Zelenko, mgorny, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D61350 llvm-svn: 361487
* [clang-tidy] New option for misc-throw-by-value-catch-by-referenceAdam Balogh2019-05-211-0/+15
| | | | | | | | | | | | | | Catching trivial objects by value is not dangerous but may be inefficient if they are too large. This patch adds an option `WarnOnLargeObject` to the checker to also warn if such an object is caught by value. An object is considered as "large" if its size is greater than `MaxSize` which is another option. Default value is the machine word of the architecture (size of the type `size_t`). Differential Revision: https://reviews.llvm.org/D61851 llvm-svn: 361225
* [clang-tidy] Recommit r360785 "modernize-loop-convert: impl const cast iter" ↵Don Hinton2019-05-152-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with correct attribution Summary: modernize-loop-convert was not detecting implicit casts to const_iterator as convertible to range-based loops: std::vector<int> vec{1,2,3,4} for(std::vector<int>::const_iterator i = vec.begin(); i != vec.end(); ++i) { } Thanks to Don Hinton for advice. As well, this change adds a note for this check's applicability to code targeting OpenMP prior version 5 as this check will continue breaking compilation with `-fopenmp`. Thanks to Roman Lebedev for pointing this out. Fixes PR#35082 Patch by Torbjörn Klatt! Reviewed By: hintonda Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D61827 llvm-svn: 360788
* Revert [clang-tidy] modernize-loop-convert: impl const cast iterDon Hinton2019-05-152-14/+0
| | | | | | This reverts r360785 (git commit 42d28be802fe5beab18bc1a27f89894c0a290d44) llvm-svn: 360787
* [clang-tidy] modernize-loop-convert: impl const cast iterDon Hinton2019-05-152-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: modernize-loop-convert was not detecting implicit casts to const_iterator as convertible to range-based loops: std::vector<int> vec{1,2,3,4} for(std::vector<int>::const_iterator i = vec.begin(); i != vec.end(); ++i) { } Thanks to Don Hinton for advice. As well, this change adds a note for this check's applicability to code targeting OpenMP prior to version 5 as this check will continue breaking compilation with `-fopenmp`. Thanks to Roman Lebedev for pointing this out. Fixes PR#35082 Reviewed By: hintonda Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D61827 llvm-svn: 360785
* [clang-tidy] new check: bugprone-branch-cloneKristof Umann2019-05-152-0/+91
| | | | | | | | | | | | | Implement a check for detecting if/else if/else chains where two or more branches are Type I clones of each other (that is, they contain identical code) and for detecting switch statements where two or more consecutive branches are Type I clones of each other. Patch by Donát Nagy! Differential Revision: https://reviews.llvm.org/D54757 llvm-svn: 360779
* [clang-tidy] new check: bugprone-unhandled-self-assignmentTamas Zolnai2019-05-122-0/+117
| | | | | | | | | | | | | | | | | | | | | Summary: This check searches for copy assignment operators which might not handle self-assignment properly. There are three patterns of handling a self assignment situation: self check, copy-and-swap or the less common copy-and-move. The new check warns if none of these patterns is found in a user defined implementation. See also: OOP54-CPP. Gracefully handle self-copy assignment https://wiki.sei.cmu.edu/confluence/display/cplusplus/OOP54-CPP.+Gracefully+handle+self-copy+assignment Reviewers: JonasToth, alexfh, hokein, aaron.ballman Subscribers: riccibruno, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D60507 llvm-svn: 360540
* Recommit r360345 with fixes (was reverted in r360348).Aaron Ballman2019-05-102-0/+69
| | | | | | | | Add the modernize-use-trailing-return check to rewrite function signatures to use trailing return types. Patch by Bernhard Manfred Gruber. llvm-svn: 360438
* Revert r360345 and r360346, as they are not passing the testbots.Aaron Ballman2019-05-092-69/+0
| | | | | | http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/48063/steps/test/logs/stdio llvm-svn: 360348
* Add the modernize-use-trailing-return check to rewrite function signatures ↵Aaron Ballman2019-05-092-0/+69
| | | | | | | | to use trailing return types. Patch by Bernhard Manfred Gruber. llvm-svn: 360345
* [clang-tidy] Update documentation on ReSharper integration.Artem Dergachev2019-05-081-1/+1
| | | | | | | | | | It's now possible to set custom clang-tidy binary. Patch by Alexander Zaitsev! Differential Revision: https://reviews.llvm.org/D61475 llvm-svn: 360277
* Documentation for bugprone-inaccurate-erase: added an example of a bug that ↵Dmitri Gribenko2019-05-081-0/+16
| | | | | | | | | | | | | | this checker catches Reviewers: alexfh Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61644 llvm-svn: 360247
* Fix typo in documentation.Nick Lewycky2019-04-261-1/+1
| | | | llvm-svn: 359329
* [clang-tidy] Add new checker: llvm-prefer-isa-or-dyn-cast-in-conditionalsDon Hinton2019-04-242-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Looks at conditionals and finds cases of ``cast<>``, which will assert rather than return a null pointer, and ``dyn_cast<>`` where the return value is not captured. Additionally, finds cases that match the pattern ``var.foo() && isa<X>(var.foo())``, where the method is called twice and could be expensive. .. code-block:: c++ // Finds cases like these: if (auto x = cast<X>(y)) <...> if (cast<X>(y)) <...> // But not cases like these: if (auto f = cast<Z>(y)->foo()) <...> if (cast<Z>(y)->foo()) <...> Reviewers: alexfh, rjmccall, hokein, aaron.ballman, JonasToth Reviewed By: aaron.ballman Subscribers: xbolva00, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D59802 llvm-svn: 359142
* [clang-tidy] Add a check for [super self] in initializers 🔍Stephane Moore2019-04-172-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check aims to address a relatively common benign error where Objective-C subclass initializers call -self on their superclass instead of invoking a superclass initializer, typically -init. The error is typically benign because libobjc recognizes that improper initializer chaining is common¹. One theory for the frequency of this error might be that -init and -self have the same return type which could potentially cause inappropriate autocompletion to -self instead of -init. The equal selector lengths and triviality of common initializer code probably contribute to errors like this slipping through code review undetected. This check aims to flag errors of this form in the interests of correctness and reduce incidence of initialization failing to chain to -[NSObject init]. [1] "In practice, it will be hard to rely on this function. Many classes do not properly chain -init calls." From _objc_rootInit in https://opensource.apple.com/source/objc4/objc4-750.1/runtime/NSObject.mm.auto.html. Test Notes: Verified via `make check-clang-tools`. Subscribers: mgorny, xazax.hun, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59806 llvm-svn: 358620
* [clang-tidy] Add MagnitudeBitsUpperLimit option to ↵Tamas Zolnai2019-04-141-0/+17
| | | | | | | | | | | | | | | | | | | | | bugprone-too-small-loop-variable Summary: The bugprone-too-small-loop-variable check often catches loop variables which can represent "big enough" values, so we don't actually need to worry about that this variable will overflow in a loop when the code iterates through a container. For example a 32 bit signed integer type's maximum value is 2 147 483 647 and a container's size won't reach this maximum value in most of the cases. So the idea of this option to allow the user to specify an upper limit (using magnitude bit of the integer type) to filter out those catches which are not interesting for the user, so he/she can focus on the more risky integer incompatibilities. Next to the option I replaced the term "positive bits" to "magnitude bits" which seems a better naming both in the code and in the name of the new option. Reviewers: JonasToth, alexfh, aaron.ballman, hokein Reviewed By: JonasToth Subscribers: Eugene.Zelenko, xazax.hun, jdoerfert, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D59870 llvm-svn: 358356
* [clang-tidy] Use back-tick hereTamas Zolnai2019-04-131-2/+2
| | | | llvm-svn: 358333
* Spelling correction for docs for cppcoreguidelines-owning-memorySylvestre Ledru2019-03-311-1/+1
| | | | | | | | | | | | | | Summary: There's a typo in the docs, as mentioned in the title. Please see the diff. Reviewers: JonasToth Subscribers: sylvestre.ledru, nemanjai, kbarton, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D60050 llvm-svn: 357371
* [clang-tidy] Separate the check-facing interfaceAlexander Kornienko2019-03-251-2/+3
| | | | | | | | | | | | | | | | | | | Summary: Move ClangTidyCheck to a separate header/.cpp Switch checks to #include "ClangTidyCheck.h" Mention ClangTidyCheck.h in the docs Reviewers: hokein, gribozavr, aaron.ballman Reviewed By: hokein Subscribers: mgorny, javed.absar, xazax.hun, arphaman, jdoerfert, llvm-commits, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D59714 llvm-svn: 356890
* [clang-tidy] openmp-exception-escape - a new checkRoman Lebedev2019-03-222-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Finally, we are here! Analyzes OpenMP Structured Blocks and checks that no exception escapes out of the Structured Block it was thrown in. As per the OpenMP specification, structured block is an executable statement, possibly compound, with a single entry at the top and a single exit at the bottom. Which means, ``throw`` may not be used to to 'exit' out of the structured block. If an exception is not caught in the same structured block it was thrown in, the behaviour is undefined / implementation defined, the program will likely terminate. Reviewers: JonasToth, aaron.ballman, baloghadamsoftware, gribozavr Reviewed By: aaron.ballman, gribozavr Subscribers: mgorny, xazax.hun, rnkovacs, guansong, jdoerfert, cfe-commits, ABataev Tags: #clang-tools-extra, #openmp, #clang Differential Revision: https://reviews.llvm.org/D59466 llvm-svn: 356802
* [clang-tidy] openmp-use-default-none - a new checkRoman Lebedev2019-03-222-0/+54
| | | | | | | | | | | | | | | | | | | | | | | Summary: Finds OpenMP directives that are allowed to contain `default` clause, but either don't specify it, or the clause is specified but with the kind other than `none`, and suggests to use `default(none)` clause. Using `default(none)` clause changes the default variable visibility from being implicitly determined, and thus forces developer to be explicit about the desired data scoping for each variable. Reviewers: JonasToth, aaron.ballman, xazax.hun, hokein, gribozavr Reviewed By: JonasToth, aaron.ballman Subscribers: jdoerfert, openmp-commits, klimek, sbenza, arphaman, Eugene.Zelenko, ABataev, mgorny, rnkovacs, guansong, cfe-commits Tags: #clang-tools-extra, #openmp, #clang Differential Revision: https://reviews.llvm.org/D57113 llvm-svn: 356801
* [clang-tidy] A new OpenMP moduleRoman Lebedev2019-03-221-0/+1
| | | | | | | | | | | | | | | | | | Summary: Just the empty skeleton. Previously reviewed as part of D57113. Reviewers: JonasToth, aaron.ballman, alexfh, xazax.hun, hokein, gribozavr Reviewed By: JonasToth, gribozavr Subscribers: jdoerfert, mgorny, rnkovacs, guansong, arphaman, cfe-commits Tags: #clang-tools-extra, #openmp, #clang Differential Revision: https://reviews.llvm.org/D57571 llvm-svn: 356800
* [clang-tidy] Add additional patterns to the ↵Hyrum Wright2019-03-141-1/+16
| | | | | | | | abseil-duration-unnecessary-conversion check. Differential Revision: https://reviews.llvm.org/D59183 llvm-svn: 356141
* Revert "[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not ↵Paul Hoad2019-03-131-1/+1
| | | | | | | | working if an "else" statement is present" This reverts commit b358cbb9b78389e20f7be36e1a98e26515c3ecce. llvm-svn: 356030
* [clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if ↵Paul Hoad2019-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | an "else" statement is present Summary: Addressing: PR25010 - https://bugs.llvm.org/show_bug.cgi?id=25010 Code like: ``` if(true) var++; else { var--; } ``` is reformatted to be ``` if (true) var++; else { var--; } ``` Even when `AllowShortIfStatementsOnASingleLine` is true The following revision comes from a +1'd suggestion in the PR to support AllowShortIfElseStatementsOnASingleLine This suppresses the clause prevents the merging of the if when there is a compound else Reviewers: klimek, djasper, JonasToth, alexfh, krasimir, reuk Reviewed By: reuk Subscribers: reuk, Higuoxing, jdoerfert, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D59087 llvm-svn: 356029
OpenPOWER on IntegriCloud