diff --git a/clang/lib/Analysis/FlowSensitive/Arena.cpp b/clang/lib/Analysis/FlowSensitive/Arena.cpp index 81137e8088e33..7542a137c735e 100644 --- a/clang/lib/Analysis/FlowSensitive/Arena.cpp +++ b/clang/lib/Analysis/FlowSensitive/Arena.cpp @@ -23,8 +23,8 @@ canonicalFormulaPair(const Formula &LHS, const Formula &RHS) { } template -const Formula &cached(llvm::DenseMap &Cache, Key K, - ComputeFunc &&Compute) { +static const Formula &cached(llvm::DenseMap &Cache, Key K, + ComputeFunc &&Compute) { auto [It, Inserted] = Cache.try_emplace(std::forward(K)); if (Inserted) It->second = Compute(); diff --git a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp index c5c6e900b7976..693313b322af1 100644 --- a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp +++ b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp @@ -64,7 +64,8 @@ static llvm::DenseMap intersectDeclToLoc( // expression must map to the same location / value. This is the case if we are // performing a join for control flow within a full-expression (which is the // only case when this function should be used). -template MapT joinExprMaps(const MapT &Map1, const MapT &Map2) { +template +static MapT joinExprMaps(const MapT &Map1, const MapT &Map2) { MapT Result = Map1; for (const auto &Entry : Map2) { @@ -204,10 +205,11 @@ static WidenResult widenDistinctValues(QualType Type, Value &Prev, // Returns whether the values in `Map1` and `Map2` compare equal for those // keys that `Map1` and `Map2` have in common. template -bool compareKeyToValueMaps(const llvm::MapVector &Map1, - const llvm::MapVector &Map2, - const Environment &Env1, const Environment &Env2, - Environment::ValueModel &Model) { +static bool compareKeyToValueMaps(const llvm::MapVector &Map1, + const llvm::MapVector &Map2, + const Environment &Env1, + const Environment &Env2, + Environment::ValueModel &Model) { for (auto &Entry : Map1) { Key K = Entry.first; assert(K != nullptr); @@ -260,7 +262,7 @@ joinLocToVal(const llvm::MapVector &LocToVal, // Perform widening on either `LocToVal` or `ExprToVal`. `Key` must be either // `const StorageLocation *` or `const Expr *`. template -llvm::MapVector +static llvm::MapVector widenKeyToValueMap(const llvm::MapVector &CurMap, const llvm::MapVector &PrevMap, Environment &CurEnv, const Environment &PrevEnv, diff --git a/clang/lib/Analysis/FlowSensitive/Models/ChromiumCheckModel.cpp b/clang/lib/Analysis/FlowSensitive/Models/ChromiumCheckModel.cpp index 77d817dafe837..02fd73754f01b 100644 --- a/clang/lib/Analysis/FlowSensitive/Models/ChromiumCheckModel.cpp +++ b/clang/lib/Analysis/FlowSensitive/Models/ChromiumCheckModel.cpp @@ -16,8 +16,9 @@ namespace dataflow { /// Determines whether `D` is one of the methods used to implement Chromium's /// `CHECK` macros. Populates `CheckDecls`, if empty. -bool isCheckLikeMethod(llvm::SmallDenseSet &CheckDecls, - const CXXMethodDecl &D) { +static bool +isCheckLikeMethod(llvm::SmallDenseSet &CheckDecls, + const CXXMethodDecl &D) { // All of the methods of interest are static, so avoid any lookup for // non-static methods (the common case). if (!D.isStatic()) diff --git a/clang/lib/Analysis/IntervalPartition.cpp b/clang/lib/Analysis/IntervalPartition.cpp index 5f06606ec132e..41199f358c5b9 100644 --- a/clang/lib/Analysis/IntervalPartition.cpp +++ b/clang/lib/Analysis/IntervalPartition.cpp @@ -36,8 +36,8 @@ static unsigned getID(const CFGIntervalNode &I) { return I.ID; } // `Node` must be one of `CFGBlock` or `CFGIntervalNode`. template -BuildResult buildInterval(llvm::BitVector &Partitioned, - const Node *Header) { +static BuildResult buildInterval(llvm::BitVector &Partitioned, + const Node *Header) { assert(Header != nullptr); BuildResult Interval; Interval.Nodes.push_back(Header); @@ -102,10 +102,10 @@ BuildResult buildInterval(llvm::BitVector &Partitioned, } template -void fillIntervalNode(CFGIntervalGraph &Graph, - std::vector &Index, - std::queue &Successors, - llvm::BitVector &Partitioned, const Node *Header) { +static void fillIntervalNode(CFGIntervalGraph &Graph, + std::vector &Index, + std::queue &Successors, + llvm::BitVector &Partitioned, const Node *Header) { BuildResult Result = buildInterval(Partitioned, Header); for (const auto *S : Result.Successors) Successors.push(S); @@ -138,8 +138,8 @@ void fillIntervalNode(CFGIntervalGraph &Graph, } template -CFGIntervalGraph partitionIntoIntervalsImpl(unsigned NumBlockIDs, - const Node *EntryBlock) { +static CFGIntervalGraph partitionIntoIntervalsImpl(unsigned NumBlockIDs, + const Node *EntryBlock) { assert(EntryBlock != nullptr); CFGIntervalGraph Graph; // `Index` maps all of the nodes of the input graph to the interval to which diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp index 5f36ffa926b26..321097e16a45f 100644 --- a/clang/lib/Analysis/UnsafeBufferUsage.cpp +++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp @@ -2326,7 +2326,8 @@ static StringRef getEndOfLine() { } // Returns the text indicating that the user needs to provide input there: -std::string getUserFillPlaceHolder(StringRef HintTextToUser = "placeholder") { +static std::string +getUserFillPlaceHolder(StringRef HintTextToUser = "placeholder") { std::string s = std::string("<# "); s += HintTextToUser; s += " #>";