summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] Fix PR26274Alexander Kornienko2019-12-061-64/+70
| | | | | | | | | | | | | | | | | Summary: This commit fixes http://llvm.org/PR26274 in a simpler and more correct way than 4736d63f752f8d13f4c6a9afd558565c32119718 did. See https://reviews.llvm.org/D69855#1767089 for details. Reviewers: gribozavr, aaron.ballman, gribozavr2 Reviewed By: aaron.ballman, gribozavr2 Subscribers: gribozavr2, merge_guards_bot, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70974
* Revert "Fix llvm-namespace-comment for macro expansions"Alexander Kornienko2019-12-031-120/+13
| | | | | This reverts commit 4736d63f752f8d13f4c6a9afd558565c32119718. This commit introduces a ton of false positives and incorrect fixes. See https://reviews.llvm.org/D69855#1767089 for details.
* Fix llvm-namespace-comment for macro expansionsMarcin Twardak2019-11-231-13/+120
| | | | | If a namespace is a macro name, it should be allowed to close the namespace with the same name.
* [clang-tidy] Adjust location of namespace comment diagnosticIlya Biryukov2019-07-171-1/+8
| | | | | | | | | | | | | | | | | | | | | | Summary: If there is no comment, place it at the closing brace of a namespace definition. Previously it was placed at the next character after the closing brace. The new position produces a better location for highlighting in clangd and does not seem to make matters worse for clang-tidy. Reviewers: alexfh, hokein Reviewed By: alexfh, hokein Subscribers: xazax.hun, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64861 llvm-svn: 366337
* Re-apply r357823 "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."Artem Dergachev2019-04-231-1/+4
| | | | | | | | | It now comes with a follow-up fix for the clients of this API in clangd and clang-tidy. Differential Revision: https://reviews.llvm.org/D59977 llvm-svn: 359035
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Port getLocStart -> getBeginLocStephen Kelly2018-08-091-2/+2
| | | | | | | | | | Reviewers: javed.absar Subscribers: nemanjai, kbarton, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50354 llvm-svn: 339400
* [clang-tidy] Fix google-readability-namespace-comments handling of C++17 ↵Alexander Kornienko2018-01-111-10/+59
| | | | | | | | | | | | | | | | | | | | | | | | | nested namespaces Summary: Fixes bug 34701 When we encounter a namespace find the location of the left bracket. Then if the text between the name and the left bracket contains a ':' then it's a C++17 nested namespace. Reviewers: #clang-tools-extra, alexfh, aaron.ballman Reviewed By: aaron.ballman Subscribers: curdeius, cfe-commits, krasimir, JonasToth, JDevlieghere, xazax.hun Tags: #clang-tools-extra Patch by Alexandru Octavian Buțiu! Differential Revision: https://reviews.llvm.org/D38284 llvm-svn: 322274
* Revert "Fix nested namespaces in google-readability-nested-namespace-comments."Alexander Kornienko2017-10-121-53/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts r315057. The revision introduces assertion failures: assertion failed at llvm/tools/clang/include/clang/Basic/SourceManager.h:428 in const clang::SrcMgr::ExpansionInfo &clang::SrcMgr::SLocEntry::getExpansion() const: isExpansion() && "Not a macro expansion SLocEntry!" Stack trace: __assert_fail clang::SrcMgr::SLocEntry::getExpansion() clang::SourceManager::getExpansionLocSlowCase() clang::SourceManager::getExpansionLoc() clang::Lexer::getRawToken() clang::tidy::readability::NamespaceCommentCheck::check() clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::MatchVisitor::visitMatch() clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches() clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchWithFilter() clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchDispatch() clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl() clang::RecursiveASTVisitor<>::TraverseDeclContextHelper() clang::RecursiveASTVisitor<>::TraverseDecl() clang::RecursiveASTVisitor<>::TraverseDeclContextHelper() clang::RecursiveASTVisitor<>::TraverseDecl() clang::RecursiveASTVisitor<>::TraverseDeclContextHelper() clang::RecursiveASTVisitor<>::TraverseDecl() clang::ast_matchers::MatchFinder::matchAST() clang::MultiplexConsumer::HandleTranslationUnit() clang::ParseAST() clang::FrontendAction::Execute() clang::CompilerInstance::ExecuteAction() clang::tooling::FrontendActionFactory::runInvocation() clang::tooling::ToolInvocation::runInvocation() clang::tooling::ToolInvocation::run() Still working on an isolated test case. llvm-svn: 315580
* Fix nested namespaces in google-readability-nested-namespace-comments.Aaron Ballman2017-10-061-10/+53
| | | | | | | | Fixes PR34701. Patch by Alexandru Octavian Buțiu. llvm-svn: 315057
* modernize-use-auto NFC fixesPiotr Padlewski2016-12-141-1/+1
| | | | llvm-svn: 289656
* [clang-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang2016-11-081-1/+2
| | | | | | | | | | | | | | | | Summary: Ran clang-format on all .c/.cpp/.h files in clang-tools-extra. Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories. Reviewers: klimek, alexfh Subscribers: nemanjai Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D26329 llvm-svn: 286221
* [clang-tidy] Cleaning up language options.Gabor Horvath2016-09-241-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D24881 llvm-svn: 282319
* [clang-tidy] google-readability-namespace-comments: ignore stray semicolonsAlexander Kornienko2015-12-161-1/+2
| | | | llvm-svn: 255772
* Disable clang-tidy readability checkers when not compiling in C++ mode. None ↵Aaron Ballman2015-09-021-1/+4
| | | | | | of the checkers require additional testing as the tests will not compile for other languages or modes, or the checkers would never match a valid construct. llvm-svn: 246661
* [clang-tidy] Fix for http://llvm.org/PR23130Alexander Kornienko2015-04-081-3/+3
| | | | | | | NamespaceCommentCheck: Don't remove the token placed immediately after the namespace closing brace. llvm-svn: 234403
* Make helpers static. clang-tools edition.Benjamin Kramer2015-03-231-3/+4
| | | | | | Also purge dead code found by it. NFC. llvm-svn: 232948
* Use std::string instead of StringRef to prevent use-after-free.Daniel Jasper2015-03-051-1/+1
| | | | | | Discovered by asan. llvm-svn: 231421
* [clang-tidy] Replace unrecognized namespace ending comments.Alexander Kornienko2015-03-051-17/+22
| | | | | | | | | | | | | | | | | | | | | | Summary: Replace unrecognized namespace ending comments. This will help in particular when a namespace ending comment is mistyped or doesn't fit the regexp for other reason, e.g.: namespace a { namespace b { namespace { } // anoynmous namespace } // b } // namesapce a Reviewers: djasper Reviewed By: djasper Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D8078 llvm-svn: 231369
* [clang-tidy] Move the missing namespace comment warnings to the closing braceAlexander Kornienko2014-11-171-1/+9
| | | | | | | | | | | | | | | | | | | Summary: The google-readability-namespace-comments/llvm-namespace-comment warnings are quite confusing when they appear at the beginning of a long namespace and the closing brace is not in sight. For convenience added notes pointing to the start of the namespace. Reviewers: klimek Reviewed By: klimek Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D6251 llvm-svn: 222145
* [clang-tidy] Minor fixes for the NamespaceCommentCheck.Alexander Kornienko2014-10-161-4/+6
| | | | | | | | * Make SmallVector size enough for all groups. * Allow trailing period in the comment. * Fix "// anonymous namespace qqq". llvm-svn: 219926
* [clang-tidy] Default options in modules.Alexander Kornienko2014-10-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch allows modules to specify default options for the checks defined in them. This way a sufficiently configurable check can be registered in multiple modules with different default options. E.g. the SpacesBeforeComments option may be set to 1 for the "llvm-namespace-comments" check and to 2 for the "google-readability-namespace-comment" check without modifying or extending the check code. This patch also registers the google-readability-braces-around-statements check with suitable defaults. Reviewers: djasper Reviewed By: djasper Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D5798 llvm-svn: 219923
* Add NamespaceCommentCheck to the Google module.Alexander Kornienko2014-09-221-0/+127
Summary: This uses a bit hacky way to set the defaults for the spaces before comments, but it's also one of the simplest ways. Fixed a bug with how the SpacesBeforeComments option was used. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5410 llvm-svn: 218240
OpenPOWER on IntegriCloud