From 9a0689e072da1a60c8b858e829d57d5b1136bd30 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Fri, 17 Jul 2020 13:49:11 +0200 Subject: [PATCH] Make helpers static. NFC. --- clang/lib/ASTMatchers/Dynamic/Marshallers.cpp | 6 ++++-- clang/lib/Driver/ToolChains/Arch/RISCV.cpp | 8 ++++---- clang/lib/Sema/SemaType.cpp | 4 ++-- lld/COFF/DebugTypes.cpp | 3 ++- lld/MachO/Driver.cpp | 2 +- llvm/lib/Analysis/InlineAdvisor.cpp | 5 ++--- llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp | 2 ++ llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 2 ++ 8 files changed, 19 insertions(+), 13 deletions(-) diff --git a/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp b/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp index 989ee0f..33fb7a9 100644 --- a/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp +++ b/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp @@ -120,7 +120,8 @@ static constexpr std::pair {"BasicRegex", llvm::Regex::RegexFlags::BasicRegex}, }; -llvm::Optional getRegexFlag(llvm::StringRef Flag) { +static llvm::Optional +getRegexFlag(llvm::StringRef Flag) { for (const auto &StringFlag : RegexMap) { if (Flag == StringFlag.first) return StringFlag.second; @@ -128,7 +129,8 @@ llvm::Optional getRegexFlag(llvm::StringRef Flag) { return llvm::None; } -llvm::Optional getCloseRegexMatch(llvm::StringRef Flag) { +static llvm::Optional +getCloseRegexMatch(llvm::StringRef Flag) { for (const auto &StringFlag : RegexMap) { if (Flag.edit_distance(StringFlag.first) < 3) return StringFlag.first; diff --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp index be3f0a0..09ae453 100644 --- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp +++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -447,10 +447,10 @@ static bool getArchFeatures(const Driver &D, StringRef MArch, } // Get features except standard extension feature -void getRISCFeaturesFromMcpu(const Driver &D, const llvm::Triple &Triple, - const llvm::opt::ArgList &Args, - const llvm::opt::Arg *A, StringRef Mcpu, - std::vector &Features) { +static void getRISCFeaturesFromMcpu(const Driver &D, const llvm::Triple &Triple, + const llvm::opt::ArgList &Args, + const llvm::opt::Arg *A, StringRef Mcpu, + std::vector &Features) { bool Is64Bit = (Triple.getArch() == llvm::Triple::riscv64); llvm::RISCV::CPUKind CPUKind = llvm::RISCV::parseCPUKind(Mcpu); if (!llvm::RISCV::checkCPUKind(CPUKind, Is64Bit) || diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 629fdff..ee7bf98 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -7686,8 +7686,8 @@ static bool isPermittedNeonBaseType(QualType &Ty, BTy->getKind() == BuiltinType::BFloat16; } -bool verifyValidIntegerConstantExpr(Sema &S, const ParsedAttr &Attr, - llvm::APSInt &Result) { +static bool verifyValidIntegerConstantExpr(Sema &S, const ParsedAttr &Attr, + llvm::APSInt &Result) { const auto *AttrExpr = Attr.getArgAsExpr(0); if (AttrExpr->isTypeDependent() || AttrExpr->isValueDependent() || !AttrExpr->isIntegerConstantExpr(Result, S.Context)) { diff --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp index 4790b01..b8c488f 100644 --- a/lld/COFF/DebugTypes.cpp +++ b/lld/COFF/DebugTypes.cpp @@ -377,7 +377,8 @@ static PrecompSource *findObjByName(StringRef fileNameOnly) { return nullptr; } -Expected findPrecompMap(ObjFile *file, PrecompRecord &pr) { +static Expected findPrecompMap(ObjFile *file, + PrecompRecord &pr) { // Cross-compile warning: given that Clang doesn't generate LF_PRECOMP // records, we assume the OBJ comes from a Windows build of cl.exe. Thusly, // the paths embedded in the OBJs are in the Windows format. diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp index 2a3b004..4dfb387 100644 --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -204,7 +204,7 @@ static bool isArchString(StringRef s) { // entry (the one nearest to the front of the list.) // // The file can also have line comments that start with '#'. -void parseOrderFile(StringRef path) { +static void parseOrderFile(StringRef path) { Optional buffer = readFile(path); if (!buffer) { error("Could not read order file at " + path); diff --git a/llvm/lib/Analysis/InlineAdvisor.cpp b/llvm/lib/Analysis/InlineAdvisor.cpp index 74a536d..e18f681 100644 --- a/llvm/lib/Analysis/InlineAdvisor.cpp +++ b/llvm/lib/Analysis/InlineAdvisor.cpp @@ -84,9 +84,8 @@ private: } // namespace -llvm::Optional -getDefaultInlineAdvice(CallBase &CB, FunctionAnalysisManager &FAM, - const InlineParams &Params) { +llvm::Optional static getDefaultInlineAdvice( + CallBase &CB, FunctionAnalysisManager &FAM, const InlineParams &Params) { Function &Caller = *CB.getCaller(); ProfileSummaryInfo *PSI = FAM.getResult(Caller) diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp index 48bca45..8b07869 100644 --- a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp @@ -23,6 +23,7 @@ using namespace llvm; using namespace llvm::jitlink; using namespace llvm::jitlink::ELF_x86_64_Edges; +namespace { class ELF_x86_64_GOTAndStubsBuilder : public BasicGOTAndStubsBuilder { public: @@ -110,6 +111,7 @@ private: Section *GOTSection = nullptr; Section *StubsSection = nullptr; }; +} // namespace const uint8_t ELF_x86_64_GOTAndStubsBuilder::NullGOTEntryContent[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp index 3cb4df1..aaf2840 100644 --- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -1010,6 +1010,7 @@ bool LoopIdiomRecognize::processLoopStridedStore( return true; } +namespace { class ExpandedValuesCleaner { SCEVExpander &Expander; TargetLibraryInfo *TLI; @@ -1032,6 +1033,7 @@ public: } } }; +} // namespace /// If the stored value is a strided load in the same loop with the same stride /// this may be transformable into a memcpy. This kicks in for stuff like -- 2.7.4