[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2019-01-11 Thread Miklos Vajna via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL350922: [clang-tidy] new check 'readability-redundant-preprocessor' (authored by vmiklos, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D543

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-16 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos added a comment. In https://reviews.llvm.org/D54349#1301663, @aaron.ballman wrote: > I think this check is in good shape for the initial commit. Additional > functionality can be added incrementally. OK, thanks. I'll lcommit this once https://reviews.llvm.org/D54450 is committed. htt

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. I think this check is in good shape for the initial commit. Additional functionality can be added incrementally. Comment at: test/clang-tidy/readability-redund

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-16 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos marked an inline comment as done. vmiklos added inline comments. Comment at: test/clang-tidy/readability-redundant-preprocessor.cpp:53 +// CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #if; consider removing it [readability-redundant-preprocessor] +#if FOO == 3 +

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: test/clang-tidy/readability-redundant-preprocessor.cpp:53 +// CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #if; consider removing it [readability-redundant-preprocessor] +#if FOO == 3 + 1 +// CHECK-NOTES: [[@LINE-3]]:2: n

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-16 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos marked 2 inline comments as done. vmiklos added inline comments. Comment at: clang-tidy/readability/RedundantPreprocessorCheck.cpp:37 +CheckMacroRedundancy(Loc, Condition, IfStack, + "nested redundant if; consider removing it", +

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-16 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos updated this revision to Diff 174439. https://reviews.llvm.org/D54349 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/readability/RedundantPreprocessorCheck.cpp clang-tidy/readability/RedundantPreprocessorCheck.h docs/Rele

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tidy/readability/RedundantPreprocessorCheck.cpp:37 +CheckMacroRedundancy(Loc, Condition, IfStack, + "nested redundant if; consider removing it", + "previous if was here", tr

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-14 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos updated this revision to Diff 174021. vmiklos marked 2 inline comments as done. https://reviews.llvm.org/D54349 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/readability/RedundantPreprocessorCheck.cpp clang-tidy/readabilit

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-14 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos marked 2 inline comments as done. vmiklos added inline comments. Comment at: clang-tidy/readability/ReadabilityTidyModule.cpp:84 +CheckFactories.registerCheck( +"readability-redundant-preprocessor"); CheckFactories.registerCheck( aaron.ba

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tidy/readability/ReadabilityTidyModule.cpp:84 +CheckFactories.registerCheck( +"readability-redundant-preprocessor"); CheckFactories.registerCheck( Please keep this list sorted alphabetically.

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-11 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added inline comments. Comment at: clang-tidy/readability/RedundantPreprocessorCheck.cpp:56-59 +StringRef SourceText = +Lexer::getSourceText(CharSourceRange::getTokenRange(ConditionRange), + PP.getSourceManager(), PP.getLangOpts()

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-11 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos updated this revision to Diff 173575. vmiklos marked an inline comment as done. https://reviews.llvm.org/D54349 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/readability/RedundantPreprocessorCheck.cpp clang-tidy/readabilit

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-11 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos marked 2 inline comments as done. vmiklos added inline comments. Comment at: clang-tidy/readability/RedundantPreprocessorCheck.cpp:56-59 +StringRef SourceText = +Lexer::getSourceText(CharSourceRange::getTokenRange(ConditionRange), +

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-11 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added inline comments. Comment at: clang-tidy/readability/RedundantPreprocessorCheck.cpp:56-59 +StringRef SourceText = +Lexer::getSourceText(CharSourceRange::getTokenRange(ConditionRange), + PP.getSourceManager(), PP.getLangOpts()

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-11 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos marked an inline comment as done. vmiklos added inline comments. Comment at: docs/clang-tidy/checks/readability-redundant-preprocessor.rst:34 + + #ifdef FOO + #ifndef FOO // inner ifndef is considered redundant JonasToth wrote: > The indendation for these

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-11 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos updated this revision to Diff 173572. https://reviews.llvm.org/D54349 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/readability/RedundantPreprocessorCheck.cpp clang-tidy/readability/RedundantPreprocessorCheck.h docs/Rele

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-11 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added inline comments. Comment at: docs/clang-tidy/checks/readability-redundant-preprocessor.rst:34 + + #ifdef FOO + #ifndef FOO // inner ifndef is considered redundant The indendation for these examples (following as well) is not enough. Please use 2

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-11 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos added a comment. In https://reviews.llvm.org/D54349#1294600, @vmiklos wrote: > Let's see if that works in practice. I've implemented this now, please take a look. (Extended test + docs as well, as usual.) Thanks! https://reviews.llvm.org/D54349

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-11 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos updated this revision to Diff 173556. vmiklos marked an inline comment as done. https://reviews.llvm.org/D54349 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/readability/RedundantPreprocessorCheck.cpp clang-tidy/readabilit

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-11 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos marked an inline comment as done. vmiklos added a comment. > As it stands, I feel like this check is a bit too simplistic to have much > value, but if you covered some of these other cases, it would alleviate that > worry for me. I've now added support for detecting inverted conditions

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-11 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos updated this revision to Diff 173554. https://reviews.llvm.org/D54349 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/readability/RedundantPreprocessorCheck.cpp clang-tidy/readability/RedundantPreprocessorCheck.h docs/Rele

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In https://reviews.llvm.org/D54349#1294325, @vmiklos wrote: > > What do you think about code like: > > > > #if FOO == 4 > > #if FOO == 4 > > #endif > > #endif > > > > #if defined(FOO) > > #if defined(FOO) > > #endif > > #endif > > > > #if !d

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-10 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added inline comments. Comment at: clang-tidy/readability/RedundantPreprocessorCheck.cpp:19-22 +struct Entry { + SourceLocation Loc; + std::string MacroName; +}; vmiklos wrote: > Szelethus wrote: > > This is a way too general name in my opinion. Eithe

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-10 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos updated this revision to Diff 173526. vmiklos marked an inline comment as done. https://reviews.llvm.org/D54349 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/readability/RedundantPreprocessorCheck.cpp clang-tidy/readabilit

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-10 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos marked an inline comment as done. vmiklos added inline comments. Comment at: clang-tidy/readability/RedundantPreprocessorCheck.cpp:19-22 +struct Entry { + SourceLocation Loc; + std::string MacroName; +}; Szelethus wrote: > This is a way too general name

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-10 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos added a comment. > What do you think about code like: > > #if FOO == 4 > #if FOO == 4 > #endif > #endif > > #if defined(FOO) > #if defined(FOO) > #endif > #endif > > #if !defined(FOO) > #if !defined(FOO) > #endif > #endif I looked at supporting these, but it

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-10 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos updated this revision to Diff 173524. https://reviews.llvm.org/D54349 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/readability/RedundantPreprocessorCheck.cpp clang-tidy/readability/RedundantPreprocessorCheck.h docs/Rele

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-10 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added inline comments. Comment at: clang-tidy/readability/RedundantPreprocessorCheck.cpp:19-22 +struct Entry { + SourceLocation Loc; + std::string MacroName; +}; This is a way too general name in my opinion. Either include comments that describe it,

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-10 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment. > Done. Please also mark the inline comments as done. Otherwise its hard to follow if there are outstanding issues somewhere, especially if code moves around. https://reviews.llvm.org/D54349 ___ cfe-commits mailing list

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. What do you think about code like: #if FOO == 4 #if FOO == 4 #endif #endif #if defined(FOO) #if defined(FOO) #endif #endif #if !defined(FOO) #if !defined(FOO) #endif #endif #if defined(FOO) #if !defined(FOO) #endif #endif

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-09 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos updated this revision to Diff 173468. vmiklos edited the summary of this revision. https://reviews.llvm.org/D54349 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/readability/RedundantPreprocessorCheck.cpp clang-tidy/readabi

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-09 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos added a comment. > preprocessor directives? Same in documentation. Done. https://reviews.llvm.org/D54349 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-09 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos added a comment. > I think that name is not very descriptive for the user of clang-tidy. `pp` > should be `preprocessor` or some other constellation that makes it very clear > its about the preprocessor. Done, renamed to readability-redundant-preprocessor. > you are in namespace `clang

[PATCH] D54349: [clang-tidy] new check 'readability-redundant-preprocessor'

2018-11-09 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos updated this revision to Diff 173465. vmiklos retitled this revision from "[clang-tidy] new check 'readability-redundant-pp'" to "[clang-tidy] new check 'readability-redundant-preprocessor'". https://reviews.llvm.org/D54349 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/rea