[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2018-03-14 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh accepted this revision. alexfh added a comment. This revision is now accepted and ready to land. Herald added a subscriber: xazax.hun. It looks like all concerns were resolved. LG, if you still want to proceed with this patch. https://reviews.llvm.org/D23130 __

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2018-03-14 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment. I'd like to, but I don't know when I find time to rebase this thing after more than a year of waiting for review. https://reviews.llvm.org/D23130 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2018-03-15 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment. In https://reviews.llvm.org/D23130#1037256, @bkramer wrote: > I'd like to, but I don't know when I find time to rebase this thing after > more than a year of waiting for review. Sorry, it was just lost ¯\_(ツ)_/¯. I may be relying on pings from the other side too much.

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-11-16 Thread Benjamin Kramer via cfe-commits
bkramer marked 2 inline comments as done. bkramer added inline comments. Comment at: test/clang-tidy/google-global-names.cpp:13-14 +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'i' declared in the global namespace +extern int ii = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:12: warning:

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-11-16 Thread Aaron Ballman via cfe-commits
aaron.ballman added a reviewer: aaron.ballman. aaron.ballman added inline comments. Comment at: clang-tidy/google/GlobalNamesCheck.cpp:62 +Result.SourceManager->getExpansionLoc(D->getLocStart( { + // unless that file is a header. + if (!utils::isSpelling

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-12-07 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer updated this revision to Diff 80574. bkramer marked 9 inline comments as done. bkramer added a comment. Herald added a subscriber: JDevlieghere. - Moved external linkage check to matcher - added msvcrt entry point check - fixed comment typos. https://reviews.llvm.org/D23130 Files: cla

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-12-07 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments. Comment at: clang-tidy/google/GlobalNamesCheck.cpp:90 +// extern "C" globals need to be in the global namespace. +if (VDecl->isExternC()) + return; alexfh wrote: > Is this already filtered-out by the matcher? Nope. ==

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-12-07 Thread Malcolm Parsons via Phabricator via cfe-commits
malcolm.parsons added inline comments. Comment at: clang-tidy/google/GoogleTidyModule.cpp:68 +CheckFactories.registerCheck( +"google-global-names"); CheckFactories.registerCheck( bkramer wrote: > aaron.ballman wrote: > > Given that this was shipp

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-11-07 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. Benjamin, what's the plan here? https://reviews.llvm.org/D23130 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-11-08 Thread Benjamin Kramer via cfe-commits
bkramer updated this revision to Diff 77216. bkramer added a comment. Herald added subscribers: modocache, mgorny. Update to head https://reviews.llvm.org/D23130 Files: clang-tidy/google/CMakeLists.txt clang-tidy/google/GlobalNamesCheck.cpp clang-tidy/google/GlobalNamesCheck.h clang-tid

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-11-08 Thread Benjamin Kramer via cfe-commits
bkramer added a comment. In https://reviews.llvm.org/D23130#588681, @alexfh wrote: > Benjamin, what's the plan here? I still think this check is useful, particularly for LLVM. I also don't think any of the existing review comments still apply or have ever applied in the first place, so I reba

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-11-08 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tidy/google/GlobalNamesCheck.cpp:77 +} +diag( +D->getLocStart(), Is this formatting that clang-format generates? Comment at: test/clang-tidy/google-global-names.cpp:13-14 +/

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-11-08 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. > and generally frowned upon in many codebases (e.g. LLVM) Should it still be a part of google/? The old check was enforcing a part of the Google C++ style guide, but the new one seems to be somewhat broader. Am I mistaken? https://reviews.llvm.org/D23130 __

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-11-09 Thread Benjamin Kramer via cfe-commits
bkramer updated this revision to Diff 77410. bkramer added a comment. Add extern "C++" test case. https://reviews.llvm.org/D23130 Files: clang-tidy/google/CMakeLists.txt clang-tidy/google/GlobalNamesCheck.cpp clang-tidy/google/GlobalNamesCheck.h clang-tidy/google/GlobalNamesInHeadersChe

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-11-09 Thread Benjamin Kramer via cfe-commits
bkramer marked 2 inline comments as done. bkramer added a comment. In https://reviews.llvm.org/D23130#589643, @alexfh wrote: > > and generally frowned upon in many codebases (e.g. LLVM) > > Should it still be a part of google/? The old check was enforcing a part of > the Google C++ style guide,

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-11-10 Thread Malcolm Parsons via cfe-commits
malcolm.parsons added inline comments. Comment at: clang-tidy/google/GlobalNamesCheck.cpp:96 +// main() should be in the global namespace. +if (FDecl->isMain()) + return; Should `isMSVCRTEntryPoint()` be checked too? https://reviews.llvm.org/D23130

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-11-10 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments. Comment at: test/clang-tidy/google-global-names.cpp:13-14 +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'i' declared in the global namespace +extern int ii = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'ii' declared in the global namespa

[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2023-09-21 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added a comment. Herald added a subscriber: wangpc. Herald added a project: All. Is this still relevant? It looks like some of these changes made it in. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D23130/new/ https://reviews.llvm.org/D23130 _

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-03 Thread Benjamin Kramer via cfe-commits
bkramer updated this revision to Diff 66716. bkramer added a comment. Add relnote. https://reviews.llvm.org/D23130 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/GlobalNamespaceCheck.cpp clang-tidy/misc/GlobalNamespaceCheck.h clang-tidy/misc/MiscTidyModule.cpp docs/ReleaseNotes

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-03 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. Do we want to merge this check with google/GlobalNamesInHeadersCheck.cpp that targets a similar set of issues? Repository: rL LLVM https://reviews.llvm.org/D23130 ___ cfe-commits mailing list cfe-commits@lists.llvm.org ht

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-03 Thread Aaron Ballman via cfe-commits
On Wed, Aug 3, 2016 at 5:17 PM, Alexander Kornienko wrote: > alexfh added a comment. > > Do we want to merge this check with google/GlobalNamesInHeadersCheck.cpp that > targets a similar set of issues? We also have misc/DefinitionsInHeadersCheck.cpp which is likely similar. ~Aaron > > > Reposi

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-03 Thread Benjamin Kramer via cfe-commits
bkramer added a comment. DefinitionsInHeaders is tackling a different problem. IMO DefinitionsInHeaders is something that should be on by default everywhere, while this check for definitions in the global namespace is more of a coding style issue. GlobalNamesInHeaders is a bit of a misnomer, it

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-03 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. In https://reviews.llvm.org/D23130#505242, @bkramer wrote: > DefinitionsInHeaders is tackling a different problem. IMO > DefinitionsInHeaders is something that should be on by default everywhere, > while this check for definitions in the global namespace is more of a cod

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-03 Thread Piotr Padlewski via cfe-commits
Prazek added inline comments. Comment at: clang-tidy/misc/GlobalNamespaceCheck.cpp:46 @@ +45,3 @@ +// extern "C" globals need to be in the global namespace. +if (VDecl->isExternC()) + return; I think it would be better to check it in matcher. I see th

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-04 Thread Benjamin Kramer via cfe-commits
bkramer added a comment. In https://reviews.llvm.org/D23130#505290, @alexfh wrote: > And the second difference is that it is limited to definitions, but I don't > yet understand, why it is important, since declarations in the global > namespace (except for using declarations, typedefs, etc.) wi

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-04 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tidy/misc/GlobalNamespaceCheck.cpp:72 @@ +71,3 @@ + "move it into a namespace or give it " + "internal linkage to avoid ODR conflicts") + << MatchedDecl;

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-04 Thread Benjamin Kramer via cfe-commits
bkramer updated this revision to Diff 66792. bkramer added a comment. - Merge google-global-names-in-headers and misc-global-namespace into a new check google-global-names. https://reviews.llvm.org/D23130 Files: clang-tidy/google/CMakeLists.txt clang-tidy/google/GlobalNamesCheck.cpp clan

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-04 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. Could you run the check on LLVM and post a summary of results? Comment at: clang-tidy/google/GlobalNamesCheck.cpp:90 @@ +89,3 @@ +// extern "C" globals need to be in the global namespace. +if (VDecl->isExternC()) + return; Is

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-04 Thread Benjamin Kramer via cfe-commits
bkramer updated this revision to Diff 66800. bkramer added a comment. Address review comments. https://reviews.llvm.org/D23130 Files: clang-tidy/google/CMakeLists.txt clang-tidy/google/GlobalNamesCheck.cpp clang-tidy/google/GlobalNamesCheck.h clang-tidy/google/GlobalNamesInHeadersCheck.

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-04 Thread Benjamin Kramer via cfe-commits
bkramer added a comment. In https://reviews.llvm.org/D23130#505769, @alexfh wrote: > Could you run the check on LLVM and post a summary of results? I have a full list at https://reviews.llvm.org/P7085. It's huge. https://reviews.llvm.org/D23130 _

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-04 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment. For cases where the external linkage is desired, how would you go about silencing this diagnostic? Comment at: test/clang-tidy/google-global-names.cpp:13-14 @@ +12,4 @@ +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'i' declared in the global names

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-04 Thread Benjamin Kramer via cfe-commits
bkramer added inline comments. Comment at: test/clang-tidy/google-global-names.cpp:13-14 @@ +12,4 @@ +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'i' declared in the global namespace +extern int ii = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'ii' declared in the global na

Re: [PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2016-08-04 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments. Comment at: test/clang-tidy/google-global-names.cpp:13-14 @@ +12,4 @@ +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'i' declared in the global namespace +extern int ii = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'ii' declared in the glob