diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-03-23 12:49:15 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-03-23 12:49:15 +0000 |
| commit | e71037123b266a4d81a3f568d773b58e7fd91285 (patch) | |
| tree | 7a5342114bdb93282e059eb61cbd367f65daa7ff /clang-tools-extra/clang-tidy | |
| parent | 9e925c1d66f01026883250553fe2894fa05e918b (diff) | |
| download | bcm5719-llvm-e71037123b266a4d81a3f568d773b58e7fd91285.tar.gz bcm5719-llvm-e71037123b266a4d81a3f568d773b58e7fd91285.zip | |
Make helpers static. clang-tools edition.
Also purge dead code found by it. NFC.
llvm-svn: 232948
Diffstat (limited to 'clang-tools-extra/clang-tidy')
4 files changed, 13 insertions, 12 deletions
diff --git a/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp b/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp index a4cba6469eb..7d4cf7e44e6 100644 --- a/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp +++ b/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp @@ -33,7 +33,7 @@ AvoidCStyleCastsCheck::registerMatchers(ast_matchers::MatchFinder *Finder) { this); } -bool needsConstCast(QualType SourceType, QualType DestType) { +static bool needsConstCast(QualType SourceType, QualType DestType) { SourceType = SourceType.getNonReferenceType(); DestType = DestType.getNonReferenceType(); while (SourceType->isPointerType() && DestType->isPointerType()) { @@ -45,7 +45,7 @@ bool needsConstCast(QualType SourceType, QualType DestType) { return false; } -bool pointedTypesAreEqual(QualType SourceType, QualType DestType) { +static bool pointedTypesAreEqual(QualType SourceType, QualType DestType) { SourceType = SourceType.getNonReferenceType(); DestType = DestType.getNonReferenceType(); while (SourceType->isPointerType() && DestType->isPointerType()) { diff --git a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp index b880c96f3d9..d262f9fa89c 100644 --- a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp +++ b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp @@ -26,9 +26,9 @@ void ExplicitConstructorCheck::registerMatchers(MatchFinder *Finder) { // Looks for the token matching the predicate and returns the range of the found // token including trailing whitespace. -SourceRange FindToken(const SourceManager &Sources, LangOptions LangOpts, - SourceLocation StartLoc, SourceLocation EndLoc, - bool (*Pred)(const Token &)) { +static SourceRange FindToken(const SourceManager &Sources, LangOptions LangOpts, + SourceLocation StartLoc, SourceLocation EndLoc, + bool (*Pred)(const Token &)) { if (StartLoc.isMacroID() || EndLoc.isMacroID()) return SourceRange(); FileID File = Sources.getFileID(Sources.getSpellingLoc(StartLoc)); @@ -49,14 +49,14 @@ SourceRange FindToken(const SourceManager &Sources, LangOptions LangOpts, return SourceRange(); } -bool declIsStdInitializerList(const NamedDecl *D) { +static bool declIsStdInitializerList(const NamedDecl *D) { // First use the fast getName() method to avoid unnecessary calls to the // slow getQualifiedNameAsString(). return D->getName() == "initializer_list" && D->getQualifiedNameAsString() == "std::initializer_list"; } -bool isStdInitializerList(QualType Type) { +static bool isStdInitializerList(QualType Type) { Type = Type.getCanonicalType(); if (const auto *TS = Type->getAs<TemplateSpecializationType>()) { if (const TemplateDecl *TD = TS->getTemplateName().getAsTemplateDecl()) diff --git a/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp b/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp index 7264f49e8bd..69f456bed5d 100644 --- a/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp @@ -37,13 +37,14 @@ void NamespaceCommentCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher(namespaceDecl().bind("namespace"), this); } -bool locationsInSameFile(const SourceManager &Sources, SourceLocation Loc1, - SourceLocation Loc2) { +static bool locationsInSameFile(const SourceManager &Sources, + SourceLocation Loc1, SourceLocation Loc2) { return Loc1.isFileID() && Loc2.isFileID() && Sources.getFileID(Loc1) == Sources.getFileID(Loc2); } -std::string getNamespaceComment(const NamespaceDecl *ND, bool InsertLineBreak) { +static std::string getNamespaceComment(const NamespaceDecl *ND, + bool InsertLineBreak) { std::string Fix = "// namespace"; if (!ND->isAnonymousNamespace()) Fix.append(" ").append(ND->getNameAsString()); diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp index 398d2d06444..a9437a846d8 100644 --- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp +++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp @@ -215,7 +215,7 @@ static void printProfileData(const ProfileData &Profile, OS.flush(); } -std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider() { +static std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider() { ClangTidyGlobalOptions GlobalOptions; if (std::error_code Err = parseLineFilter(LineFilter, GlobalOptions)) { llvm::errs() << "Invalid LineFilter: " << Err.message() << "\n\nUsage:\n"; @@ -261,7 +261,7 @@ std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider() { OverrideOptions); } -int clangTidyMain(int argc, const char **argv) { +static int clangTidyMain(int argc, const char **argv) { CommonOptionsParser OptionsParser(argc, argv, ClangTidyCategory); auto OptionsProvider = createOptionsProvider(); |

