From 8407df72a3b7a6bee199ce321fa4731dc8be241b Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 9 Mar 2015 16:47:52 +0000 Subject: [PATCH] Make helper functions static. NFC. Found by -Wmissing-prototypes. llvm-svn: 231668 --- clang/lib/AST/ExprConstant.cpp | 7 ++++--- clang/lib/ASTMatchers/Dynamic/Diagnostics.cpp | 22 +++++++++------------- clang/lib/Format/UnwrappedLineParser.cpp | 2 +- clang/lib/StaticAnalyzer/Core/RegionStore.cpp | 2 +- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 083572b..280ba57 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -1406,7 +1406,7 @@ static bool CheckConstantExpression(EvalInfo &Info, SourceLocation DiagLoc, return true; } -const ValueDecl *GetLValueBaseDecl(const LValue &LVal) { +static const ValueDecl *GetLValueBaseDecl(const LValue &LVal) { return LVal.Base.dyn_cast(); } @@ -2502,8 +2502,9 @@ static bool AreElementsOfSameArray(QualType ObjType, } /// Find the complete object to which an LValue refers. -CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E, AccessKinds AK, - const LValue &LVal, QualType LValType) { +static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E, + AccessKinds AK, const LValue &LVal, + QualType LValType) { if (!LVal.Base) { Info.Diag(E, diag::note_constexpr_access_null) << AK; return CompleteObject(); diff --git a/clang/lib/ASTMatchers/Dynamic/Diagnostics.cpp b/clang/lib/ASTMatchers/Dynamic/Diagnostics.cpp index b0abdc7..cb545d2 100644 --- a/clang/lib/ASTMatchers/Dynamic/Diagnostics.cpp +++ b/clang/lib/ASTMatchers/Dynamic/Diagnostics.cpp @@ -8,10 +8,9 @@ //===----------------------------------------------------------------------===// #include "clang/ASTMatchers/Dynamic/Diagnostics.h" - -namespace clang { -namespace ast_matchers { -namespace dynamic { +using namespace clang; +using namespace clang::ast_matchers; +using namespace clang::ast_matchers::dynamic; Diagnostics::ArgStream Diagnostics::pushContextFrame(ContextType Type, SourceRange Range) { @@ -75,7 +74,7 @@ Diagnostics::ArgStream Diagnostics::addError(const SourceRange &Range, return ArgStream(&Last.Messages.back().Args); } -StringRef contextTypeToFormatString(Diagnostics::ContextType Type) { +static StringRef contextTypeToFormatString(Diagnostics::ContextType Type) { switch (Type) { case Diagnostics::CT_MatcherConstruct: return "Error building matcher $0."; @@ -85,7 +84,7 @@ StringRef contextTypeToFormatString(Diagnostics::ContextType Type) { llvm_unreachable("Unknown ContextType value."); } -StringRef errorTypeToFormatString(Diagnostics::ErrorType Type) { +static StringRef errorTypeToFormatString(Diagnostics::ErrorType Type) { switch (Type) { case Diagnostics::ET_RegistryMatcherNotFound: return "Matcher not found: $0"; @@ -130,8 +129,9 @@ StringRef errorTypeToFormatString(Diagnostics::ErrorType Type) { llvm_unreachable("Unknown ErrorType value."); } -void formatErrorString(StringRef FormatString, ArrayRef Args, - llvm::raw_ostream &OS) { +static void formatErrorString(StringRef FormatString, + ArrayRef Args, + llvm::raw_ostream &OS) { while (!FormatString.empty()) { std::pair Pieces = FormatString.split("$"); OS << Pieces.first.str(); @@ -150,7 +150,7 @@ void formatErrorString(StringRef FormatString, ArrayRef Args, } } -static void maybeAddLineAndColumn(const SourceRange &Range, +static void maybeAddLineAndColumn(const dynamic::SourceRange &Range, llvm::raw_ostream &OS) { if (Range.Start.Line > 0 && Range.Start.Column > 0) { OS << Range.Start.Line << ":" << Range.Start.Column << ": "; @@ -216,7 +216,3 @@ std::string Diagnostics::toStringFull() const { printToStreamFull(OS); return OS.str(); } - -} // namespace dynamic -} // namespace ast_matchers -} // namespace clang diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 800ec77..5222418 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -605,7 +605,7 @@ void UnwrappedLineParser::parsePPUnknown() { // Here we blacklist certain tokens that are not usually the first token in an // unwrapped line. This is used in attempt to distinguish macro calls without // trailing semicolons from other constructs split to several lines. -bool tokenCanStartNewLine(clang::Token Tok) { +static bool tokenCanStartNewLine(const clang::Token &Tok) { // Semicolon can be a null-statement, l_square can be a start of a macro or // a C++11 attribute, but this doesn't seem to be common. return Tok.isNot(tok::semi) && Tok.isNot(tok::l_brace) && diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp index 4505622..6d41fc2 100644 --- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -767,7 +767,7 @@ static inline bool isUnionField(const FieldRegion *FR) { typedef SmallVector FieldVector; -void getSymbolicOffsetFields(BindingKey K, FieldVector &Fields) { +static void getSymbolicOffsetFields(BindingKey K, FieldVector &Fields) { assert(K.hasSymbolicOffset() && "Not implemented for concrete offset keys"); const MemRegion *Base = K.getConcreteOffsetRegion(); -- 2.7.4