Make helpers static. NFC.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 17 Jul 2020 11:49:11 +0000 (13:49 +0200)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 17 Jul 2020 11:49:11 +0000 (13:49 +0200)
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

index 989ee0f..33fb7a9 100644 (file)
@@ -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;
index be3f0a0..09ae453 100644 (file)
@@ -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) ||
index 629fdff..ee7bf98 100644 (file)
@@ -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)) {
index 4790b01..b8c488f 100644 (file)
@@ -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.
index 2a3b004..4dfb387 100644 (file)
@@ -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);
index 74a536d..e18f681 100644 (file)
@@ -84,9 +84,8 @@ private:
 
 } // 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)
index 48bca45..8b07869 100644 (file)
@@ -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 @@ 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};
index 3cb4df1..aaf2840 100644 (file)
@@ -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