Re: [PATCH] D24881: [clang-tidy] Cleaning up language options.

2016-09-23 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Thank you for the cleanup! Please clang-format-diff the files before 
submitting. Otherwise looks good.


Repository:
  rL LLVM

https://reviews.llvm.org/D24881



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24881: [clang-tidy] Cleaning up language options.

2016-09-23 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

I think it's reasonable to compile code in C++11 with minimal changes (only 
modernize-replace-auto-ptr is really needed) and test it before further 
modernization.


Repository:
  rL LLVM

https://reviews.llvm.org/D24881



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24881: [clang-tidy] Cleaning up language options.

2016-09-23 Thread Gábor Horváth via cfe-commits
xazax.hun added a comment.

In https://reviews.llvm.org/D24881#551487, @Eugene.Zelenko wrote:

> I think will be good idea to enable modernize-loop-convert, 
> modernize-use-auto, modernize-use-default, modernize-use-nullptr only in 
> C++11 mode.
>
> Probably modernize-avoid-bind code code be simplified too.


As far as I can see there is a discrepancy between these modernization checks. 
Loop convert, use auto, use default, use nullptr is registered for older 
standards deliberately.

See the following comment:

  // Only register the matchers for C++. Because this checker is used for
  // modernization, it is reasonable to run it on any C++ standard with the
  // assumption the user is trying to modernize their codebase.

So basically the question is: should we require the users to run the clang tidy 
in C++11 mode (hence change their build settings) to get these modernization 
checks?

I am okay with either of the answers but I wonder what do you think.


Repository:
  rL LLVM

https://reviews.llvm.org/D24881



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24881: [clang-tidy] Cleaning up language options.

2016-09-23 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

I think will be good idea to enable modernize-loop-convert, modernize-use-auto, 
modernize-use-default, modernize-use-nullptr only in C++11 mode.

Probably modernize-avoid-bind code code be simplified too.


Repository:
  rL LLVM

https://reviews.llvm.org/D24881



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24881: [clang-tidy] Cleaning up language options.

2016-09-23 Thread Gábor Horváth via cfe-commits
xazax.hun created this revision.
xazax.hun added reviewers: hokein, alexfh.
xazax.hun added a subscriber: cfe-commits.
xazax.hun set the repository for this revision to rL LLVM.
xazax.hun added a project: clang-tools-extra.
Herald added a subscriber: nemanjai.

In some cases do not register the matcher when the check method of a checker 
should not run anyways.

Refactor some checks to use a shorter way to get language options.

Repository:
  rL LLVM

https://reviews.llvm.org/D24881

Files:
  clang-tidy/cert/StrToNumCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp
  clang-tidy/google/AvoidCStyleCastsCheck.cpp
  clang-tidy/google/ExplicitConstructorCheck.cpp
  clang-tidy/llvm/TwineLocalCheck.cpp
  clang-tidy/misc/AssertSideEffectCheck.cpp
  clang-tidy/misc/InaccurateEraseCheck.cpp
  clang-tidy/misc/InefficientAlgorithmCheck.cpp
  clang-tidy/misc/StringIntegerAssignmentCheck.cpp
  clang-tidy/misc/SuspiciousStringCompareCheck.cpp
  clang-tidy/misc/UniqueptrResetReleaseCheck.cpp
  clang-tidy/misc/UnusedAliasDeclsCheck.cpp
  clang-tidy/misc/UnusedRAIICheck.cpp
  clang-tidy/misc/UnusedUsingDeclsCheck.cpp
  clang-tidy/modernize/PassByValueCheck.cpp
  clang-tidy/modernize/RawStringLiteralCheck.cpp
  clang-tidy/modernize/RedundantVoidArgCheck.cpp
  clang-tidy/modernize/ShrinkToFitCheck.cpp
  clang-tidy/modernize/UseOverrideCheck.cpp
  clang-tidy/mpi/TypeMismatchCheck.cpp
  clang-tidy/readability/AvoidConstParamsInDecls.cpp
  clang-tidy/readability/ContainerSizeEmptyCheck.cpp
  clang-tidy/readability/NamespaceCommentCheck.cpp
  clang-tidy/readability/RedundantControlFlowCheck.cpp
  clang-tidy/readability/RedundantSmartptrGetCheck.cpp
  clang-tidy/readability/SimplifyBooleanExprCheck.cpp
  clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp
  clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp

Index: clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
===
--- clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
+++ clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
@@ -53,7 +53,7 @@
 
   SourceLocation AfterPtr =
   Lexer::getLocForEndOfToken(PtrExpr->getLocEnd(), 0, *Result.SourceManager,
- Result.Context->getLangOpts());
+ getLangOpts());
 
   diag(DeleteExpr->getLocStart(),
"prefer '= nullptr' to 'delete x.release()' to reset unique_ptr<> "
Index: clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp
===
--- clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp
+++ clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp
@@ -54,11 +54,11 @@
   SourceLocation Loc = Def->getSourceRange().getBegin();
   while (Loc < Def->getSourceRange().getEnd() &&
  !Lexer::getRawToken(Loc, Tok, *Result.SourceManager,
- Result.Context->getLangOpts(), true)) {
+ getLangOpts(), true)) {
 SourceRange TokenRange(Tok.getLocation(), Tok.getEndLoc());
 StringRef SourceText = Lexer::getSourceText(
 CharSourceRange::getTokenRange(TokenRange),
-*Result.SourceManager, Result.Context->getLangOpts());
+*Result.SourceManager, getLangOpts());
 if (SourceText == "static") {
   Diag << FixItHint::CreateRemoval(TokenRange);
   break;
Index: clang-tidy/readability/SimplifyBooleanExprCheck.cpp
===
--- clang-tidy/readability/SimplifyBooleanExprCheck.cpp
+++ clang-tidy/readability/SimplifyBooleanExprCheck.cpp
@@ -561,7 +561,7 @@
 StringRef Replacement) {
   CharSourceRange CharRange = Lexer::makeFileCharRange(
   CharSourceRange::getTokenRange(ReplacementRange), *Result.SourceManager,
-  Result.Context->getLangOpts());
+  getLangOpts());
 
   DiagnosticBuilder Diag = diag(Loc, Description);
   if (!containsDiscardedTokens(Result, CharRange))
Index: clang-tidy/readability/RedundantSmartptrGetCheck.cpp
===
--- clang-tidy/readability/RedundantSmartptrGetCheck.cpp
+++ clang-tidy/readability/RedundantSmartptrGetCheck.cpp
@@ -119,7 +119,7 @@
 
   StringRef SmartptrText = Lexer::getSourceText(
   CharSourceRange::getTokenRange(Smartptr->getSourceRange()),
-  *Result.SourceManager, Result.Context->getLangOpts());
+  *Result.SourceManager, getLangOpts());
   // Replace foo->get() with *foo, and foo.get() with foo.
   std::string Replacement = Twine(IsPtrToPtr ? "*" : "", SmartptrText).str();
   diag(GetCall->getLocStart(), "redundant get() call on smart pointer")
Index: clang-tidy/readability/RedundantControlFlowCheck.cpp
===
--- clang-tidy/readability/RedundantControlFlowCheck.cpp
+++ clang-tidy/readability/RedundantControlFlowCheck.cpp
@@ -81,14