[lld] 9a0689e - Make helpers static. NFC.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 04:50:30 PDT 2020


Author: Benjamin Kramer
Date: 2020-07-17T13:49:11+02:00
New Revision: 9a0689e072da1a60c8b858e829d57d5b1136bd30

URL: https://github.com/llvm/llvm-project/commit/9a0689e072da1a60c8b858e829d57d5b1136bd30
DIFF: https://github.com/llvm/llvm-project/commit/9a0689e072da1a60c8b858e829d57d5b1136bd30.diff

LOG: Make helpers static. NFC.

Added: 
    

Modified: 
    clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
    clang/lib/Driver/ToolChains/Arch/RISCV.cpp
    clang/lib/Sema/SemaType.cpp
    lld/COFF/DebugTypes.cpp
    lld/MachO/Driver.cpp
    llvm/lib/Analysis/InlineAdvisor.cpp
    llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
    llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp b/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
index 989ee0fa75cd..33fb7a92955b 100644
--- a/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
+++ b/clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
@@ -120,7 +120,8 @@ static constexpr std::pair<llvm::StringRef, llvm::Regex::RegexFlags>
         {"BasicRegex", llvm::Regex::RegexFlags::BasicRegex},
 };
 
-llvm::Optional<llvm::Regex::RegexFlags> getRegexFlag(llvm::StringRef Flag) {
+static llvm::Optional<llvm::Regex::RegexFlags>
+getRegexFlag(llvm::StringRef Flag) {
   for (const auto &StringFlag : RegexMap) {
     if (Flag == StringFlag.first)
       return StringFlag.second;
@@ -128,7 +129,8 @@ llvm::Optional<llvm::Regex::RegexFlags> getRegexFlag(llvm::StringRef Flag) {
   return llvm::None;
 }
 
-llvm::Optional<llvm::StringRef> getCloseRegexMatch(llvm::StringRef Flag) {
+static llvm::Optional<llvm::StringRef>
+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 be3f0a07b576..09ae4538b3ac 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<StringRef> &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<StringRef> &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 629fdff5ccf9..ee7bf98e9ca6 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 4790b0166799..b8c488f26908 100644
--- a/lld/COFF/DebugTypes.cpp
+++ b/lld/COFF/DebugTypes.cpp
@@ -377,7 +377,8 @@ static PrecompSource *findObjByName(StringRef fileNameOnly) {
   return nullptr;
 }
 
-Expected<const CVIndexMap *> findPrecompMap(ObjFile *file, PrecompRecord &pr) {
+static Expected<const CVIndexMap *> 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 2a3b0042162e..4dfb387e4e62 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<MemoryBufferRef> 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 74a536d1ce2f..e18f681278d3 100644
--- a/llvm/lib/Analysis/InlineAdvisor.cpp
+++ b/llvm/lib/Analysis/InlineAdvisor.cpp
@@ -84,9 +84,8 @@ class DefaultInlineAdvice : public InlineAdvice {
 
 } // namespace
 
-llvm::Optional<llvm::InlineCost>
-getDefaultInlineAdvice(CallBase &CB, FunctionAnalysisManager &FAM,
-                       const InlineParams &Params) {
+llvm::Optional<llvm::InlineCost> static getDefaultInlineAdvice(
+    CallBase &CB, FunctionAnalysisManager &FAM, const InlineParams &Params) {
   Function &Caller = *CB.getCaller();
   ProfileSummaryInfo *PSI =
       FAM.getResult<ModuleAnalysisManagerFunctionProxy>(Caller)

diff  --git a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
index 48bca4502920..8b078690dea2 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<ELF_x86_64_GOTAndStubsBuilder> {
 public:
@@ -110,6 +111,7 @@ class ELF_x86_64_GOTAndStubsBuilder
   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 3cb4df12e9b0..aaf2840f8ff6 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 @@ class ExpandedValuesCleaner {
     }
   }
 };
+} // 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


        


More information about the llvm-commits mailing list