[clang-tools-extra] r286221 - [clang-tools-extra] Format sources with clang-format. NFC.
Mandeep Singh Grang via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 7 23:50:20 PST 2016
Author: mgrang
Date: Tue Nov 8 01:50:19 2016
New Revision: 286221
URL: http://llvm.org/viewvc/llvm-project?rev=286221&view=rev
Log:
[clang-tools-extra] Format sources with clang-format. NFC.
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
Modified:
clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
clang-tools-extra/trunk/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
clang-tools-extra/trunk/clang-move/ClangMove.cpp
clang-tools-extra/trunk/clang-move/ClangMove.h
clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
clang-tools-extra/trunk/clang-query/Query.cpp
clang-tools-extra/trunk/clang-query/Query.h
clang-tools-extra/trunk/clang-query/QueryParser.cpp
clang-tools-extra/trunk/clang-query/QueryParser.h
clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h
clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp
clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h
clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp
clang-tools-extra/trunk/clang-tidy/cert/LimitedRandomnessCheck.cpp
clang-tools-extra/trunk/clang-tidy/cert/StaticObjectExceptionCheck.cpp
clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp
clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.h
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp
clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp
clang-tools-extra/trunk/clang-tidy/google/ExplicitMakePairCheck.cpp
clang-tools-extra/trunk/clang-tidy/google/GlobalNamesInHeadersCheck.cpp
clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.cpp
clang-tools-extra/trunk/clang-tidy/google/IntegerTypesCheck.cpp
clang-tools-extra/trunk/clang-tidy/google/MemsetZeroLengthCheck.cpp
clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp
clang-tools-extra/trunk/clang-tidy/google/OverloadedUnaryAndCheck.cpp
clang-tools-extra/trunk/clang-tidy/google/StringReferenceMemberCheck.cpp
clang-tools-extra/trunk/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp
clang-tools-extra/trunk/clang-tidy/google/UsingNamespaceDirectiveCheck.cpp
clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h
clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.h
clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/ForwardDeclarationNamespaceCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/ForwardDeclarationNamespaceCheck.h
clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.cpp
clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.h
clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MacroRepeatedSideEffectsCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp
clang-tools-extra/trunk/clang-tidy/misc/MisplacedWideningCastCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MultipleStatementMacroCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/NewDeleteOverloadsCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/NewDeleteOverloadsCheck.h
clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.h
clang-tools-extra/trunk/clang-tidy/misc/NonCopyableObjects.h
clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.h
clang-tools-extra/trunk/clang-tidy/misc/SizeofExpressionCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.h
clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.h
clang-tools-extra/trunk/clang-tidy/misc/SuspiciousStringCompareCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp
clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetReleaseCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.h
clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.h
clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/UseAfterMoveCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/AvoidBindCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.h
clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp
clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.h
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
clang-tools-extra/trunk/clang-tidy/mpi/TypeMismatchCheck.h
clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp
clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.h
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp
clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.h
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/RedundantStringInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.h
clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
clang-tools-extra/trunk/clang-tidy/utils/Matchers.h
clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp
clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp
clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.cpp
clang-tools-extra/trunk/tool-template/ToolTemplate.cpp
Modified: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp (original)
+++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp Tue Nov 8 01:50:19 2016
@@ -345,7 +345,8 @@ void ChangeNamespaceTool::run(
} else if (const auto *TLoc = Result.Nodes.getNodeAs<TypeLoc>("type")) {
fixTypeLoc(Result, startLocationForType(*TLoc), EndLocationForType(*TLoc),
*TLoc);
- } else if (const auto *VarRef = Result.Nodes.getNodeAs<DeclRefExpr>("var_ref")){
+ } else if (const auto *VarRef =
+ Result.Nodes.getNodeAs<DeclRefExpr>("var_ref")) {
const auto *Var = Result.Nodes.getNodeAs<VarDecl>("var_decl");
assert(Var);
if (Var->getCanonicalDecl()->isStaticDataMember())
@@ -358,8 +359,8 @@ void ChangeNamespaceTool::run(
VarRefRange.getEnd(), Name);
} else {
const auto *Call = Result.Nodes.getNodeAs<clang::CallExpr>("call");
- assert(Call != nullptr &&"Expecting callback for CallExpr.");
- const clang::FunctionDecl* Func = Call->getDirectCallee();
+ assert(Call != nullptr && "Expecting callback for CallExpr.");
+ const clang::FunctionDecl *Func = Call->getDirectCallee();
assert(Func != nullptr);
// Ignore out-of-line static methods since they will be handled by nested
// name specifiers.
@@ -548,7 +549,8 @@ void ChangeNamespaceTool::fixUsingShadow
const UsingDecl *UsingDeclaration) {
SourceLocation Start = UsingDeclaration->getLocStart();
SourceLocation End = UsingDeclaration->getLocEnd();
- if (Start.isInvalid() || End.isInvalid()) return;
+ if (Start.isInvalid() || End.isInvalid())
+ return;
assert(UsingDeclaration->shadow_size() > 0);
// FIXME: it might not be always accurate to use the first using-decl.
Modified: clang-tools-extra/trunk/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h (original)
+++ clang-tools-extra/trunk/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h Tue Nov 8 01:50:19 2016
@@ -38,8 +38,7 @@ namespace replace {
typedef std::vector<clang::tooling::Range> RangeVector;
/// \brief Collection of TranslationUnitReplacements.
-typedef std::vector<clang::tooling::TranslationUnitReplacements>
-TUReplacements;
+typedef std::vector<clang::tooling::TranslationUnitReplacements> TUReplacements;
/// \brief Collection of TranslationUnitReplacement files.
typedef std::vector<std::string> TUReplacementFiles;
@@ -66,11 +65,9 @@ typedef llvm::DenseMap<const clang::File
///
/// \returns An error_code indicating success or failure in navigating the
/// directory structure.
-std::error_code
-collectReplacementsFromDirectory(const llvm::StringRef Directory,
- TUReplacements &TUs,
- TUReplacementFiles &TURFiles,
- clang::DiagnosticsEngine &Diagnostics);
+std::error_code collectReplacementsFromDirectory(
+ const llvm::StringRef Directory, TUReplacements &TUs,
+ TUReplacementFiles &TURFiles, clang::DiagnosticsEngine &Diagnostics);
/// \brief Deduplicate, check for conflicts, and apply all Replacements stored
/// in \c TUs. If conflicts occur, no Replacements are applied.
@@ -115,7 +112,7 @@ bool applyReplacements(const FileToRepla
/// \pre Replacements[i].getOffset() <= Replacements[i+1].getOffset().
///
/// \param[in] Replacements Replacements from a single file.
-///
+///
/// \returns Collection of source ranges that enclose all given Replacements.
/// One range is created for each replacement.
RangeVector calculateChangedRanges(
Modified: clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp (original)
+++ clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp Tue Nov 8 01:50:19 2016
@@ -30,17 +30,14 @@
using namespace llvm;
using namespace clang;
-
static void eatDiagnostics(const SMDiagnostic &, void *) {}
namespace clang {
namespace replace {
-std::error_code
-collectReplacementsFromDirectory(const llvm::StringRef Directory,
- TUReplacements &TUs,
- TUReplacementFiles & TURFiles,
- clang::DiagnosticsEngine &Diagnostics) {
+std::error_code collectReplacementsFromDirectory(
+ const llvm::StringRef Directory, TUReplacements &TUs,
+ TUReplacementFiles &TURFiles, clang::DiagnosticsEngine &Diagnostics) {
using namespace llvm::sys::fs;
using namespace llvm::sys::path;
@@ -128,7 +125,7 @@ bool applyAllReplacements(const std::vec
Rewriter &Rewrite) {
bool Result = true;
for (std::vector<tooling::Replacement>::const_iterator I = Replaces.begin(),
- E = Replaces.end();
+ E = Replaces.end();
I != E; ++I) {
if (I->isApplicable()) {
Result = I->apply(Rewrite) && Result;
@@ -139,11 +136,10 @@ bool applyAllReplacements(const std::vec
return Result;
}
-
// FIXME: moved from libToolingCore. remove this when std::vector<Replacement>
// is replaced with tooling::Replacements class.
static void deduplicate(std::vector<tooling::Replacement> &Replaces,
- std::vector<tooling::Range> &Conflicts) {
+ std::vector<tooling::Range> &Conflicts) {
if (Replaces.empty())
return;
Modified: clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp (original)
+++ clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp Tue Nov 8 01:50:19 2016
@@ -43,7 +43,6 @@ static cl::opt<bool> RemoveTUReplacement
"merging/replacing."),
cl::init(false), cl::cat(ReplacementCategory));
-
static cl::opt<bool> DoFormat(
"format",
cl::desc("Enable formatting of code changed by applying replacements.\n"
@@ -63,8 +62,8 @@ static cl::opt<std::string> FormatStyleC
cl::init(""), cl::cat(FormattingCategory));
static cl::opt<std::string>
-FormatStyleOpt("style", cl::desc(format::StyleOptionHelpDescription),
- cl::init("LLVM"), cl::cat(FormattingCategory));
+ FormatStyleOpt("style", cl::desc(format::StyleOptionHelpDescription),
+ cl::init("LLVM"), cl::cat(FormattingCategory));
namespace {
// Helper object to remove the TUReplacement files (triggered by
@@ -75,9 +74,7 @@ public:
clang::DiagnosticsEngine &Diagnostics)
: TURFiles(Files), Diag(Diagnostics) {}
- ~ScopedFileRemover() {
- deleteReplacementFiles(TURFiles, Diag);
- }
+ ~ScopedFileRemover() { deleteReplacementFiles(TURFiles, Diag); }
private:
const TUReplacementFiles &TURFiles;
@@ -106,7 +103,8 @@ static void printVersion() {
static bool
getRewrittenData(const std::vector<tooling::Replacement> &Replacements,
Rewriter &Rewrites, std::string &Result) {
- if (Replacements.empty()) return true;
+ if (Replacements.empty())
+ return true;
if (!applyAllReplacements(Replacements, Rewrites))
return false;
@@ -206,8 +204,7 @@ int main(int argc, char **argv) {
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts(new DiagnosticOptions());
DiagnosticsEngine Diagnostics(
- IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()),
- DiagOpts.get());
+ IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts.get());
// Determine a formatting style from options.
format::FormatStyle FormatStyle;
Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-move/ClangMove.cpp (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.cpp Tue Nov 8 01:50:19 2016
@@ -25,14 +25,13 @@ namespace move {
namespace {
// FIXME: Move to ASTMatchers.
-AST_MATCHER(VarDecl, isStaticDataMember) {
- return Node.isStaticDataMember();
-}
+AST_MATCHER(VarDecl, isStaticDataMember) { return Node.isStaticDataMember(); }
AST_MATCHER_P(Decl, hasOutermostEnclosingClass,
ast_matchers::internal::Matcher<Decl>, InnerMatcher) {
- const auto* Context = Node.getDeclContext();
- if (!Context) return false;
+ const auto *Context = Node.getDeclContext();
+ if (!Context)
+ return false;
while (const auto *NextContext = Context->getParent()) {
if (isa<NamespaceDecl>(NextContext) ||
isa<TranslationUnitDecl>(NextContext))
@@ -46,7 +45,8 @@ AST_MATCHER_P(Decl, hasOutermostEnclosin
AST_MATCHER_P(CXXMethodDecl, ofOutermostEnclosingClass,
ast_matchers::internal::Matcher<CXXRecordDecl>, InnerMatcher) {
const CXXRecordDecl *Parent = Node.getParent();
- if (!Parent) return false;
+ if (!Parent)
+ return false;
while (const auto *NextParent =
dyn_cast<CXXRecordDecl>(Parent->getParent())) {
Parent = NextParent;
@@ -64,7 +64,7 @@ std::string MakeAbsolutePath(StringRef C
llvm::SmallString<128> AbsolutePath(Path);
if (std::error_code EC =
llvm::sys::fs::make_absolute(InitialDirectory, AbsolutePath))
- llvm::errs() << "Warning: could not make absolute file: '" << EC.message()
+ llvm::errs() << "Warning: could not make absolute file: '" << EC.message()
<< '\n';
llvm::sys::path::remove_dots(AbsolutePath, /*remove_dot_dot=*/true);
llvm::sys::path::native(AbsolutePath);
@@ -76,16 +76,17 @@ std::string MakeAbsolutePath(StringRef C
//
// The Path can be a path relative to the build directory, or retrieved from
// the SourceManager.
-std::string MakeAbsolutePath(const SourceManager& SM, StringRef Path) {
+std::string MakeAbsolutePath(const SourceManager &SM, StringRef Path) {
llvm::SmallString<128> AbsolutePath(Path);
if (std::error_code EC =
- SM.getFileManager().getVirtualFileSystem()->makeAbsolute(AbsolutePath))
- llvm::errs() << "Warning: could not make absolute file: '" << EC.message()
+ SM.getFileManager().getVirtualFileSystem()->makeAbsolute(
+ AbsolutePath))
+ llvm::errs() << "Warning: could not make absolute file: '" << EC.message()
<< '\n';
// Handle symbolic link path cases.
// We are trying to get the real file path of the symlink.
const DirectoryEntry *Dir = SM.getFileManager().getDirectory(
- llvm::sys::path::parent_path(AbsolutePath.str()));
+ llvm::sys::path::parent_path(AbsolutePath.str()));
if (Dir) {
StringRef DirName = SM.getFileManager().getCanonicalName(Dir);
SmallVector<char, 128> AbsoluteFilename;
@@ -156,7 +157,7 @@ getLocForEndOfDecl(const clang::Decl *D,
// FIXME: this is a bit hacky to get ReadToEndOfLine work.
Lex.setParsingPreprocessorDirective(true);
Lex.ReadToEndOfLine(&Line);
- SourceLocation EndLoc = D->getLocEnd().getLocWithOffset(Line.size());
+ SourceLocation EndLoc = D->getLocEnd().getLocWithOffset(Line.size());
// If we already reach EOF, just return the EOF SourceLocation;
// otherwise, move 1 offset ahead to include the trailing newline character
// '\n'.
@@ -172,14 +173,12 @@ GetFullRange(const clang::SourceManager
clang::SourceRange Full = D->getSourceRange();
Full.setEnd(getLocForEndOfDecl(D, SM));
// Expand to comments that are associated with the Decl.
- if (const auto* Comment =
- D->getASTContext().getRawCommentForDeclNoCache(D)) {
+ if (const auto *Comment = D->getASTContext().getRawCommentForDeclNoCache(D)) {
if (SM->isBeforeInTranslationUnit(Full.getEnd(), Comment->getLocEnd()))
Full.setEnd(Comment->getLocEnd());
// FIXME: Don't delete a preceding comment, if there are no other entities
// it could refer to.
- if (SM->isBeforeInTranslationUnit(Comment->getLocStart(),
- Full.getBegin()))
+ if (SM->isBeforeInTranslationUnit(Comment->getLocStart(), Full.getBegin()))
Full.setBegin(Comment->getLocStart());
}
@@ -228,8 +227,7 @@ std::vector<std::string> GetNamespaces(c
clang::tooling::Replacements
createInsertedReplacements(const std::vector<std::string> &Includes,
const std::vector<ClangMoveTool::MovedDecl> &Decls,
- llvm::StringRef FileName,
- bool IsHeader = false) {
+ llvm::StringRef FileName, bool IsHeader = false) {
std::string NewCode;
std::string GuardName(FileName);
if (IsHeader) {
@@ -325,8 +323,8 @@ void ClangMoveTool::registerMatchers(ast
auto InOldHeader = isExpansionInFile(
MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader));
- auto InOldCC = isExpansionInFile(
- MakeAbsolutePath(OriginalRunningDirectory, Spec.OldCC));
+ auto InOldCC =
+ isExpansionInFile(MakeAbsolutePath(OriginalRunningDirectory, Spec.OldCC));
auto InOldFiles = anyOf(InOldHeader, InOldCC);
auto InMovedClass =
hasOutermostEnclosingClass(cxxRecordDecl(*InMovedClassNames));
@@ -346,10 +344,10 @@ void ClangMoveTool::registerMatchers(ast
this);
// Match static member variable definition of the moved class.
- Finder->addMatcher(varDecl(InMovedClass, InOldCC, isDefinition(),
- isStaticDataMember())
- .bind("class_static_var_decl"),
- this);
+ Finder->addMatcher(
+ varDecl(InMovedClass, InOldCC, isDefinition(), isStaticDataMember())
+ .bind("class_static_var_decl"),
+ this);
auto InOldCCNamedNamespace =
allOf(hasParent(namespaceDecl(unless(isAnonymous()))), InOldCC);
@@ -357,10 +355,9 @@ void ClangMoveTool::registerMatchers(ast
// in classes, functions and anonymous namespaces are covered in other
// matchers.
Finder->addMatcher(
- namedDecl(
- anyOf(usingDecl(InOldCCNamedNamespace),
- usingDirectiveDecl(InOldCC, InOldCCNamedNamespace),
- typeAliasDecl(InOldCC, InOldCCNamedNamespace)))
+ namedDecl(anyOf(usingDecl(InOldCCNamedNamespace),
+ usingDirectiveDecl(InOldCC, InOldCCNamedNamespace),
+ typeAliasDecl(InOldCC, InOldCCNamedNamespace)))
.bind("using_decl"),
this);
@@ -373,11 +370,10 @@ void ClangMoveTool::registerMatchers(ast
auto IsOldCCStaticDefinition =
allOf(isDefinition(), unless(InMovedClass), InOldCCNamedNamespace,
isStaticStorageClass());
- Finder->addMatcher(
- namedDecl(anyOf(functionDecl(IsOldCCStaticDefinition),
- varDecl(IsOldCCStaticDefinition)))
- .bind("static_decls"),
- this);
+ Finder->addMatcher(namedDecl(anyOf(functionDecl(IsOldCCStaticDefinition),
+ varDecl(IsOldCCStaticDefinition)))
+ .bind("static_decls"),
+ this);
// Match forward declarations in old header.
Finder->addMatcher(
@@ -413,8 +409,8 @@ void ClangMoveTool::run(const ast_matche
MovedDecls.emplace_back(FWD, &Result.Context->getSourceManager());
}
}
- } else if (const auto *ANS = Result.Nodes.getNodeAs<clang::NamespaceDecl>(
- "anonymous_ns")) {
+ } else if (const auto *ANS =
+ Result.Nodes.getNodeAs<clang::NamespaceDecl>("anonymous_ns")) {
MovedDecls.emplace_back(ANS, &Result.Context->getSourceManager());
} else if (const auto *ND =
Result.Nodes.getNodeAs<clang::NamedDecl>("static_decls")) {
@@ -425,11 +421,10 @@ void ClangMoveTool::run(const ast_matche
}
}
-void ClangMoveTool::addIncludes(llvm::StringRef IncludeHeader,
- bool IsAngled,
+void ClangMoveTool::addIncludes(llvm::StringRef IncludeHeader, bool IsAngled,
llvm::StringRef SearchPath,
llvm::StringRef FileName,
- const SourceManager& SM) {
+ const SourceManager &SM) {
SmallVector<char, 128> HeaderWithSearchPath;
llvm::sys::path::append(HeaderWithSearchPath, SearchPath, IncludeHeader);
std::string AbsoluteOldHeader =
@@ -460,8 +455,8 @@ void ClangMoveTool::removeClassDefinitio
const auto &SM = *MovedDecl.SM;
auto Range = GetFullRange(&SM, MovedDecl.Decl);
clang::tooling::Replacement RemoveReplacement(
- *MovedDecl.SM, clang::CharSourceRange::getCharRange(
- Range.getBegin(), Range.getEnd()),
+ *MovedDecl.SM,
+ clang::CharSourceRange::getCharRange(Range.getBegin(), Range.getEnd()),
"");
std::string FilePath = RemoveReplacement.getFilePath().str();
auto Err = FileToReplacements[FilePath].add(RemoveReplacement);
Modified: clang-tools-extra/trunk/clang-move/ClangMove.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-move/ClangMove.h (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.h Tue Nov 8 01:50:19 2016
@@ -69,11 +69,9 @@ public:
/// in the file system. It can be a relative path or an absolute path.
/// \param FileName The name of file where the IncludeHeader comes from.
/// \param SM The SourceManager.
- void addIncludes(llvm::StringRef IncludeHeader,
- bool IsAngled,
- llvm::StringRef SearchPath,
- llvm::StringRef FileName,
- const SourceManager& SM);
+ void addIncludes(llvm::StringRef IncludeHeader, bool IsAngled,
+ llvm::StringRef SearchPath, llvm::StringRef FileName,
+ const SourceManager &SM);
private:
void removeClassDefinitionInOldFiles();
Modified: clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp (original)
+++ clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp Tue Nov 8 01:50:19 2016
@@ -77,8 +77,8 @@ int main(int argc, const char **argv) {
// Add "-fparse-all-comments" compile option to make clang parse all comments,
// otherwise, ordinary comments like "//" and "/*" won't get parsed (This is
// a bit of hacky).
- std::vector<std::string> ExtraArgs( argv, argv + argc );
- ExtraArgs.insert(ExtraArgs.begin()+1, "-extra-arg=-fparse-all-comments");
+ std::vector<std::string> ExtraArgs(argv, argv + argc);
+ ExtraArgs.insert(ExtraArgs.begin() + 1, "-extra-arg=-fparse-all-comments");
std::unique_ptr<const char *[]> RawExtraArgs(
new const char *[ExtraArgs.size()]);
for (size_t i = 0; i < ExtraArgs.size(); ++i)
@@ -90,7 +90,7 @@ int main(int argc, const char **argv) {
tooling::RefactoringTool Tool(OptionsParser.getCompilations(),
OptionsParser.getSourcePathList());
move::ClangMoveTool::MoveDefinitionSpec Spec;
- Spec.Names = { Names.begin(), Names.end() };
+ Spec.Names = {Names.begin(), Names.end()};
Spec.OldHeader = OldHeader;
Spec.NewHeader = NewHeader;
Spec.OldCC = OldCC;
Modified: clang-tools-extra/trunk/clang-query/Query.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/Query.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-query/Query.cpp (original)
+++ clang-tools-extra/trunk/clang-query/Query.cpp Tue Nov 8 01:50:19 2016
@@ -65,7 +65,7 @@ struct CollectBoundNodes : MatchFinder::
}
};
-} // namespace
+} // namespace
bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
unsigned MatchCount = 0;
@@ -100,11 +100,10 @@ bool MatchQuery::run(llvm::raw_ostream &
if (R.isValid()) {
TextDiagnostic TD(OS, AST->getASTContext().getLangOpts(),
&AST->getDiagnostics().getDiagnosticOptions());
- TD.emitDiagnostic(
- R.getBegin(), DiagnosticsEngine::Note,
- "\"" + BI->first + "\" binds here",
- CharSourceRange::getTokenRange(R),
- None, &AST->getSourceManager());
+ TD.emitDiagnostic(R.getBegin(), DiagnosticsEngine::Note,
+ "\"" + BI->first + "\" binds here",
+ CharSourceRange::getTokenRange(R), None,
+ &AST->getSourceManager());
}
break;
}
Modified: clang-tools-extra/trunk/clang-query/Query.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/Query.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-query/Query.h (original)
+++ clang-tools-extra/trunk/clang-query/Query.h Tue Nov 8 01:50:19 2016
@@ -18,11 +18,7 @@
namespace clang {
namespace query {
-enum OutputKind {
- OK_Diag,
- OK_Print,
- OK_Dump
-};
+enum OutputKind { OK_Diag, OK_Print, OK_Dump };
enum QueryKind {
QK_Invalid,
Modified: clang-tools-extra/trunk/clang-query/QueryParser.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/QueryParser.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-query/QueryParser.cpp (original)
+++ clang-tools-extra/trunk/clang-query/QueryParser.cpp Tue Nov 8 01:50:19 2016
@@ -76,9 +76,7 @@ template <typename T> struct QueryParser
return *this;
}
- T Default(const T& Value) const {
- return Switch.Default(Value);
- }
+ T Default(const T &Value) const { return Switch.Default(Value); }
};
// Lexes a word and stores it in Word. Returns a LexOrCompleteWord<T> object
@@ -101,9 +99,9 @@ QueryParser::lexOrCompleteWord(StringRef
QueryRef QueryParser::parseSetBool(bool QuerySession::*Var) {
StringRef ValStr;
unsigned Value = lexOrCompleteWord<unsigned>(ValStr)
- .Case("false", 0)
- .Case("true", 1)
- .Default(~0u);
+ .Case("false", 0)
+ .Case("true", 1)
+ .Default(~0u);
if (Value == ~0u) {
return new InvalidQuery("expected 'true' or 'false', got '" + ValStr + "'");
}
@@ -145,11 +143,7 @@ enum ParsedQueryKind {
PQK_Quit
};
-enum ParsedQueryVariable {
- PQV_Invalid,
- PQV_Output,
- PQV_BindRoot
-};
+enum ParsedQueryVariable { PQV_Invalid, PQV_Output, PQV_BindRoot };
QueryRef makeInvalidQueryFromDiagnostics(const Diagnostics &Diag) {
std::string ErrStr;
@@ -158,7 +152,7 @@ QueryRef makeInvalidQueryFromDiagnostics
return new InvalidQuery(OS.str());
}
-} // namespace
+} // namespace
QueryRef QueryParser::completeMatcherExpression() {
std::vector<MatcherCompletion> Comps = Parser::completeExpression(
Modified: clang-tools-extra/trunk/clang-query/QueryParser.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/QueryParser.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-query/QueryParser.h (original)
+++ clang-tools-extra/trunk/clang-query/QueryParser.h Tue Nov 8 01:50:19 2016
@@ -37,8 +37,7 @@ public:
private:
QueryParser(StringRef Line, const QuerySession &QS)
- : Begin(Line.begin()), End(Line.end()),
- CompletionPos(nullptr), QS(QS) {}
+ : Begin(Line.begin()), End(Line.end()), CompletionPos(nullptr), QS(QS) {}
StringRef lexWord();
Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp Tue Nov 8 01:50:19 2016
@@ -83,7 +83,7 @@ protected:
// applied).
if (Err) {
llvm::errs() << "Fix conflicts with existing fix! "
- << llvm::toString(std::move(Err)) << "\n";
+ << llvm::toString(std::move(Err)) << "\n";
assert(false && "Fix conflicts with existing fix!");
}
}
@@ -124,10 +124,9 @@ ClangTidyMessage::ClangTidyMessage(Strin
ClangTidyError::ClangTidyError(StringRef CheckName,
ClangTidyError::Level DiagLevel,
- bool IsWarningAsError,
- StringRef BuildDirectory)
- : CheckName(CheckName), BuildDirectory(BuildDirectory), DiagLevel(DiagLevel),
- IsWarningAsError(IsWarningAsError) {}
+ bool IsWarningAsError, StringRef BuildDirectory)
+ : CheckName(CheckName), BuildDirectory(BuildDirectory),
+ DiagLevel(DiagLevel), IsWarningAsError(IsWarningAsError) {}
// Returns true if GlobList starts with the negative indicator ('-'), removes it
// from the GlobList.
@@ -279,7 +278,7 @@ void ClangTidyDiagnosticConsumer::finali
LastErrorPassesLineFilter = false;
}
-static bool LineIsMarkedWithNOLINT(SourceManager& SM, SourceLocation Loc) {
+static bool LineIsMarkedWithNOLINT(SourceManager &SM, SourceLocation Loc) {
bool Invalid;
const char *CharacterData = SM.getCharacterData(Loc, &Invalid);
if (!Invalid) {
@@ -312,10 +311,10 @@ void ClangTidyDiagnosticConsumer::Handle
if (LastErrorWasIgnored && DiagLevel == DiagnosticsEngine::Note)
return;
- if (Info.getLocation().isValid() &&
- DiagLevel != DiagnosticsEngine::Error &&
+ if (Info.getLocation().isValid() && DiagLevel != DiagnosticsEngine::Error &&
DiagLevel != DiagnosticsEngine::Fatal &&
- LineIsMarkedWithNOLINTinMacro(Diags->getSourceManager(), Info.getLocation())) {
+ LineIsMarkedWithNOLINTinMacro(Diags->getSourceManager(),
+ Info.getLocation())) {
++Context.Stats.ErrorsIgnoredNOLINT;
// Ignored a warning, should ignore related notes as well
LastErrorWasIgnored = true;
Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h Tue Nov 8 01:50:19 2016
@@ -26,8 +26,9 @@ namespace tidy {
/// this object.
class ClangTidyCheckFactories {
public:
- typedef std::function<ClangTidyCheck *(
- StringRef Name, ClangTidyContext *Context)> CheckFactory;
+ typedef std::function<ClangTidyCheck *(StringRef Name,
+ ClangTidyContext *Context)>
+ CheckFactory;
/// \brief Registers check \p Factory with name \p Name.
///
@@ -58,8 +59,8 @@ public:
template <typename CheckType> void registerCheck(StringRef CheckName) {
registerCheckFactory(CheckName,
[](StringRef Name, ClangTidyContext *Context) {
- return new CheckType(Name, Context);
- });
+ return new CheckType(Name, Context);
+ });
}
/// \brief Create instances of all checks matching \p CheckRegexString and
Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp Tue Nov 8 01:50:19 2016
@@ -215,8 +215,7 @@ FileOptionsProvider::FileOptionsProvider
const ClangTidyOptions &OverrideOptions,
const FileOptionsProvider::ConfigFileHandlers &ConfigHandlers)
: DefaultOptionsProvider(GlobalOptions, DefaultOptions),
- OverrideOptions(OverrideOptions), ConfigHandlers(ConfigHandlers) {
-}
+ OverrideOptions(OverrideOptions), ConfigHandlers(ConfigHandlers) {}
// FIXME: This method has some common logic with clang::format::getStyle().
// Consider pulling out common bits to a findParentFileWithName function or
Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h Tue Nov 8 01:50:19 2016
@@ -173,7 +173,8 @@ public:
// \brief A pair of configuration file base name and a function parsing
// configuration from text in the corresponding format.
typedef std::pair<std::string, std::function<llvm::ErrorOr<ClangTidyOptions>(
- llvm::StringRef)>> ConfigFileHandler;
+ llvm::StringRef)>>
+ ConfigFileHandler;
/// \brief Configuration file handlers listed in the order of priority.
///
Modified: clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp Tue Nov 8 01:50:19 2016
@@ -34,8 +34,7 @@ public:
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
// C++ checkers
// DCL
- CheckFactories.registerCheck<VariadicFunctionDefCheck>(
- "cert-dcl50-cpp");
+ CheckFactories.registerCheck<VariadicFunctionDefCheck>("cert-dcl50-cpp");
CheckFactories.registerCheck<misc::NewDeleteOverloadsCheck>(
"cert-dcl54-cpp");
CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>(
@@ -46,37 +45,27 @@ public:
// ERR
CheckFactories.registerCheck<misc::ThrowByValueCatchByReferenceCheck>(
"cert-err09-cpp");
- CheckFactories.registerCheck<SetLongJmpCheck>(
- "cert-err52-cpp");
- CheckFactories.registerCheck<StaticObjectExceptionCheck>(
- "cert-err58-cpp");
- CheckFactories.registerCheck<ThrownExceptionTypeCheck>(
- "cert-err60-cpp");
+ CheckFactories.registerCheck<SetLongJmpCheck>("cert-err52-cpp");
+ CheckFactories.registerCheck<StaticObjectExceptionCheck>("cert-err58-cpp");
+ CheckFactories.registerCheck<ThrownExceptionTypeCheck>("cert-err60-cpp");
CheckFactories.registerCheck<misc::ThrowByValueCatchByReferenceCheck>(
"cert-err61-cpp");
// MSC
- CheckFactories.registerCheck<LimitedRandomnessCheck>(
- "cert-msc50-cpp");
+ CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc50-cpp");
// C checkers
// DCL
- CheckFactories.registerCheck<misc::StaticAssertCheck>(
- "cert-dcl03-c");
+ CheckFactories.registerCheck<misc::StaticAssertCheck>("cert-dcl03-c");
// ENV
- CheckFactories.registerCheck<CommandProcessorCheck>(
- "cert-env33-c");
+ CheckFactories.registerCheck<CommandProcessorCheck>("cert-env33-c");
// FLP
- CheckFactories.registerCheck<FloatLoopCounter>(
- "cert-flp30-c");
+ CheckFactories.registerCheck<FloatLoopCounter>("cert-flp30-c");
// FIO
- CheckFactories.registerCheck<misc::NonCopyableObjectsCheck>(
- "cert-fio38-c");
+ CheckFactories.registerCheck<misc::NonCopyableObjectsCheck>("cert-fio38-c");
// ERR
- CheckFactories.registerCheck<StrToNumCheck>(
- "cert-err34-c");
+ CheckFactories.registerCheck<StrToNumCheck>("cert-err34-c");
// MSC
- CheckFactories.registerCheck<LimitedRandomnessCheck>(
- "cert-msc30-c");
+ CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc30-c");
}
ClangTidyOptions getModuleOptions() override {
ClangTidyOptions Options;
@@ -89,8 +78,8 @@ public:
// Register the MiscTidyModule using this statically initialized variable.
static ClangTidyModuleRegistry::Add<cert::CERTModule>
-X("cert-module",
- "Adds lint checks corresponding to CERT secure coding guidelines.");
+ X("cert-module",
+ "Adds lint checks corresponding to CERT secure coding guidelines.");
// This anchor is used to force the linker to link in the generated object file
// and thus register the CERTModule.
Modified: clang-tools-extra/trunk/clang-tidy/cert/LimitedRandomnessCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/LimitedRandomnessCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/LimitedRandomnessCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/LimitedRandomnessCheck.cpp Tue Nov 8 01:50:19 2016
@@ -30,11 +30,9 @@ void LimitedRandomnessCheck::check(const
msg = "; use C++11 random library instead";
const auto *MatchedDecl = Result.Nodes.getNodeAs<CallExpr>("randomGenerator");
- diag(MatchedDecl->getLocStart(),
- "rand() has limited randomness" + msg);
+ diag(MatchedDecl->getLocStart(), "rand() has limited randomness" + msg);
}
} // namespace cert
} // namespace tidy
} // namespace clang
-
Modified: clang-tools-extra/trunk/clang-tidy/cert/StaticObjectExceptionCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/StaticObjectExceptionCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/StaticObjectExceptionCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/StaticObjectExceptionCheck.cpp Tue Nov 8 01:50:19 2016
@@ -47,7 +47,7 @@ void StaticObjectExceptionCheck::check(c
<< VD << (VD->getStorageDuration() == SD_Static ? 0 : 1);
SourceLocation FuncLocation = Func->getLocation();
- if(FuncLocation.isValid()) {
+ if (FuncLocation.isValid()) {
diag(FuncLocation,
"possibly throwing %select{constructor|function}0 declared here",
DiagnosticIDs::Note)
Modified: clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp Tue Nov 8 01:50:19 2016
@@ -8,9 +8,9 @@
//===----------------------------------------------------------------------===//
#include "StrToNumCheck.h"
-#include "clang/Analysis/Analyses/FormatString.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Analysis/Analyses/FormatString.h"
#include "llvm/ADT/StringSwitch.h"
#include <cassert>
Modified: clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.h Tue Nov 8 01:50:19 2016
@@ -23,7 +23,7 @@ namespace cert {
class ThrownExceptionTypeCheck : public ClangTidyCheck {
public:
ThrownExceptionTypeCheck(StringRef Name, ClangTidyContext *Context)
- : ClangTidyCheck(Name, Context) {}
+ : ClangTidyCheck(Name, Context) {}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp Tue Nov 8 01:50:19 2016
@@ -22,8 +22,8 @@
#include "ProTypeStaticCastDowncastCheck.h"
#include "ProTypeUnionAccessCheck.h"
#include "ProTypeVarargCheck.h"
-#include "SpecialMemberFunctionsCheck.h"
#include "SlicingCheck.h"
+#include "SpecialMemberFunctionsCheck.h"
namespace clang {
namespace tidy {
@@ -57,8 +57,7 @@ public:
"cppcoreguidelines-pro-type-vararg");
CheckFactories.registerCheck<SpecialMemberFunctionsCheck>(
"cppcoreguidelines-special-member-functions");
- CheckFactories.registerCheck<SlicingCheck>(
- "cppcoreguidelines-slicing");
+ CheckFactories.registerCheck<SlicingCheck>("cppcoreguidelines-slicing");
CheckFactories.registerCheck<misc::UnconventionalAssignOperatorCheck>(
"cppcoreguidelines-c-copy-assignment-signature");
}
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp Tue Nov 8 01:50:19 2016
@@ -47,12 +47,12 @@ void ProBoundsConstantArrayIndexCheck::r
// Note: if a struct contains an array member, the compiler-generated
// constructor has an arraySubscriptExpr.
- Finder->addMatcher(arraySubscriptExpr(hasBase(ignoringImpCasts(hasType(
- constantArrayType().bind("type")))),
- hasIndex(expr().bind("index")),
- unless(hasAncestor(isImplicit())))
- .bind("expr"),
- this);
+ Finder->addMatcher(
+ arraySubscriptExpr(
+ hasBase(ignoringImpCasts(hasType(constantArrayType().bind("type")))),
+ hasIndex(expr().bind("index")), unless(hasAncestor(isImplicit())))
+ .bind("expr"),
+ this);
Finder->addMatcher(
cxxOperatorCallExpr(
@@ -112,8 +112,7 @@ void ProBoundsConstantArrayIndexCheck::c
return;
if (Index.isSigned() && Index.isNegative()) {
- diag(Matched->getExprLoc(),
- "std::array<> index %0 is negative")
+ diag(Matched->getExprLoc(), "std::array<> index %0 is negative")
<< Index.toString(10);
return;
}
@@ -130,8 +129,9 @@ void ProBoundsConstantArrayIndexCheck::c
// Get uint64_t values, because different bitwidths would lead to an assertion
// in APInt::uge.
if (Index.getZExtValue() >= ArraySize.getZExtValue()) {
- diag(Matched->getExprLoc(), "std::array<> index %0 is past the end of the array "
- "(which contains %1 elements)")
+ diag(Matched->getExprLoc(),
+ "std::array<> index %0 is past the end of the array "
+ "(which contains %1 elements)")
<< Index.toString(10) << ArraySize.toString(10, false);
}
}
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp Tue Nov 8 01:50:19 2016
@@ -47,8 +47,8 @@ void ProBoundsPointerArithmeticCheck::re
this);
}
-void
-ProBoundsPointerArithmeticCheck::check(const MatchFinder::MatchResult &Result) {
+void ProBoundsPointerArithmeticCheck::check(
+ const MatchFinder::MatchResult &Result) {
const auto *MatchedExpr = Result.Nodes.getNodeAs<Expr>("expr");
diag(MatchedExpr->getExprLoc(), "do not use pointer arithmetic");
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h Tue Nov 8 01:50:19 2016
@@ -17,7 +17,8 @@ namespace tidy {
namespace cppcoreguidelines {
/// Flags all kinds of pointer arithmetic that have result of pointer type, i.e.
-/// +, -, +=, -=, ++, --. In addition, the [] operator on pointers (not on arrays) is flagged.
+/// +, -, +=, -=, ++, --. In addition, the [] operator on pointers (not on
+/// arrays) is flagged.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.html
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp Tue Nov 8 01:50:19 2016
@@ -278,8 +278,7 @@ void ProTypeMemberInitCheck::registerMat
// AST.
Finder->addMatcher(
cxxRecordDecl(
- isDefinition(), unless(isInstantiated()),
- hasDefaultConstructor(),
+ isDefinition(), unless(isInstantiated()), hasDefaultConstructor(),
anyOf(has(cxxConstructorDecl(isDefaultConstructor(), isDefaulted(),
unless(isImplicit()))),
unless(has(cxxConstructorDecl()))),
@@ -465,7 +464,7 @@ void ProTypeMemberInitCheck::checkMissin
<< toCommaSeparatedString(AllBases, BasesToInit);
if (Ctor)
- fixInitializerList(Context, Diag, Ctor, BasesToInit);
+ fixInitializerList(Context, Diag, Ctor, BasesToInit);
}
void ProTypeMemberInitCheck::checkUninitializedTrivialType(
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp Tue Nov 8 01:50:19 2016
@@ -26,7 +26,8 @@ void ProTypeStaticCastDowncastCheck::reg
this);
}
-void ProTypeStaticCastDowncastCheck::check(const MatchFinder::MatchResult &Result) {
+void ProTypeStaticCastDowncastCheck::check(
+ const MatchFinder::MatchResult &Result) {
const auto *MatchedCast = Result.Nodes.getNodeAs<CXXStaticCastExpr>("cast");
if (MatchedCast->getCastKind() != CK_BaseToDerived)
return;
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h Tue Nov 8 01:50:19 2016
@@ -16,7 +16,8 @@ namespace clang {
namespace tidy {
namespace cppcoreguidelines {
-/// Checks for usages of static_cast, where a base class is downcasted to a derived class.
+/// Checks for usages of static_cast, where a base class is downcasted to a
+/// derived class.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.html
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp Tue Nov 8 01:50:19 2016
@@ -21,15 +21,18 @@ void ProTypeUnionAccessCheck::registerMa
if (!getLangOpts().CPlusPlus)
return;
- Finder->addMatcher(memberExpr(hasObjectExpression(hasType(recordDecl(isUnion())))).bind("expr"), this);
+ Finder->addMatcher(
+ memberExpr(hasObjectExpression(hasType(recordDecl(isUnion()))))
+ .bind("expr"),
+ this);
}
void ProTypeUnionAccessCheck::check(const MatchFinder::MatchResult &Result) {
const auto *Matched = Result.Nodes.getNodeAs<MemberExpr>("expr");
- diag(Matched->getMemberLoc(), "do not access members of unions; use (boost::)variant instead");
+ diag(Matched->getMemberLoc(),
+ "do not access members of unions; use (boost::)variant instead");
}
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang
-
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h Tue Nov 8 01:50:19 2016
@@ -34,4 +34,3 @@ public:
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_PRO_TYPE_UNION_ACCESS_H
-
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp Tue Nov 8 01:50:19 2016
@@ -26,9 +26,7 @@ void ProTypeVarargCheck::registerMatcher
Finder->addMatcher(vAArgExpr().bind("va_use"), this);
Finder->addMatcher(
- callExpr(callee(functionDecl(isVariadic())))
- .bind("callvararg"),
- this);
+ callExpr(callee(functionDecl(isVariadic()))).bind("callvararg"), this);
}
static bool hasSingleVariadicArgumentWithValue(const CallExpr *C, uint64_t I) {
Modified: clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp Tue Nov 8 01:50:19 2016
@@ -20,8 +20,8 @@ namespace tidy {
namespace google {
namespace readability {
-void
-AvoidCStyleCastsCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
+void AvoidCStyleCastsCheck::registerMatchers(
+ ast_matchers::MatchFinder *Finder) {
Finder->addMatcher(
cStyleCastExpr(
// Filter out (EnumType)IntegerLiteral construct, which is generated
@@ -29,7 +29,8 @@ AvoidCStyleCastsCheck::registerMatchers(
// FIXME: Remove this once this is fixed in the AST.
unless(hasParent(substNonTypeTemplateParmExpr())),
// Avoid matches in template instantiations.
- unless(isInTemplateInstantiation())).bind("cast"),
+ unless(isInTemplateInstantiation()))
+ .bind("cast"),
this);
}
@@ -143,7 +144,7 @@ void AvoidCStyleCastsCheck::check(const
ReplaceWithCast("const_cast");
return;
}
- // FALLTHROUGH
+ // FALLTHROUGH
case clang::CK_IntegralCast:
// Convert integral and no-op casts between builtin types and enums to
// static_cast. A cast from enum to integer may be unnecessary, but it's
Modified: clang-tools-extra/trunk/clang-tidy/google/ExplicitMakePairCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/ExplicitMakePairCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/ExplicitMakePairCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/ExplicitMakePairCheck.cpp Tue Nov 8 01:50:19 2016
@@ -25,8 +25,8 @@ namespace tidy {
namespace google {
namespace build {
-void
-ExplicitMakePairCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
+void ExplicitMakePairCheck::registerMatchers(
+ ast_matchers::MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (!getLangOpts().CPlusPlus)
@@ -39,7 +39,8 @@ ExplicitMakePairCheck::registerMatchers(
callee(expr(ignoringParenImpCasts(
declRefExpr(hasExplicitTemplateArgs(),
to(functionDecl(hasName("::std::make_pair"))))
- .bind("declref"))))).bind("call"),
+ .bind("declref")))))
+ .bind("call"),
this);
}
@@ -61,13 +62,13 @@ void ExplicitMakePairCheck::check(const
Arg1->getType() != Call->getArg(1)->getType()) {
diag(Call->getLocStart(), "for C++11-compatibility, use pair directly")
<< FixItHint::CreateReplacement(
- SourceRange(DeclRef->getLocStart(), DeclRef->getLAngleLoc()),
- "std::pair<");
+ SourceRange(DeclRef->getLocStart(), DeclRef->getLAngleLoc()),
+ "std::pair<");
} else {
diag(Call->getLocStart(),
"for C++11-compatibility, omit template arguments from make_pair")
<< FixItHint::CreateRemoval(
- SourceRange(DeclRef->getLAngleLoc(), DeclRef->getRAngleLoc()));
+ SourceRange(DeclRef->getLAngleLoc(), DeclRef->getRAngleLoc()));
}
}
Modified: clang-tools-extra/trunk/clang-tidy/google/GlobalNamesInHeadersCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/GlobalNamesInHeadersCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/GlobalNamesInHeadersCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/GlobalNamesInHeadersCheck.cpp Tue Nov 8 01:50:19 2016
@@ -26,8 +26,7 @@ GlobalNamesInHeadersCheck::GlobalNamesIn
RawStringHeaderFileExtensions(
Options.getLocalOrGlobal("HeaderFileExtensions", "h")) {
if (!utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
- HeaderFileExtensions,
- ',')) {
+ HeaderFileExtensions, ',')) {
llvm::errs() << "Invalid header file extension: "
<< RawStringHeaderFileExtensions << "\n";
}
@@ -38,12 +37,12 @@ void GlobalNamesInHeadersCheck::storeOpt
Options.store(Opts, "HeaderFileExtensions", RawStringHeaderFileExtensions);
}
-void
-GlobalNamesInHeadersCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
- Finder->addMatcher(
- decl(anyOf(usingDecl(), usingDirectiveDecl()),
- hasDeclContext(translationUnitDecl())).bind("using_decl"),
- this);
+void GlobalNamesInHeadersCheck::registerMatchers(
+ ast_matchers::MatchFinder *Finder) {
+ Finder->addMatcher(decl(anyOf(usingDecl(), usingDirectiveDecl()),
+ hasDeclContext(translationUnitDecl()))
+ .bind("using_decl"),
+ this);
}
void GlobalNamesInHeadersCheck::check(const MatchFinder::MatchResult &Result) {
@@ -61,7 +60,7 @@ void GlobalNamesInHeadersCheck::check(co
return;
}
- if (const auto* UsingDirective = dyn_cast<UsingDirectiveDecl>(D)) {
+ if (const auto *UsingDirective = dyn_cast<UsingDirectiveDecl>(D)) {
if (UsingDirective->getNominatedNamespace()->isAnonymousNamespace()) {
// Anynoumous namespaces inject a using directive into the AST to import
// the names into the containing namespace.
Modified: clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.cpp Tue Nov 8 01:50:19 2016
@@ -21,8 +21,8 @@
#include "GlobalNamesInHeadersCheck.h"
#include "IntegerTypesCheck.h"
#include "MemsetZeroLengthCheck.h"
-#include "OverloadedUnaryAndCheck.h"
#include "NonConstReferences.h"
+#include "OverloadedUnaryAndCheck.h"
#include "StringReferenceMemberCheck.h"
#include "TodoCommentCheck.h"
#include "UnnamedNamespaceInHeaderCheck.h"
Modified: clang-tools-extra/trunk/clang-tidy/google/IntegerTypesCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/IntegerTypesCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/IntegerTypesCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/IntegerTypesCheck.cpp Tue Nov 8 01:50:19 2016
@@ -40,7 +40,6 @@ namespace tidy {
namespace google {
namespace runtime {
-
IntegerTypesCheck::IntegerTypesCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
UnsignedTypePrefix(Options.get("UnsignedTypePrefix", "uint")),
Modified: clang-tools-extra/trunk/clang-tidy/google/MemsetZeroLengthCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/MemsetZeroLengthCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/MemsetZeroLengthCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/MemsetZeroLengthCheck.cpp Tue Nov 8 01:50:19 2016
@@ -20,15 +20,16 @@ namespace tidy {
namespace google {
namespace runtime {
-void
-MemsetZeroLengthCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
+void MemsetZeroLengthCheck::registerMatchers(
+ ast_matchers::MatchFinder *Finder) {
// Look for memset(x, y, 0) as those is most likely an argument swap.
// TODO: Also handle other standard functions that suffer from the same
// problem, e.g. memchr.
- Finder->addMatcher(
- callExpr(callee(functionDecl(hasName("::memset"))), argumentCountIs(3),
- unless(isInTemplateInstantiation())).bind("decl"),
- this);
+ Finder->addMatcher(callExpr(callee(functionDecl(hasName("::memset"))),
+ argumentCountIs(3),
+ unless(isInTemplateInstantiation()))
+ .bind("decl"),
+ this);
}
/// \brief Get a StringRef representing a SourceRange.
Modified: clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp Tue Nov 8 01:50:19 2016
@@ -27,8 +27,8 @@ NonConstReferences::NonConstReferences(S
utils::options::parseStringList(Options.get("WhiteListTypes", ""))) {}
void NonConstReferences::storeOptions(ClangTidyOptions::OptionMap &Opts) {
- Options.store(Opts, "WhiteListTypes",
- utils::options::serializeStringList(WhiteListTypes));
+ Options.store(Opts, "WhiteListTypes",
+ utils::options::serializeStringList(WhiteListTypes));
}
void NonConstReferences::registerMatchers(MatchFinder *Finder) {
@@ -133,9 +133,8 @@ void NonConstReferences::check(const Mat
return;
if (Parameter->getName().empty()) {
- diag(Parameter->getLocation(),
- "non-const reference parameter at index %0, "
- "make it const or use a pointer")
+ diag(Parameter->getLocation(), "non-const reference parameter at index %0, "
+ "make it const or use a pointer")
<< Parameter->getFunctionScopeIndex();
} else {
diag(Parameter->getLocation(),
Modified: clang-tools-extra/trunk/clang-tidy/google/OverloadedUnaryAndCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/OverloadedUnaryAndCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/OverloadedUnaryAndCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/OverloadedUnaryAndCheck.cpp Tue Nov 8 01:50:19 2016
@@ -19,8 +19,8 @@ namespace tidy {
namespace google {
namespace runtime {
-void
-OverloadedUnaryAndCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
+void OverloadedUnaryAndCheck::registerMatchers(
+ ast_matchers::MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (!getLangOpts().CPlusPlus)
@@ -34,10 +34,10 @@ OverloadedUnaryAndCheck::registerMatcher
// Also match freestanding unary operator& overloads. Be careful not to match
// binary methods.
Finder->addMatcher(
- functionDecl(
- allOf(unless(cxxMethodDecl()),
- functionDecl(parameterCountIs(1),
- hasOverloadedOperatorName("&")).bind("overload"))),
+ functionDecl(allOf(
+ unless(cxxMethodDecl()),
+ functionDecl(parameterCountIs(1), hasOverloadedOperatorName("&"))
+ .bind("overload"))),
this);
}
Modified: clang-tools-extra/trunk/clang-tidy/google/StringReferenceMemberCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/StringReferenceMemberCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/StringReferenceMemberCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/StringReferenceMemberCheck.cpp Tue Nov 8 01:50:19 2016
@@ -32,13 +32,13 @@ void StringReferenceMemberCheck::registe
auto ConstString = qualType(isConstQualified(), hasDeclaration(String));
// Ignore members in template instantiations.
- Finder->addMatcher(fieldDecl(hasType(references(ConstString)),
- unless(isInstantiated())).bind("member"),
- this);
+ Finder->addMatcher(
+ fieldDecl(hasType(references(ConstString)), unless(isInstantiated()))
+ .bind("member"),
+ this);
}
-void
-StringReferenceMemberCheck::check(const MatchFinder::MatchResult &Result) {
+void StringReferenceMemberCheck::check(const MatchFinder::MatchResult &Result) {
const auto *Member = Result.Nodes.getNodeAs<FieldDecl>("member");
diag(Member->getLocStart(), "const string& members are dangerous; it is much "
"better to use alternatives, such as pointers or "
Modified: clang-tools-extra/trunk/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp Tue Nov 8 01:50:19 2016
@@ -25,8 +25,7 @@ UnnamedNamespaceInHeaderCheck::UnnamedNa
RawStringHeaderFileExtensions(
Options.getLocalOrGlobal("HeaderFileExtensions", "h,hh,hpp,hxx")) {
if (!utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
- HeaderFileExtensions,
- ',')) {
+ HeaderFileExtensions, ',')) {
llvm::errs() << "Invalid header file extension: "
<< RawStringHeaderFileExtensions << "\n";
}
@@ -46,8 +45,8 @@ void UnnamedNamespaceInHeaderCheck::regi
this);
}
-void
-UnnamedNamespaceInHeaderCheck::check(const MatchFinder::MatchResult &Result) {
+void UnnamedNamespaceInHeaderCheck::check(
+ const MatchFinder::MatchResult &Result) {
const auto *N = Result.Nodes.getNodeAs<NamespaceDecl>("anonymousNamespace");
SourceLocation Loc = N->getLocStart();
if (!Loc.isValid())
Modified: clang-tools-extra/trunk/clang-tidy/google/UsingNamespaceDirectiveCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/UsingNamespaceDirectiveCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/UsingNamespaceDirectiveCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/UsingNamespaceDirectiveCheck.cpp Tue Nov 8 01:50:19 2016
@@ -27,8 +27,8 @@ void UsingNamespaceDirectiveCheck::regis
Finder->addMatcher(usingDirectiveDecl().bind("usingNamespace"), this);
}
-void
-UsingNamespaceDirectiveCheck::check(const MatchFinder::MatchResult &Result) {
+void UsingNamespaceDirectiveCheck::check(
+ const MatchFinder::MatchResult &Result) {
const auto *U = Result.Nodes.getNodeAs<UsingDirectiveDecl>("usingNamespace");
SourceLocation Loc = U->getLocStart();
if (U->isImplicit() || !Loc.isValid())
Modified: clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp Tue Nov 8 01:50:19 2016
@@ -14,7 +14,7 @@ namespace tidy {
namespace llvm {
LLVMHeaderGuardCheck::LLVMHeaderGuardCheck(StringRef Name,
- ClangTidyContext* Context)
+ ClangTidyContext *Context)
: HeaderGuardCheck(Name, Context),
RawStringHeaderFileExtensions(
Options.getLocalOrGlobal("HeaderFileExtensions", ",h,hh,hpp,hxx")) {
Modified: clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp Tue Nov 8 01:50:19 2016
@@ -164,8 +164,8 @@ void ArgumentCommentCheck::checkCallArgs
<< Matches[2] << II;
if (isLikelyTypo(Callee->parameters(), Matches[2], I)) {
Diag << FixItHint::CreateReplacement(
- Comment.first,
- (Matches[1] + II->getName() + Matches[3]).str());
+ Comment.first,
+ (Matches[1] + II->getName() + Matches[3]).str());
}
}
diag(PVD->getLocation(), "%0 declared here", DiagnosticIDs::Note)
Modified: clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h Tue Nov 8 01:50:19 2016
@@ -37,7 +37,7 @@ public:
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
- void storeOptions(ClangTidyOptions::OptionMap& Opts) override;
+ void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
private:
const bool StrictMode;
Modified: clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp Tue Nov 8 01:50:19 2016
@@ -25,7 +25,8 @@ void BoolPointerImplicitConversionCheck:
hasType(pointerType(pointee(booleanType()))),
ignoringParenImpCasts(declRefExpr().bind("expr")))),
hasCastKind(CK_PointerToBoolean))))),
- unless(isInTemplateInstantiation())).bind("if"),
+ unless(isInTemplateInstantiation()))
+ .bind("if"),
this);
}
Modified: clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.h Tue Nov 8 01:50:19 2016
@@ -40,4 +40,3 @@ public:
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_BOOLPOINTERIMPLICITCONVERSIONCHECK_H
-
Modified: clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp Tue Nov 8 01:50:19 2016
@@ -35,8 +35,7 @@ DefinitionsInHeadersCheck::DefinitionsIn
RawStringHeaderFileExtensions(
Options.getLocalOrGlobal("HeaderFileExtensions", ",h,hh,hpp,hxx")) {
if (!utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
- HeaderFileExtensions,
- ',')) {
+ HeaderFileExtensions, ',')) {
// FIXME: Find a more suitable way to handle invalid configuration
// options.
llvm::errs() << "Invalid header file extension: "
Modified: clang-tools-extra/trunk/clang-tidy/misc/ForwardDeclarationNamespaceCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/ForwardDeclarationNamespaceCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/ForwardDeclarationNamespaceCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/ForwardDeclarationNamespaceCheck.cpp Tue Nov 8 01:50:19 2016
@@ -8,12 +8,12 @@
//===----------------------------------------------------------------------===//
#include "ForwardDeclarationNamespaceCheck.h"
-#include <stack>
-#include <string>
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
+#include <stack>
+#include <string>
using namespace clang::ast_matchers;
Modified: clang-tools-extra/trunk/clang-tidy/misc/ForwardDeclarationNamespaceCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/ForwardDeclarationNamespaceCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/ForwardDeclarationNamespaceCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/ForwardDeclarationNamespaceCheck.h Tue Nov 8 01:50:19 2016
@@ -10,10 +10,10 @@
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_FORWARDDECLARATIONNAMESPACECHECK_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_FORWARDDECLARATIONNAMESPACECHECK_H
+#include "../ClangTidy.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include <set>
#include <vector>
-#include "llvm/ADT/SmallPtrSet.h"
-#include "../ClangTidy.h"
namespace clang {
namespace tidy {
Modified: clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.cpp Tue Nov 8 01:50:19 2016
@@ -31,7 +31,6 @@ AST_MATCHER(FloatingLiteral, floatHalf)
}
} // namespace
-
void IncorrectRoundings::registerMatchers(MatchFinder *MatchFinder) {
// Match a floating literal with value 0.5.
auto FloatHalf = floatLiteral(floatHalf());
Modified: clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.h Tue Nov 8 01:50:19 2016
@@ -36,4 +36,4 @@ public:
} // namespace tidy
} // namespace clang
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_INCORRECTROUNDINGS_H_
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_INCORRECTROUNDINGS_H_
Modified: clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.cpp Tue Nov 8 01:50:19 2016
@@ -79,7 +79,8 @@ static bool possibleVarDecl(const MacroI
if (Tok == MI->tokens_end())
return false;
- // If we see int/short/struct/etc., just assume this is a variable declaration.
+ // If we see int/short/struct/etc., just assume this is a variable
+ // declaration.
if (isVarDeclKeyword(*Tok))
return true;
@@ -88,10 +89,10 @@ static bool possibleVarDecl(const MacroI
return false;
// Skip possible types, etc
- while (
- Tok != MI->tokens_end() &&
- Tok->isOneOf(tok::identifier, tok::raw_identifier, tok::coloncolon,
- tok::star, tok::amp, tok::ampamp, tok::less, tok::greater))
+ while (Tok != MI->tokens_end() &&
+ Tok->isOneOf(tok::identifier, tok::raw_identifier, tok::coloncolon,
+ tok::star, tok::amp, tok::ampamp, tok::less,
+ tok::greater))
Tok++;
// Return true for possible variable declarations.
Modified: clang-tools-extra/trunk/clang-tidy/misc/MacroRepeatedSideEffectsCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MacroRepeatedSideEffectsCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MacroRepeatedSideEffectsCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MacroRepeatedSideEffectsCheck.cpp Tue Nov 8 01:50:19 2016
@@ -9,9 +9,9 @@
#include "MacroRepeatedSideEffectsCheck.h"
#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Lex/MacroArgs.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
-#include "clang/Lex/MacroArgs.h"
namespace clang {
namespace tidy {
Modified: clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp Tue Nov 8 01:50:19 2016
@@ -12,8 +12,6 @@
#include "../ClangTidyModuleRegistry.h"
#include "ArgumentCommentCheck.h"
#include "AssertSideEffectCheck.h"
-#include "MisplacedConstCheck.h"
-#include "UnconventionalAssignOperatorCheck.h"
#include "BoolPointerImplicitConversionCheck.h"
#include "DanglingHandleCheck.h"
#include "DefinitionsInHeadersCheck.h"
@@ -24,6 +22,7 @@
#include "InefficientAlgorithmCheck.h"
#include "MacroParenthesesCheck.h"
#include "MacroRepeatedSideEffectsCheck.h"
+#include "MisplacedConstCheck.h"
#include "MisplacedWideningCastCheck.h"
#include "MoveConstantArgumentCheck.h"
#include "MoveConstructorInitCheck.h"
@@ -44,6 +43,7 @@
#include "SuspiciousStringCompareCheck.h"
#include "SwappedArgumentsCheck.h"
#include "ThrowByValueCatchByReferenceCheck.h"
+#include "UnconventionalAssignOperatorCheck.h"
#include "UndelegatedConstructor.h"
#include "UniqueptrResetReleaseCheck.h"
#include "UnusedAliasDeclsCheck.h"
@@ -63,22 +63,18 @@ public:
CheckFactories.registerCheck<ArgumentCommentCheck>("misc-argument-comment");
CheckFactories.registerCheck<AssertSideEffectCheck>(
"misc-assert-side-effect");
- CheckFactories.registerCheck<MisplacedConstCheck>(
- "misc-misplaced-const");
+ CheckFactories.registerCheck<MisplacedConstCheck>("misc-misplaced-const");
CheckFactories.registerCheck<UnconventionalAssignOperatorCheck>(
"misc-unconventional-assign-operator");
CheckFactories.registerCheck<BoolPointerImplicitConversionCheck>(
"misc-bool-pointer-implicit-conversion");
- CheckFactories.registerCheck<DanglingHandleCheck>(
- "misc-dangling-handle");
+ CheckFactories.registerCheck<DanglingHandleCheck>("misc-dangling-handle");
CheckFactories.registerCheck<DefinitionsInHeadersCheck>(
"misc-definitions-in-headers");
- CheckFactories.registerCheck<FoldInitTypeCheck>(
- "misc-fold-init-type");
+ CheckFactories.registerCheck<FoldInitTypeCheck>("misc-fold-init-type");
CheckFactories.registerCheck<ForwardDeclarationNamespaceCheck>(
"misc-forward-declaration-namespace");
- CheckFactories.registerCheck<InaccurateEraseCheck>(
- "misc-inaccurate-erase");
+ CheckFactories.registerCheck<InaccurateEraseCheck>("misc-inaccurate-erase");
CheckFactories.registerCheck<IncorrectRoundings>(
"misc-incorrect-roundings");
CheckFactories.registerCheck<InefficientAlgorithmCheck>(
@@ -108,8 +104,7 @@ public:
CheckFactories.registerCheck<SizeofContainerCheck>("misc-sizeof-container");
CheckFactories.registerCheck<SizeofExpressionCheck>(
"misc-sizeof-expression");
- CheckFactories.registerCheck<StaticAssertCheck>(
- "misc-static-assert");
+ CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
CheckFactories.registerCheck<StringConstructorCheck>(
"misc-string-constructor");
CheckFactories.registerCheck<StringIntegerAssignmentCheck>(
@@ -147,7 +142,7 @@ public:
// Register the MiscTidyModule using this statically initialized variable.
static ClangTidyModuleRegistry::Add<misc::MiscModule>
-X("misc-module", "Adds miscellaneous lint checks.");
+ X("misc-module", "Adds miscellaneous lint checks.");
// This anchor is used to force the linker to link in the generated object file
// and thus register the MiscModule.
Modified: clang-tools-extra/trunk/clang-tidy/misc/MisplacedWideningCastCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MisplacedWideningCastCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MisplacedWideningCastCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MisplacedWideningCastCheck.cpp Tue Nov 8 01:50:19 2016
@@ -8,9 +8,9 @@
//===----------------------------------------------------------------------===//
#include "MisplacedWideningCastCheck.h"
+#include "../utils/Matchers.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
-#include "../utils/Matchers.h"
using namespace clang::ast_matchers;
@@ -49,8 +49,7 @@ void MisplacedWideningCastCheck::registe
Finder->addMatcher(callExpr(hasAnyArgument(Cast)), this);
Finder->addMatcher(binaryOperator(hasOperatorName("="), hasRHS(Cast)), this);
Finder->addMatcher(
- binaryOperator(matchers::isComparisonOperator(),
- hasEitherOperand(Cast)),
+ binaryOperator(matchers::isComparisonOperator(), hasEitherOperand(Cast)),
this);
}
Modified: clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp Tue Nov 8 01:50:19 2016
@@ -83,8 +83,8 @@ void MoveConstantArgumentCheck::check(co
"has no effect; remove std::move()"
"%select{| or make the variable non-const}3")
<< IsConstArg << IsVariable << IsTriviallyCopyable
- << (IsConstArg && IsVariable && !IsTriviallyCopyable)
- << Var << Arg->getType();
+ << (IsConstArg && IsVariable && !IsTriviallyCopyable) << Var
+ << Arg->getType();
ReplaceCallWithArg(CallMove, Diag, SM, getLangOpts());
} else if (ReceivingExpr) {
Modified: clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp Tue Nov 8 01:50:19 2016
@@ -126,7 +126,8 @@ void MoveConstructorInitCheck::handlePar
void MoveConstructorInitCheck::handleMoveConstructor(
const MatchFinder::MatchResult &Result) {
const auto *CopyCtor = Result.Nodes.getNodeAs<CXXConstructorDecl>("ctor");
- const auto *Initializer = Result.Nodes.getNodeAs<CXXCtorInitializer>("move-init");
+ const auto *Initializer =
+ Result.Nodes.getNodeAs<CXXCtorInitializer>("move-init");
// Do not diagnose if the expression used to perform the initialization is a
// trivially-copyable type.
Modified: clang-tools-extra/trunk/clang-tidy/misc/MultipleStatementMacroCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MultipleStatementMacroCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MultipleStatementMacroCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MultipleStatementMacroCheck.cpp Tue Nov 8 01:50:19 2016
@@ -29,7 +29,7 @@ const Stmt *nextStmt(const MatchFinder::
const Stmt *Parent = Parents[0].get<Stmt>();
if (!Parent)
return nullptr;
- const Stmt* Prev = nullptr;
+ const Stmt *Prev = nullptr;
for (const Stmt *Child : Parent->children()) {
if (Prev == S)
return Child;
@@ -53,7 +53,7 @@ ExpansionRanges getExpansionRanges(Sourc
return Locs;
}
-} // namespace
+} // namespace
void MultipleStatementMacroCheck::registerMatchers(MatchFinder *Finder) {
const auto Inner = expr(isInMacro(), unless(compoundStmt())).bind("inner");
Modified: clang-tools-extra/trunk/clang-tidy/misc/NewDeleteOverloadsCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/NewDeleteOverloadsCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/NewDeleteOverloadsCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/NewDeleteOverloadsCheck.cpp Tue Nov 8 01:50:19 2016
@@ -64,7 +64,8 @@ AST_MATCHER(FunctionDecl, isPlacementOve
OverloadedOperatorKind getCorrespondingOverload(const FunctionDecl *FD) {
switch (FD->getOverloadedOperator()) {
- default: break;
+ default:
+ break;
case OO_New:
return OO_Delete;
case OO_Delete:
@@ -79,7 +80,8 @@ OverloadedOperatorKind getCorrespondingO
const char *getOperatorName(OverloadedOperatorKind K) {
switch (K) {
- default: break;
+ default:
+ break;
case OO_New:
return "operator new";
case OO_Delete:
@@ -140,13 +142,12 @@ void NewDeleteOverloadsCheck::registerMa
// However, I think it's more reasonable to warn in this case as the user
// should really be writing that as a deleted function.
Finder->addMatcher(
- functionDecl(
- unless(anyOf(isImplicit(), isPlacementOverload(), isDeleted(),
- cxxMethodDecl(isPrivate()))),
- anyOf(hasOverloadedOperatorName("new"),
- hasOverloadedOperatorName("new[]"),
- hasOverloadedOperatorName("delete"),
- hasOverloadedOperatorName("delete[]")))
+ functionDecl(unless(anyOf(isImplicit(), isPlacementOverload(),
+ isDeleted(), cxxMethodDecl(isPrivate()))),
+ anyOf(hasOverloadedOperatorName("new"),
+ hasOverloadedOperatorName("new[]"),
+ hasOverloadedOperatorName("delete"),
+ hasOverloadedOperatorName("delete[]")))
.bind("func"),
this);
}
Modified: clang-tools-extra/trunk/clang-tidy/misc/NewDeleteOverloadsCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/NewDeleteOverloadsCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/NewDeleteOverloadsCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/NewDeleteOverloadsCheck.h Tue Nov 8 01:50:19 2016
@@ -20,11 +20,12 @@ namespace misc {
class NewDeleteOverloadsCheck : public ClangTidyCheck {
std::map<const clang::CXXRecordDecl *,
- llvm::SmallVector<const clang::FunctionDecl *, 4>> Overloads;
+ llvm::SmallVector<const clang::FunctionDecl *, 4>>
+ Overloads;
public:
NewDeleteOverloadsCheck(StringRef Name, ClangTidyContext *Context)
- : ClangTidyCheck(Name, Context) {}
+ : ClangTidyCheck(Name, Context) {}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
void onEndOfTranslationUnit() override;
Modified: clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.cpp Tue Nov 8 01:50:19 2016
@@ -43,8 +43,8 @@ void NoexceptMoveConstructorCheck::check
}
const auto *ProtoType = Decl->getType()->getAs<FunctionProtoType>();
- switch(ProtoType->getNoexceptSpec(*Result.Context)) {
- case FunctionProtoType::NR_NoNoexcept:
+ switch (ProtoType->getNoexceptSpec(*Result.Context)) {
+ case FunctionProtoType::NR_NoNoexcept:
diag(Decl->getLocation(), "move %0s should be marked noexcept")
<< MethodType;
// FIXME: Add a fixit.
@@ -71,4 +71,3 @@ void NoexceptMoveConstructorCheck::check
} // namespace misc
} // namespace tidy
} // namespace clang
-
Modified: clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.h Tue Nov 8 01:50:19 2016
@@ -36,4 +36,3 @@ public:
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_NOEXCEPTMOVECONSTRUCTORCHECK_H
-
Modified: clang-tools-extra/trunk/clang-tidy/misc/NonCopyableObjects.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/NonCopyableObjects.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/NonCopyableObjects.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/NonCopyableObjects.h Tue Nov 8 01:50:19 2016
@@ -21,7 +21,7 @@ namespace misc {
class NonCopyableObjectsCheck : public ClangTidyCheck {
public:
NonCopyableObjectsCheck(StringRef Name, ClangTidyContext *Context)
- : ClangTidyCheck(Name, Context) {}
+ : ClangTidyCheck(Name, Context) {}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Modified: clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.cpp Tue Nov 8 01:50:19 2016
@@ -47,4 +47,3 @@ void SizeofContainerCheck::check(const M
} // namespace misc
} // namespace tidy
} // namespace clang
-
Modified: clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.h Tue Nov 8 01:50:19 2016
@@ -34,4 +34,3 @@ public:
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_SIZEOF_CONTAINER_H
-
Modified: clang-tools-extra/trunk/clang-tidy/misc/SizeofExpressionCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SizeofExpressionCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SizeofExpressionCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SizeofExpressionCheck.cpp Tue Nov 8 01:50:19 2016
@@ -8,9 +8,9 @@
//===----------------------------------------------------------------------===//
#include "SizeofExpressionCheck.h"
+#include "../utils/Matchers.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
-#include "../utils/Matchers.h"
using namespace clang::ast_matchers;
Modified: clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.h Tue Nov 8 01:50:19 2016
@@ -33,4 +33,3 @@ public:
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_STRING_INTEGER_ASSIGNMENT_H
-
Modified: clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.cpp Tue Nov 8 01:50:19 2016
@@ -19,8 +19,8 @@ namespace misc {
namespace {
-bool isConcatenatedLiteralsOnPurpose(ASTContext* Ctx,
- const StringLiteral* Lit) {
+bool isConcatenatedLiteralsOnPurpose(ASTContext *Ctx,
+ const StringLiteral *Lit) {
// String literals surrounded by parentheses are assumed to be on purpose.
// i.e.: const char* Array[] = { ("a" "b" "c"), "d", [...] };
auto Parents = Ctx->getParents(*Lit);
@@ -36,13 +36,13 @@ bool isConcatenatedLiteralsOnPurpose(AST
// "second literal",
// [...]
// };
- const SourceManager& SM = Ctx->getSourceManager();
+ const SourceManager &SM = Ctx->getSourceManager();
bool IndentedCorrectly = true;
SourceLocation FirstToken = Lit->getStrTokenLoc(0);
FileID BaseFID = SM.getFileID(FirstToken);
unsigned int BaseIndent = SM.getSpellingColumnNumber(FirstToken);
unsigned int BaseLine = SM.getSpellingLineNumber(FirstToken);
- for (unsigned int TokNum = 1; TokNum < Lit->getNumConcatenated(); ++ TokNum) {
+ for (unsigned int TokNum = 1; TokNum < Lit->getNumConcatenated(); ++TokNum) {
SourceLocation Token = Lit->getStrTokenLoc(TokNum);
FileID FID = SM.getFileID(Token);
unsigned int Indent = SM.getSpellingColumnNumber(Token);
@@ -59,14 +59,14 @@ bool isConcatenatedLiteralsOnPurpose(AST
return false;
}
-AST_MATCHER_P(StringLiteral, isConcatenatedLiteral,
- unsigned, MaxConcatenatedTokens) {
+AST_MATCHER_P(StringLiteral, isConcatenatedLiteral, unsigned,
+ MaxConcatenatedTokens) {
return Node.getNumConcatenated() > 1 &&
Node.getNumConcatenated() < MaxConcatenatedTokens &&
!isConcatenatedLiteralsOnPurpose(&Finder->getASTContext(), &Node);
}
-} // namespace
+} // namespace
SuspiciousMissingCommaCheck::SuspiciousMissingCommaCheck(
StringRef Name, ClangTidyContext *Context)
@@ -102,25 +102,28 @@ void SuspiciousMissingCommaCheck::check(
// Skip small arrays as they often generate false-positive.
unsigned int Size = InitializerList->getNumInits();
- if (Size < SizeThreshold) return;
+ if (Size < SizeThreshold)
+ return;
// Count the number of occurence of concatenated string literal.
unsigned int Count = 0;
for (unsigned int i = 0; i < Size; ++i) {
const Expr *Child = InitializerList->getInit(i)->IgnoreImpCasts();
if (const auto *Literal = dyn_cast<StringLiteral>(Child)) {
- if (Literal->getNumConcatenated() > 1) ++Count;
+ if (Literal->getNumConcatenated() > 1)
+ ++Count;
}
}
// Warn only when concatenation is not common in this initializer list.
// The current threshold is set to less than 1/5 of the string literals.
- if (double(Count) / Size > RatioThreshold) return;
+ if (double(Count) / Size > RatioThreshold)
+ return;
diag(ConcatenatedLiteral->getLocStart(),
"suspicious string literal, probably missing a comma");
}
-} // namespace misc
-} // namespace tidy
-} // namespace clang
+} // namespace misc
+} // namespace tidy
+} // namespace clang
Modified: clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.h Tue Nov 8 01:50:19 2016
@@ -16,7 +16,8 @@ namespace clang {
namespace tidy {
namespace misc {
-/// This check finds string literals which are probably concatenated accidentally.
+/// This check finds string literals which are probably concatenated
+/// accidentally.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/misc-suspicious-missing-comma.html
Modified: clang-tools-extra/trunk/clang-tidy/misc/SuspiciousStringCompareCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousStringCompareCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousStringCompareCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousStringCompareCheck.cpp Tue Nov 8 01:50:19 2016
@@ -20,7 +20,6 @@ namespace clang {
namespace tidy {
namespace misc {
-
// Semicolon separated list of known string compare-like functions. The list
// must ends with a semicolon.
static const char KnownStringCompareFunctions[] = "__builtin_memcmp;"
@@ -104,13 +103,12 @@ void SuspiciousStringCompareCheck::regis
.bind("decl");
const auto DirectStringCompareCallExpr =
callExpr(hasDeclaration(FunctionCompareDecl)).bind("call");
- const auto MacroStringCompareCallExpr =
- conditionalOperator(
- anyOf(hasTrueExpression(ignoringParenImpCasts(DirectStringCompareCallExpr)),
- hasFalseExpression(ignoringParenImpCasts(DirectStringCompareCallExpr))));
+ const auto MacroStringCompareCallExpr = conditionalOperator(anyOf(
+ hasTrueExpression(ignoringParenImpCasts(DirectStringCompareCallExpr)),
+ hasFalseExpression(ignoringParenImpCasts(DirectStringCompareCallExpr))));
// The implicit cast is not present in C.
const auto StringCompareCallExpr = ignoringParenImpCasts(
- anyOf(DirectStringCompareCallExpr, MacroStringCompareCallExpr));
+ anyOf(DirectStringCompareCallExpr, MacroStringCompareCallExpr));
if (WarnOnImplicitComparison) {
// Detect suspicious calls to string compare:
@@ -203,7 +201,8 @@ void SuspiciousStringCompareCheck::check
<< Decl;
}
- if (const auto* BinOp = Result.Nodes.getNodeAs<BinaryOperator>("suspicious-operator")) {
+ if (const auto *BinOp =
+ Result.Nodes.getNodeAs<BinaryOperator>("suspicious-operator")) {
diag(Call->getLocStart(), "results of function %0 used by operator '%1'")
<< Decl << BinOp->getOpcodeStr();
}
Modified: clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp Tue Nov 8 01:50:19 2016
@@ -9,8 +9,8 @@
#include "ThrowByValueCatchByReferenceCheck.h"
#include "clang/AST/ASTContext.h"
-#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/AST/OperationKinds.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
using namespace clang::ast_matchers;
Modified: clang-tools-extra/trunk/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp Tue Nov 8 01:50:19 2016
@@ -17,7 +17,8 @@ namespace clang {
namespace tidy {
namespace misc {
-void UnconventionalAssignOperatorCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
+void UnconventionalAssignOperatorCheck::registerMatchers(
+ ast_matchers::MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (!getLangOpts().CPlusPlus)
@@ -65,7 +66,8 @@ void UnconventionalAssignOperatorCheck::
this);
}
-void UnconventionalAssignOperatorCheck::check(const MatchFinder::MatchResult &Result) {
+void UnconventionalAssignOperatorCheck::check(
+ const MatchFinder::MatchResult &Result) {
if (const auto *RetStmt = Result.Nodes.getNodeAs<ReturnStmt>("returnStmt")) {
diag(RetStmt->getLocStart(), "operator=() should always return '*this'");
} else {
Modified: clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.cpp Tue Nov 8 01:50:19 2016
@@ -72,7 +72,8 @@ void UndelegatedConstructorCheck::regist
this);
}
-void UndelegatedConstructorCheck::check(const MatchFinder::MatchResult &Result) {
+void UndelegatedConstructorCheck::check(
+ const MatchFinder::MatchResult &Result) {
const auto *E = Result.Nodes.getStmtAs<CXXConstructExpr>("construct");
diag(E->getLocStart(), "did you intend to call a delegated constructor? "
"A temporary object is created here instead");
Modified: clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetReleaseCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetReleaseCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetReleaseCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetReleaseCheck.cpp Tue Nov 8 01:50:19 2016
@@ -91,7 +91,7 @@ bool areDeletersCompatible(const MatchFi
return false;
}
-} // namespace
+} // namespace
void UniqueptrResetReleaseCheck::check(const MatchFinder::MatchResult &Result) {
if (!areDeletersCompatible(Result))
@@ -127,9 +127,8 @@ void UniqueptrResetReleaseCheck::check(c
}
std::string NewText = LeftText + " = " + RightText;
- diag(ResetMember->getExprLoc(), DiagText)
- << FixItHint::CreateReplacement(
- CharSourceRange::getTokenRange(ResetCall->getSourceRange()), NewText);
+ diag(ResetMember->getExprLoc(), DiagText) << FixItHint::CreateReplacement(
+ CharSourceRange::getTokenRange(ResetCall->getSourceRange()), NewText);
}
} // namespace misc
Modified: clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.h Tue Nov 8 01:50:19 2016
@@ -35,4 +35,3 @@ private:
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_ALIAS_DECLS_H
-
Modified: clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp Tue Nov 8 01:50:19 2016
@@ -107,8 +107,7 @@ void UnusedParametersCheck::warnOnUnused
void UnusedParametersCheck::check(const MatchFinder::MatchResult &Result) {
const auto *Function = Result.Nodes.getNodeAs<FunctionDecl>("function");
if (!Function->doesThisDeclarationHaveABody() ||
- !Function->hasWrittenPrototype() ||
- Function->isTemplateInstantiation())
+ !Function->hasWrittenPrototype() || Function->isTemplateInstantiation())
return;
if (const auto *Method = dyn_cast<CXXMethodDecl>(Function))
if (Method->isLambdaStaticInvoker())
Modified: clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.h Tue Nov 8 01:50:19 2016
@@ -36,4 +36,3 @@ private:
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_PARAMETERS_H
-
Modified: clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp Tue Nov 8 01:50:19 2016
@@ -42,8 +42,9 @@ void UnusedUsingDeclsCheck::registerMatc
anyOf(refersToTemplate(templateName().bind("used")),
refersToDeclaration(functionDecl().bind("used"))))))),
this);
- Finder->addMatcher(loc(templateSpecializationType(
- hasAnyTemplateArgument(templateArgument().bind("used")))), this);
+ Finder->addMatcher(loc(templateSpecializationType(hasAnyTemplateArgument(
+ templateArgument().bind("used")))),
+ this);
}
void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
@@ -126,7 +127,7 @@ void UnusedUsingDeclsCheck::check(const
}
// Check the uninstantiated template function usage.
if (const auto *ULE = Result.Nodes.getNodeAs<UnresolvedLookupExpr>("used")) {
- for (const NamedDecl* ND : ULE->decls()) {
+ for (const NamedDecl *ND : ULE->decls()) {
if (const auto *USD = dyn_cast<UsingShadowDecl>(ND))
removeFromFoundDecls(USD->getTargetDecl()->getCanonicalDecl());
}
Modified: clang-tools-extra/trunk/clang-tidy/misc/UseAfterMoveCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UseAfterMoveCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UseAfterMoveCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UseAfterMoveCheck.cpp Tue Nov 8 01:50:19 2016
@@ -604,8 +604,7 @@ void UseAfterMoveFinder::getReinits(
}
}
-static void emitDiagnostic(const Expr *MovingCall,
- const DeclRefExpr *MoveArg,
+static void emitDiagnostic(const Expr *MovingCall, const DeclRefExpr *MoveArg,
const UseAfterMove &Use, ClangTidyCheck *Check,
ASTContext *Context) {
SourceLocation UseLoc = Use.DeclRef->getExprLoc();
@@ -631,12 +630,11 @@ void UseAfterMoveCheck::registerMatchers
return;
auto CallMoveMatcher =
- callExpr(
- callee(functionDecl(hasName("::std::move"))), argumentCountIs(1),
- hasArgument(0, declRefExpr().bind("arg")),
- anyOf(hasAncestor(lambdaExpr().bind("containing-lambda")),
- hasAncestor(functionDecl().bind("containing-func"))),
- unless(inDecltypeOrTemplateArg()))
+ callExpr(callee(functionDecl(hasName("::std::move"))), argumentCountIs(1),
+ hasArgument(0, declRefExpr().bind("arg")),
+ anyOf(hasAncestor(lambdaExpr().bind("containing-lambda")),
+ hasAncestor(functionDecl().bind("containing-func"))),
+ unless(inDecltypeOrTemplateArg()))
.bind("call-move");
Finder->addMatcher(
Modified: clang-tools-extra/trunk/clang-tidy/modernize/AvoidBindCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/AvoidBindCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/AvoidBindCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/AvoidBindCheck.cpp Tue Nov 8 01:50:19 2016
@@ -154,7 +154,7 @@ void AvoidBindCheck::check(const MatchFi
addPlaceholderArgs(Args, Stream);
Stream << " { return ";
Ref->printPretty(Stream, nullptr, Result.Context->getPrintingPolicy());
- Stream<< "(";
+ Stream << "(";
addFunctionCallArgs(Args, Stream);
Stream << "); };";
Modified: clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.h Tue Nov 8 01:50:19 2016
@@ -38,4 +38,3 @@ protected:
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_UNIQUE_H
-
Modified: clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp Tue Nov 8 01:50:19 2016
@@ -37,8 +37,7 @@ namespace modernize {
class ModernizeModule : public ClangTidyModule {
public:
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
- CheckFactories.registerCheck<AvoidBindCheck>(
- "modernize-avoid-bind");
+ CheckFactories.registerCheck<AvoidBindCheck>("modernize-avoid-bind");
CheckFactories.registerCheck<DeprecatedHeadersCheck>(
"modernize-deprecated-headers");
CheckFactories.registerCheck<LoopConvertCheck>("modernize-loop-convert");
Modified: clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.cpp Tue Nov 8 01:50:19 2016
@@ -133,7 +133,7 @@ void RawStringLiteralCheck::replaceWithR
diag(Literal->getLocStart(),
"escaped string literal can be written as a raw string literal")
<< FixItHint::CreateReplacement(
- CharRange, asRawStringLiteral(Literal, DelimiterStem));
+ CharRange, asRawStringLiteral(Literal, DelimiterStem));
}
} // namespace modernize
Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp Tue Nov 8 01:50:19 2016
@@ -9,8 +9,8 @@
#include "UseAutoCheck.h"
#include "clang/AST/ASTContext.h"
-#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
using namespace clang;
using namespace clang::ast_matchers;
@@ -114,20 +114,19 @@ AST_MATCHER(NamedDecl, hasStdIteratorNam
/// recordDecl(hasStdContainerName()) matches \c vector and \c forward_list
/// but not \c my_vec.
AST_MATCHER(NamedDecl, hasStdContainerName) {
- static const char *const ContainerNames[] = {"array", "deque",
- "forward_list", "list",
- "vector",
-
- "map", "multimap",
- "set", "multiset",
-
- "unordered_map",
- "unordered_multimap",
- "unordered_set",
- "unordered_multiset",
+ static const char *const ContainerNames[] = {
+ "array", "deque",
+ "forward_list", "list",
+ "vector",
+
+ "map", "multimap",
+ "set", "multiset",
+
+ "unordered_map", "unordered_multimap",
+ "unordered_set", "unordered_multiset",
- "queue", "priority_queue",
- "stack"};
+ "queue", "priority_queue",
+ "stack"};
for (const char *Name : ContainerNames) {
if (hasName(Name).matches(Node, Finder, Builder))
Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.h Tue Nov 8 01:50:19 2016
@@ -48,4 +48,3 @@ public:
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_DEFAULT_H
-
Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Tue Nov 8 01:50:19 2016
@@ -38,8 +38,7 @@ AST_MATCHER(Type, sugaredNullptrType) {
/// can be replaced instead of just the inner-most implicit cast.
StatementMatcher makeCastSequenceMatcher() {
StatementMatcher ImplicitCastToNull = implicitCastExpr(
- anyOf(hasCastKind(CK_NullToPointer),
- hasCastKind(CK_NullToMemberPointer)),
+ anyOf(hasCastKind(CK_NullToPointer), hasCastKind(CK_NullToMemberPointer)),
unless(hasSourceExpression(hasType(sugaredNullptrType()))));
return castExpr(anyOf(ImplicitCastToNull,
Modified: clang-tools-extra/trunk/clang-tidy/mpi/TypeMismatchCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/mpi/TypeMismatchCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/mpi/TypeMismatchCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/mpi/TypeMismatchCheck.h Tue Nov 8 01:50:19 2016
@@ -41,8 +41,7 @@ private:
/// \param LO language options
void checkArguments(ArrayRef<const Type *> BufferTypes,
ArrayRef<const Expr *> BufferExprs,
- ArrayRef<StringRef> MPIDatatypes,
- const LangOptions &LO);
+ ArrayRef<StringRef> MPIDatatypes, const LangOptions &LO);
};
} // namespace mpi
Modified: clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp Tue Nov 8 01:50:19 2016
@@ -30,10 +30,12 @@ llvm::Optional<std::string> MakeCharacte
}
// Now replace the " with '.
auto pos = Result.find_first_of('"');
- if (pos == Result.npos) return llvm::None;
+ if (pos == Result.npos)
+ return llvm::None;
Result[pos] = '\'';
pos = Result.find_last_of('"');
- if (pos == Result.npos) return llvm::None;
+ if (pos == Result.npos)
+ return llvm::None;
Result[pos] = '\'';
return Result;
}
@@ -50,8 +52,7 @@ FasterStringFindCheck::FasterStringFindC
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
StringLikeClasses(utils::options::parseStringList(
- Options.get("StringLikeClasses", "std::basic_string"))) {
-}
+ Options.get("StringLikeClasses", "std::basic_string"))) {}
void FasterStringFindCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "StringLikeClasses",
Modified: clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp Tue Nov 8 01:50:19 2016
@@ -29,7 +29,7 @@ namespace {
bool IsNonTrivialImplicitCast(const Stmt *ST) {
if (const auto *ICE = dyn_cast<ImplicitCastExpr>(ST)) {
return (ICE->getCastKind() != CK_NoOp) ||
- IsNonTrivialImplicitCast(ICE->getSubExpr());
+ IsNonTrivialImplicitCast(ICE->getSubExpr());
}
return false;
}
Modified: clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.h Tue Nov 8 01:50:19 2016
@@ -20,13 +20,13 @@ namespace performance {
// the underlying type is the one returned by the iterator (i.e. that there
// isn't any implicit conversion).
class ImplicitCastInLoopCheck : public ClangTidyCheck {
- public:
- ImplicitCastInLoopCheck(StringRef Name, ClangTidyContext *Context)
- : ClangTidyCheck(Name, Context) {}
- void registerMatchers(ast_matchers::MatchFinder *Finder) override;
- void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+public:
+ ImplicitCastInLoopCheck(StringRef Name, ClangTidyContext *Context)
+ : ClangTidyCheck(Name, Context) {}
+ void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+ void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
- private:
+private:
void ReportAndFix(const ASTContext *Context, const VarDecl *VD,
const CXXOperatorCallExpr *OperatorCall);
};
@@ -35,4 +35,4 @@ class ImplicitCastInLoopCheck : public C
} // namespace tidy
} // namespace clang
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_IMPLICIT_CAST_IN_LOOP_CHECK_H_
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_IMPLICIT_CAST_IN_LOOP_CHECK_H_
Modified: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryCopyInitialization.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryCopyInitialization.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryCopyInitialization.cpp Tue Nov 8 01:50:19 2016
@@ -27,7 +27,6 @@ void recordFixes(const VarDecl &Var, AST
} // namespace
-
using namespace ::clang::ast_matchers;
using utils::decl_ref_expr::isOnlyUsedAsConst;
@@ -44,9 +43,9 @@ void UnnecessaryCopyInitialization::regi
// variable being declared. The assumption is that the const reference being
// returned either points to a global static variable or to a member of the
// called object.
- auto ConstRefReturningMethodCall = cxxMemberCallExpr(
- callee(cxxMethodDecl(returns(ConstReference))),
- on(declRefExpr(to(varDecl().bind("objectArg")))));
+ auto ConstRefReturningMethodCall =
+ cxxMemberCallExpr(callee(cxxMethodDecl(returns(ConstReference))),
+ on(declRefExpr(to(varDecl().bind("objectArg")))));
auto ConstRefReturningFunctionCall =
callExpr(callee(functionDecl(returns(ConstReference))),
unless(callee(cxxMethodDecl())));
@@ -64,14 +63,14 @@ void UnnecessaryCopyInitialization::regi
isCopyConstructor())),
hasArgument(0, CopyCtorArg))
.bind("ctorCall")))
- .bind("newVarDecl"))).bind("declStmt")))
+ .bind("newVarDecl")))
+ .bind("declStmt")))
.bind("blockStmt");
};
- Finder->addMatcher(
- localVarCopiedFrom(anyOf(ConstRefReturningFunctionCall,
- ConstRefReturningMethodCall)),
- this);
+ Finder->addMatcher(localVarCopiedFrom(anyOf(ConstRefReturningFunctionCall,
+ ConstRefReturningMethodCall)),
+ this);
Finder->addMatcher(localVarCopiedFrom(declRefExpr(
to(varDecl(hasLocalStorage()).bind("oldVarDecl")))),
Modified: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp Tue Nov 8 01:50:19 2016
@@ -127,7 +127,7 @@ void UnnecessaryValueParamCheck::check(c
FunctionDecl = FunctionDecl->getPreviousDecl()) {
const auto &CurrentParam = *FunctionDecl->getParamDecl(Index);
Diag << utils::fixit::changeVarDeclToReference(CurrentParam,
- *Result.Context);
+ *Result.Context);
// The parameter of each declaration needs to be checked individually as to
// whether it is const or not as constness can differ between definition and
// declaration.
Modified: clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp Tue Nov 8 01:50:19 2016
@@ -8,10 +8,10 @@
//===----------------------------------------------------------------------===//
#include "AvoidConstParamsInDecls.h"
-#include "llvm/ADT/Optional.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Lex/Lexer.h"
+#include "llvm/ADT/Optional.h"
using namespace clang::ast_matchers;
Modified: clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp Tue Nov 8 01:50:19 2016
@@ -117,8 +117,8 @@ BracesAroundStatementsCheck::BracesAroun
// Always add braces by default.
ShortStatementLines(Options.get("ShortStatementLines", 0U)) {}
-void
-BracesAroundStatementsCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
+void BracesAroundStatementsCheck::storeOptions(
+ ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "ShortStatementLines", ShortStatementLines);
}
@@ -130,8 +130,8 @@ void BracesAroundStatementsCheck::regist
Finder->addMatcher(cxxForRangeStmt().bind("for-range"), this);
}
-void
-BracesAroundStatementsCheck::check(const MatchFinder::MatchResult &Result) {
+void BracesAroundStatementsCheck::check(
+ const MatchFinder::MatchResult &Result) {
const SourceManager &SM = *Result.SourceManager;
const ASTContext *Context = Result.Context;
Modified: clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.h Tue Nov 8 01:50:19 2016
@@ -58,7 +58,7 @@ private:
const ASTContext *Context);
private:
- std::set<const Stmt*> ForceBracesStmts;
+ std::set<const Stmt *> ForceBracesStmts;
const unsigned ShortStatementLines;
};
Modified: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp Tue Nov 8 01:50:19 2016
@@ -9,13 +9,13 @@
#include "IdentifierNamingCheck.h"
-#include "llvm/ADT/DenseMapInfo.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/Format.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
+#include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/Format.h"
#define DEBUG_TYPE "clang-tidy"
@@ -662,7 +662,8 @@ static void addUsage(IdentifierNamingChe
/// Convenience method when the usage to be added is a NamedDecl
static void addUsage(IdentifierNamingCheck::NamingCheckFailureMap &Failures,
- const NamedDecl *Decl, SourceRange Range, SourceManager *SourceMgr = nullptr) {
+ const NamedDecl *Decl, SourceRange Range,
+ SourceManager *SourceMgr = nullptr) {
return addUsage(Failures, IdentifierNamingCheck::NamingCheckId(
Decl->getLocation(), Decl->getNameAsString()),
Range, SourceMgr);
@@ -752,7 +753,8 @@ void IdentifierNamingCheck::check(const
if (const auto *DeclRef = Result.Nodes.getNodeAs<DeclRefExpr>("declRef")) {
SourceRange Range = DeclRef->getNameInfo().getSourceRange();
- addUsage(NamingCheckFailures, DeclRef->getDecl(), Range, Result.SourceManager);
+ addUsage(NamingCheckFailures, DeclRef->getDecl(), Range,
+ Result.SourceManager);
return;
}
Modified: clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.cpp Tue Nov 8 01:50:19 2016
@@ -307,8 +307,7 @@ ImplicitBoolCastCheck::ImplicitBoolCastC
AllowConditionalPointerCasts(
Options.get("AllowConditionalPointerCasts", false)) {}
-void ImplicitBoolCastCheck::storeOptions(
- ClangTidyOptions::OptionMap &Opts) {
+void ImplicitBoolCastCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "AllowConditionalIntegerCasts",
AllowConditionalIntegerCasts);
Options.store(Opts, "AllowConditionalPointerCasts",
Modified: clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp Tue Nov 8 01:50:19 2016
@@ -110,7 +110,8 @@ findDifferingParamsInDeclaration(const F
SourceParamName != OtherParamName) {
SourceRange OtherParamNameRange =
DeclarationNameInfo((*OtherParamIt)->getDeclName(),
- (*OtherParamIt)->getLocation()).getSourceRange();
+ (*OtherParamIt)->getLocation())
+ .getSourceRange();
bool GenerateFixItHint = checkIfFixItHintIsApplicable(
ParameterSourceDeclaration, *SourceParamIt, OriginalDeclaration);
@@ -202,13 +203,15 @@ std::string joinParameterNames(
}
void formatDifferingParamsDiagnostic(
- InconsistentDeclarationParameterNameCheck *Check,
- SourceLocation Location, StringRef OtherDeclarationDescription,
+ InconsistentDeclarationParameterNameCheck *Check, SourceLocation Location,
+ StringRef OtherDeclarationDescription,
const DifferingParamsContainer &DifferingParams) {
- auto ChooseOtherName =
- [](const DifferingParamInfo &ParamInfo) { return ParamInfo.OtherName; };
- auto ChooseSourceName =
- [](const DifferingParamInfo &ParamInfo) { return ParamInfo.SourceName; };
+ auto ChooseOtherName = [](const DifferingParamInfo &ParamInfo) {
+ return ParamInfo.OtherName;
+ };
+ auto ChooseSourceName = [](const DifferingParamInfo &ParamInfo) {
+ return ParamInfo.SourceName;
+ };
auto ParamDiag =
Check->diag(Location,
Modified: clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp Tue Nov 8 01:50:19 2016
@@ -114,7 +114,8 @@ void NamespaceCommentCheck::check(const
Message =
(llvm::Twine(
"%0 ends with a comment that refers to a wrong namespace '") +
- NamespaceNameInComment + "'").str();
+ NamespaceNameInComment + "'")
+ .str();
} else if (Comment.startswith("//")) {
// Assume that this is an unrecognized form of a namespace closing line
// comment. Replace it.
Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp Tue Nov 8 01:50:19 2016
@@ -33,9 +33,10 @@ bool isLocationInMacroExpansion(const So
void RedundantControlFlowCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
- functionDecl(isDefinition(), returns(voidType()),
- has(compoundStmt(hasAnySubstatement(returnStmt(
- unless(has(expr()))))).bind("return"))),
+ functionDecl(
+ isDefinition(), returns(voidType()),
+ has(compoundStmt(hasAnySubstatement(returnStmt(unless(has(expr())))))
+ .bind("return"))),
this);
auto CompoundContinue =
has(compoundStmt(hasAnySubstatement(continueStmt())).bind("continue"));
Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp Tue Nov 8 01:50:19 2016
@@ -19,7 +19,8 @@ namespace tidy {
namespace readability {
void RedundantDeclarationCheck::registerMatchers(MatchFinder *Finder) {
- Finder->addMatcher(namedDecl(anyOf(varDecl(), functionDecl())).bind("Decl"), this);
+ Finder->addMatcher(namedDecl(anyOf(varDecl(), functionDecl())).bind("Decl"),
+ this);
}
void RedundantDeclarationCheck::check(const MatchFinder::MatchResult &Result) {
@@ -33,8 +34,8 @@ void RedundantDeclarationCheck::check(co
const SourceManager &SM = *Result.SourceManager;
const bool DifferentHeaders =
- !SM.isInMainFile(D->getLocation()) &&
- !SM.isWrittenInSameFile(Prev->getLocation(), D->getLocation());
+ !SM.isInMainFile(D->getLocation()) &&
+ !SM.isWrittenInSameFile(Prev->getLocation(), D->getLocation());
bool MultiVar = false;
if (const auto *VD = dyn_cast<VarDecl>(D)) {
@@ -57,8 +58,7 @@ void RedundantDeclarationCheck::check(co
SourceLocation EndLoc = Lexer::getLocForEndOfToken(
D->getSourceRange().getEnd(), 0, SM, Result.Context->getLangOpts());
{
- auto Diag = diag(D->getLocation(), "redundant %0 declaration")
- << D;
+ auto Diag = diag(D->getLocation(), "redundant %0 declaration") << D;
if (!MultiVar && !DifferentHeaders)
Diag << FixItHint::CreateRemoval(
SourceRange(D->getSourceRange().getBegin(), EndLoc));
Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp Tue Nov 8 01:50:19 2016
@@ -8,10 +8,10 @@
//===----------------------------------------------------------------------===//
#include "RedundantMemberInitCheck.h"
+#include "../utils/Matchers.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
-#include "../utils/Matchers.h"
#include <algorithm>
using namespace clang::ast_matchers;
Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp Tue Nov 8 01:50:19 2016
@@ -77,17 +77,14 @@ void RedundantStringCStrCheck::registerM
return;
// Match expressions of type 'string' or 'string*'.
- const auto StringDecl =
- cxxRecordDecl(hasName("::std::basic_string"));
+ const auto StringDecl = cxxRecordDecl(hasName("::std::basic_string"));
const auto StringExpr =
- expr(anyOf(hasType(StringDecl),
- hasType(qualType(pointsTo(StringDecl)))));
+ expr(anyOf(hasType(StringDecl), hasType(qualType(pointsTo(StringDecl)))));
// Match string constructor.
const auto StringConstructorExpr = expr(anyOf(
- cxxConstructExpr(
- argumentCountIs(1),
- hasDeclaration(cxxMethodDecl(hasName("basic_string")))),
+ cxxConstructExpr(argumentCountIs(1),
+ hasDeclaration(cxxMethodDecl(hasName("basic_string")))),
cxxConstructExpr(
argumentCountIs(2),
hasDeclaration(cxxMethodDecl(hasName("basic_string"))),
@@ -103,21 +100,18 @@ void RedundantStringCStrCheck::registerM
.bind("call");
// Detect redundant 'c_str()' calls through a string constructor.
- Finder->addMatcher(
- cxxConstructExpr(StringConstructorExpr,
- hasArgument(0, StringCStrCallExpr)),
- this);
+ Finder->addMatcher(cxxConstructExpr(StringConstructorExpr,
+ hasArgument(0, StringCStrCallExpr)),
+ this);
// Detect: 's == str.c_str()' -> 's == str'
Finder->addMatcher(
cxxOperatorCallExpr(
- anyOf(hasOverloadedOperatorName("<"),
- hasOverloadedOperatorName(">"),
- hasOverloadedOperatorName(">="),
- hasOverloadedOperatorName("<="),
- hasOverloadedOperatorName("!="),
- hasOverloadedOperatorName("=="),
- hasOverloadedOperatorName("+")),
+ anyOf(
+ hasOverloadedOperatorName("<"), hasOverloadedOperatorName(">"),
+ hasOverloadedOperatorName(">="), hasOverloadedOperatorName("<="),
+ hasOverloadedOperatorName("!="), hasOverloadedOperatorName("=="),
+ hasOverloadedOperatorName("+")),
anyOf(allOf(hasArgument(0, StringExpr),
hasArgument(1, StringCStrCallExpr)),
allOf(hasArgument(0, StringCStrCallExpr),
@@ -126,47 +120,41 @@ void RedundantStringCStrCheck::registerM
// Detect: 'dst += str.c_str()' -> 'dst += str'
// Detect: 's = str.c_str()' -> 's = str'
- Finder->addMatcher(
- cxxOperatorCallExpr(
- anyOf(hasOverloadedOperatorName("="),
- hasOverloadedOperatorName("+=")),
- hasArgument(0, StringExpr),
- hasArgument(1, StringCStrCallExpr)),
- this);
+ Finder->addMatcher(cxxOperatorCallExpr(anyOf(hasOverloadedOperatorName("="),
+ hasOverloadedOperatorName("+=")),
+ hasArgument(0, StringExpr),
+ hasArgument(1, StringCStrCallExpr)),
+ this);
// Detect: 'dst.append(str.c_str())' -> 'dst.append(str)'
Finder->addMatcher(
- cxxMemberCallExpr(on(StringExpr),
- callee(decl(cxxMethodDecl(
- hasAnyName("append", "assign", "compare")))),
- argumentCountIs(1),
- hasArgument(0, StringCStrCallExpr)),
+ cxxMemberCallExpr(on(StringExpr), callee(decl(cxxMethodDecl(hasAnyName(
+ "append", "assign", "compare")))),
+ argumentCountIs(1), hasArgument(0, StringCStrCallExpr)),
this);
// Detect: 'dst.compare(p, n, str.c_str())' -> 'dst.compare(p, n, str)'
Finder->addMatcher(
cxxMemberCallExpr(on(StringExpr),
- callee(decl(cxxMethodDecl(hasName("compare")))),
- argumentCountIs(3),
- hasArgument(2, StringCStrCallExpr)),
+ callee(decl(cxxMethodDecl(hasName("compare")))),
+ argumentCountIs(3), hasArgument(2, StringCStrCallExpr)),
this);
// Detect: 'dst.find(str.c_str())' -> 'dst.find(str)'
Finder->addMatcher(
cxxMemberCallExpr(on(StringExpr),
- callee(decl(cxxMethodDecl(
- hasAnyName("find", "find_first_not_of", "find_first_of",
- "find_last_not_of", "find_last_of", "rfind")))),
- anyOf(argumentCountIs(1), argumentCountIs(2)),
- hasArgument(0, StringCStrCallExpr)),
+ callee(decl(cxxMethodDecl(hasAnyName(
+ "find", "find_first_not_of", "find_first_of",
+ "find_last_not_of", "find_last_of", "rfind")))),
+ anyOf(argumentCountIs(1), argumentCountIs(2)),
+ hasArgument(0, StringCStrCallExpr)),
this);
// Detect: 'dst.insert(pos, str.c_str())' -> 'dst.insert(pos, str)'
Finder->addMatcher(
cxxMemberCallExpr(on(StringExpr),
- callee(decl(cxxMethodDecl(hasName("insert")))),
- argumentCountIs(2),
- hasArgument(1, StringCStrCallExpr)),
+ callee(decl(cxxMethodDecl(hasName("insert")))),
+ argumentCountIs(2), hasArgument(1, StringCStrCallExpr)),
this);
// Detect redundant 'c_str()' calls through a StringRef constructor.
@@ -176,9 +164,8 @@ void RedundantStringCStrCheck::registerM
// wrt. string types and they internally make a StringRef
// referring to the argument. Passing a string directly to
// them is preferred to passing a char pointer.
- hasDeclaration(
- cxxMethodDecl(hasAnyName("::llvm::StringRef::StringRef",
- "::llvm::Twine::Twine"))),
+ hasDeclaration(cxxMethodDecl(hasAnyName(
+ "::llvm::StringRef::StringRef", "::llvm::Twine::Twine"))),
argumentCountIs(1),
// The only argument must have the form x.c_str() or p->c_str()
// where the method is string::c_str(). StringRef also has
Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantStringInitCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantStringInitCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantStringInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantStringInitCheck.cpp Tue Nov 8 01:50:19 2016
@@ -33,10 +33,9 @@ void RedundantStringInitCheck::registerM
hasArgument(1, cxxDefaultArgExpr()))));
// Match a string constructor expression with an empty string literal.
- const auto EmptyStringCtorExpr =
- cxxConstructExpr(StringConstructorExpr,
- hasArgument(0, ignoringParenImpCasts(
- stringLiteral(hasSize(0)))));
+ const auto EmptyStringCtorExpr = cxxConstructExpr(
+ StringConstructorExpr,
+ hasArgument(0, ignoringParenImpCasts(stringLiteral(hasSize(0)))));
const auto EmptyStringCtorExprWithTemporaries =
cxxConstructExpr(StringConstructorExpr,
Modified: clang-tools-extra/trunk/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.h Tue Nov 8 01:50:19 2016
@@ -22,7 +22,8 @@ namespace readability {
/// http://clang.llvm.org/extra/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.html
class StaticDefinitionInAnonymousNamespaceCheck : public ClangTidyCheck {
public:
- StaticDefinitionInAnonymousNamespaceCheck(StringRef Name, ClangTidyContext *Context)
+ StaticDefinitionInAnonymousNamespaceCheck(StringRef Name,
+ ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Modified: clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp Tue Nov 8 01:50:19 2016
@@ -67,4 +67,3 @@ void UniqueptrDeleteReleaseCheck::check(
} // namespace readability
} // namespace tidy
} // namespace clang
-
Modified: clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h Tue Nov 8 01:50:19 2016
@@ -34,4 +34,3 @@ public:
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_UNIQUEPTR_DELETE_RELEASE_H
-
Modified: clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp Tue Nov 8 01:50:19 2016
@@ -93,9 +93,7 @@ static cl::opt<bool>
SystemHeaders("system-headers",
cl::desc("Display the errors from system headers."),
cl::init(false), cl::cat(ClangTidyCategory));
-static cl::opt<std::string>
- LineFilter("line-filter",
- cl::desc(R"(
+static cl::opt<std::string> LineFilter("line-filter", cl::desc(R"(
List of files with line ranges to filter the
warnings. Can be used together with
-header-filter. The format of the list is a
@@ -105,7 +103,8 @@ JSON array of objects:
{"name":"file2.h"}
]
)"),
- cl::init(""), cl::cat(ClangTidyCategory));
+ cl::init(""),
+ cl::cat(ClangTidyCategory));
static cl::opt<bool> Fix("fix", cl::desc(R"(
Apply suggested fixes. Without -fix-errors
@@ -220,7 +219,7 @@ static void printProfileData(const Profi
std::vector<std::pair<llvm::TimeRecord, StringRef>> Timers;
TimeRecord Total;
- for (const auto& P : Profile.Records) {
+ for (const auto &P : Profile.Records) {
Timers.emplace_back(P.getValue(), P.getKey());
Total += P.getValue();
}
@@ -324,7 +323,7 @@ static int clangTidyMain(int argc, const
std::vector<std::string> EnabledChecks = getCheckNames(EffectiveOptions);
if (ExplainConfig) {
- //FIXME: Show other ClangTidyOptions' fields, like ExtraArg.
+ // FIXME: Show other ClangTidyOptions' fields, like ExtraArg.
std::vector<clang::tidy::ClangTidyOptionsProvider::OptionsSource>
RawOptions = OptionsProvider->getRawOptions(FilePath);
for (const std::string &Check : EnabledChecks) {
@@ -377,8 +376,7 @@ static int clangTidyMain(int argc, const
std::vector<ClangTidyError> Errors;
ClangTidyStats Stats =
runClangTidy(std::move(OptionsProvider), OptionsParser.getCompilations(),
- PathList, &Errors,
- EnableCheckProfile ? &Profile : nullptr);
+ PathList, &Errors, EnableCheckProfile ? &Profile : nullptr);
bool FoundErrors =
std::find_if(Errors.begin(), Errors.end(), [](const ClangTidyError &E) {
return E.DiagLevel == ClangTidyError::Error;
@@ -458,7 +456,7 @@ static int LLVM_ATTRIBUTE_UNUSED Moderni
// This anchor is used to force the linker to link the MPIModule.
extern volatile int MPIModuleAnchorSource;
static int LLVM_ATTRIBUTE_UNUSED MPIModuleAnchorDestination =
- MPIModuleAnchorSource;
+ MPIModuleAnchorSource;
// This anchor is used to force the linker to link the PerformanceModule.
extern volatile int PerformanceModuleAnchorSource;
Modified: clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp Tue Nov 8 01:50:19 2016
@@ -21,9 +21,8 @@ public:
// Implements PPCallbacks::InclusionDerective(). Records the names and source
// locations of the inclusions in the main source file being processed.
void InclusionDirective(SourceLocation HashLocation,
- const Token & IncludeToken,
- StringRef FileNameRef, bool IsAngled,
- CharSourceRange FileNameRange,
+ const Token &IncludeToken, StringRef FileNameRef,
+ bool IsAngled, CharSourceRange FileNameRange,
const FileEntry * /*IncludedFile*/,
StringRef /*SearchPath*/, StringRef /*RelativePath*/,
const Module * /*ImportedModule*/) override {
Modified: clang-tools-extra/trunk/clang-tidy/utils/Matchers.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/Matchers.h?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/Matchers.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/Matchers.h Tue Nov 8 01:50:19 2016
@@ -10,8 +10,8 @@
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_MATCHERS_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_MATCHERS_H
-#include "clang/ASTMatchers/ASTMatchers.h"
#include "TypeTraits.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
namespace clang {
namespace tidy {
@@ -21,9 +21,7 @@ AST_MATCHER(BinaryOperator, isRelational
return Node.isRelationalOp();
}
-AST_MATCHER(BinaryOperator, isEqualityOperator) {
- return Node.isEqualityOp();
-}
+AST_MATCHER(BinaryOperator, isEqualityOperator) { return Node.isEqualityOp(); }
AST_MATCHER(BinaryOperator, isComparisonOperator) {
return Node.isComparisonOp();
Modified: clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp Tue Nov 8 01:50:19 2016
@@ -35,11 +35,9 @@ NamespaceAliaser::createAlias(ASTContext
if (!Function || !Function->hasBody())
return None;
-
if (AddedAliases[Function].count(Namespace.str()) != 0)
return None;
-
// FIXME: Doesn't consider the order of declarations.
// If we accidentially pick an alias defined later in the function,
// the output won't compile.
Modified: clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp Tue Nov 8 01:50:19 2016
@@ -65,7 +65,8 @@ bool recordIsTriviallyDefaultConstructib
if (ClassDecl->hasTrivialDefaultConstructor())
return true;
- // If all its fields are trivially constructible and have no default initializers.
+ // If all its fields are trivially constructible and have no default
+ // initializers.
for (const FieldDecl *Field : ClassDecl->fields()) {
if (Field->hasInClassInitializer())
return false;
@@ -84,8 +85,7 @@ bool recordIsTriviallyDefaultConstructib
}
// Based on QualType::isTrivial.
-bool isTriviallyDefaultConstructible(QualType Type,
- const ASTContext &Context) {
+bool isTriviallyDefaultConstructible(QualType Type, const ASTContext &Context) {
if (Type.isNull())
return false;
Modified: clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.cpp Tue Nov 8 01:50:19 2016
@@ -68,7 +68,8 @@ Optional<FixItHint> UsingInserter::creat
if (HasConflictingDeclaration || HasConflictingDeclRef)
return None;
- std::string Declaration = (llvm::Twine("\nusing ") + QualifiedName + ";").str();
+ std::string Declaration =
+ (llvm::Twine("\nusing ") + QualifiedName + ";").str();
AddedUsing.emplace(std::make_pair(Function, QualifiedName.str()));
return FixItHint::CreateInsertion(InsertLoc, Declaration);
Modified: clang-tools-extra/trunk/tool-template/ToolTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/tool-template/ToolTemplate.cpp?rev=286221&r1=286220&r2=286221&view=diff
==============================================================================
--- clang-tools-extra/trunk/tool-template/ToolTemplate.cpp (original)
+++ clang-tools-extra/trunk/tool-template/ToolTemplate.cpp Tue Nov 8 01:50:19 2016
@@ -34,8 +34,8 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Lex/Lexer.h"
More information about the cfe-commits
mailing list