Make helper functions static.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 9 Mar 2015 16:23:46 +0000 (16:23 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 9 Mar 2015 16:23:46 +0000 (16:23 +0000)
Found by -Wmissing-prototypes. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231664 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
lib/Transforms/Scalar/LoopInterchange.cpp
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
lib/Transforms/Vectorize/LoopVectorize.cpp
tools/llvm-config/llvm-config.cpp
tools/llvm-cov/gcov.cpp
tools/llvm-cov/llvm-cov.cpp
tools/llvm-lto/llvm-lto.cpp
tools/llvm-objdump/MachODump.cpp
tools/llvm-profdata/llvm-profdata.cpp
tools/llvm-rtdyld/llvm-rtdyld.cpp
tools/llvm-vtabledump/llvm-vtabledump.cpp
tools/opt/opt.cpp
tools/yaml2obj/yaml2coff.cpp
tools/yaml2obj/yaml2obj.cpp

index c8c01407caf49a5763be988236d5c6662bd58692..591d56a40872841aef8f6384f8163c7913d07cd2 100644 (file)
@@ -851,8 +851,9 @@ int LoopInterchangeProfitability::getInstrOrderCost() {
   return GoodOrder - BadOrder;
 }
 
-bool isProfitabileForVectorization(unsigned InnerLoopId, unsigned OuterLoopId,
-                                   CharMatrix &DepMatrix) {
+static bool isProfitabileForVectorization(unsigned InnerLoopId,
+                                          unsigned OuterLoopId,
+                                          CharMatrix &DepMatrix) {
   // TODO: Improve this heuristic to catch more cases.
   // If the inner loop is loop independent or doesn't carry any dependency it is
   // profitable to move this to outer position.
index ed8029b8a37c00362bd78dd7e27d4eb0263b4d91..f5d21fffda2fa740423c8ccb2e0a4378df72586d 100644 (file)
@@ -1165,11 +1165,11 @@ static AttributeSet legalizeCallAttributes(AttributeSet AS) {
 ///   statepointToken - statepoint instruction to which relocates should be
 ///   bound.
 ///   Builder - Llvm IR builder to be used to construct new calls.
-void CreateGCRelocates(ArrayRef<llvm::Value *> liveVariables,
-                       const int liveStart,
-                       ArrayRef<llvm::Value *> basePtrs,
-                       Instruction *statepointToken, IRBuilder<> Builder) {
-
+static void CreateGCRelocates(ArrayRef<llvm::Value *> liveVariables,
+                              const int liveStart,
+                              ArrayRef<llvm::Value *> basePtrs,
+                              Instruction *statepointToken,
+                              IRBuilder<> Builder) {
   SmallVector<Instruction *, 64> NewDefs;
   NewDefs.reserve(liveVariables.size());
 
index 781e224eef6dd948131b45ce2869f8adbfff4c22..d22b469046f0f44667ca09f6c72ae34a658d3a18 100644 (file)
@@ -2533,10 +2533,9 @@ getReductionBinOp(LoopVectorizationLegality::ReductionKind Kind) {
   }
 }
 
-Value *createMinMaxOp(IRBuilder<> &Builder,
-                      LoopVectorizationLegality::MinMaxReductionKind RK,
-                      Value *Left,
-                      Value *Right) {
+static Value *createMinMaxOp(IRBuilder<> &Builder,
+                             LoopVectorizationLegality::MinMaxReductionKind RK,
+                             Value *Left, Value *Right) {
   CmpInst::Predicate P = CmpInst::ICMP_NE;
   switch (RK) {
   default:
index 224035ac497b720d301fc42e107f5c85a803560d..879b9ab0945ba64235584f2d1e2652bff8bc7c23 100644 (file)
@@ -91,9 +91,9 @@ static void VisitComponent(StringRef Name,
 /// are required to link the given components.
 /// \param IncludeNonInstalled - Whether non-installed components should be
 /// reported.
-void ComputeLibsForComponents(const std::vector<StringRef> &Components,
-                              std::vector<StringRef> &RequiredLibs,
-                              bool IncludeNonInstalled) {
+static void ComputeLibsForComponents(const std::vector<StringRef> &Components,
+                                     std::vector<StringRef> &RequiredLibs,
+                                     bool IncludeNonInstalled) {
   std::set<AvailableComponent*> VisitedComponents;
 
   // Build a map of component names to information.
@@ -126,7 +126,7 @@ void ComputeLibsForComponents(const std::vector<StringRef> &Components,
 
 /* *** */
 
-void usage() {
+static void usage() {
   errs() << "\
 usage: llvm-config <OPTION>... [<COMPONENT>...]\n\
 \n\
index c0a48f85e5467f5dd2787469ff063d379a2650fa..4377a50b5566d91287a94a5f0f0fddff9bbddf45 100644 (file)
 #include <system_error>
 using namespace llvm;
 
-void reportCoverage(StringRef SourceFile, StringRef ObjectDir,
-                    const std::string &InputGCNO, const std::string &InputGCDA,
-                    bool DumpGCOV, const GCOVOptions &Options) {
+static void reportCoverage(StringRef SourceFile, StringRef ObjectDir,
+                           const std::string &InputGCNO,
+                           const std::string &InputGCDA, bool DumpGCOV,
+                           const GCOVOptions &Options) {
   SmallString<128> CoverageFileStem(ObjectDir);
   if (CoverageFileStem.empty()) {
     // If no directory was specified with -o, look next to the source file.
index 86ec26dbd18876a448615cee2cfe063671be9e14..3b7cffc8413fc746be8619c229f5617e09166caa 100644 (file)
@@ -32,7 +32,7 @@ int convertForTestingMain(int argc, const char *argv[]);
 int gcovMain(int argc, const char *argv[]);
 
 /// \brief Top level help.
-int helpMain(int argc, const char *argv[]) {
+static int helpMain(int argc, const char *argv[]) {
   errs() << "OVERVIEW: LLVM code coverage tool\n\n"
          << "USAGE: llvm-cov {gcov|report|show}\n";
   return 0;
index 32b31343411f1074f9a597fb9214abb6c9dcada7..74d74d5e88b8f4eeba3c062f9c68bed4ee545d91 100644 (file)
@@ -79,8 +79,8 @@ struct ModuleInfo {
 };
 }
 
-void handleDiagnostics(lto_codegen_diagnostic_severity_t Severity,
-                       const char *Msg, void *) {
+static void handleDiagnostics(lto_codegen_diagnostic_severity_t Severity,
+                              const char *Msg, void *) {
   switch (Severity) {
   case LTO_DS_NOTE:
     errs() << "note: ";
@@ -98,7 +98,7 @@ void handleDiagnostics(lto_codegen_diagnostic_severity_t Severity,
   errs() << Msg << "\n";
 }
 
-std::unique_ptr<LTOModule>
+static std::unique_ptr<LTOModule>
 getLocalLTOModule(StringRef Path, std::unique_ptr<MemoryBuffer> &Buffer,
                   const TargetOptions &Options, std::string &Error) {
   ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
@@ -118,7 +118,7 @@ getLocalLTOModule(StringRef Path, std::unique_ptr<MemoryBuffer> &Buffer,
 /// functionality that's exposed by the C API to list symbols.  Moreover, this
 /// provides testing coverage for modules that have been created in their own
 /// contexts.
-int listSymbols(StringRef Command, const TargetOptions &Options) {
+static int listSymbols(StringRef Command, const TargetOptions &Options) {
   for (auto &Filename : InputFilenames) {
     std::string Error;
     std::unique_ptr<MemoryBuffer> Buffer;
index cae43567b02b9937b5e0eff82480416c3b5af2b9..8acb097eeda3d871b56b4e4753b99822be82d5aa 100644 (file)
@@ -1608,8 +1608,8 @@ struct DisassembleInfo {
 // names and addends of the symbolic expression to add for the operand.  The
 // value of TagType is currently 1 (for the LLVMOpInfo1 struct). If symbolic
 // information is returned then this function returns 1 else it returns 0.
-int SymbolizerGetOpInfo(void *DisInfo, uint64_t Pc, uint64_t Offset,
-                        uint64_t Size, int TagType, void *TagBuf) {
+static int SymbolizerGetOpInfo(void *DisInfo, uint64_t Pc, uint64_t Offset,
+                               uint64_t Size, int TagType, void *TagBuf) {
   struct DisassembleInfo *info = (struct DisassembleInfo *)DisInfo;
   struct LLVMOpInfo1 *op_info = (struct LLVMOpInfo1 *)TagBuf;
   uint64_t value = op_info->Value;
@@ -1993,8 +1993,8 @@ int SymbolizerGetOpInfo(void *DisInfo, uint64_t Pc, uint64_t Offset,
 // GuessCstringPointer is passed the address of what might be a pointer to a
 // literal string in a cstring section.  If that address is in a cstring section
 // it returns a pointer to that string.  Else it returns nullptr.
-const char *GuessCstringPointer(uint64_t ReferenceValue,
-                                struct DisassembleInfo *info) {
+static const char *GuessCstringPointer(uint64_t ReferenceValue,
+                                       struct DisassembleInfo *info) {
   uint32_t LoadCommandCount = info->O->getHeader().ncmds;
   MachOObjectFile::LoadCommandInfo Load = info->O->getFirstLoadCommandInfo();
   for (unsigned I = 0;; ++I) {
@@ -2279,8 +2279,9 @@ static uint64_t GuessPointerPointer(uint64_t ReferenceValue,
 // offset into the section, number of bytes left in the section past the offset
 // and which section is was being referenced.  If the Address is not in a
 // section nullptr is returned.
-const char *get_pointer_64(uint64_t Address, uint32_t &offset, uint32_t &left,
-                           SectionRef &S, DisassembleInfo *info) {
+static const char *get_pointer_64(uint64_t Address, uint32_t &offset,
+                                  uint32_t &left, SectionRef &S,
+                                  DisassembleInfo *info) {
   offset = 0;
   left = 0;
   S = SectionRef();
@@ -2302,8 +2303,8 @@ const char *get_pointer_64(uint64_t Address, uint32_t &offset, uint32_t &left,
 // get_symbol_64() returns the name of a symbol (or nullptr) and the address of
 // the symbol indirectly through n_value. Based on the relocation information
 // for the specified section offset in the specified section reference.
-const char *get_symbol_64(uint32_t sect_offset, SectionRef S,
-                          DisassembleInfo *info, uint64_t &n_value) {
+static const char *get_symbol_64(uint32_t sect_offset, SectionRef S,
+                                 DisassembleInfo *info, uint64_t &n_value) {
   n_value = 0;
   if (info->verbose == false)
     return nullptr;
@@ -2437,9 +2438,9 @@ static const char *get_dyld_bind_info_symbolname(uint64_t ReferenceValue,
 // address of the pointer, so when the pointer is zero as it can be in an .o
 // file, that is used to look for an external relocation entry with a symbol
 // name.
-const char *get_objc2_64bit_class_name(uint64_t pointer_value,
-                                       uint64_t ReferenceValue,
-                                       struct DisassembleInfo *info) {
+static const char *get_objc2_64bit_class_name(uint64_t pointer_value,
+                                              uint64_t ReferenceValue,
+                                              struct DisassembleInfo *info) {
   const char *r;
   uint32_t offset, left;
   SectionRef S;
@@ -2488,8 +2489,8 @@ const char *get_objc2_64bit_class_name(uint64_t pointer_value,
 
 // get_objc2_64bit_cfstring_name is used for disassembly and is passed a
 // pointer to a cfstring and returns its name or nullptr.
-const char *get_objc2_64bit_cfstring_name(uint64_t ReferenceValue,
-                                          struct DisassembleInfo *info) {
+static const char *get_objc2_64bit_cfstring_name(uint64_t ReferenceValue,
+                                                 struct DisassembleInfo *info) {
   const char *r, *name;
   uint32_t offset, left;
   SectionRef S;
@@ -2522,8 +2523,8 @@ const char *get_objc2_64bit_cfstring_name(uint64_t ReferenceValue,
 // who's symbol's n_value is the real pointer to the selector name.  If that is
 // the case the real pointer to the selector name is returned else 0 is
 // returned
-uint64_t get_objc2_64bit_selref(uint64_t ReferenceValue,
-                                struct DisassembleInfo *info) {
+static uint64_t get_objc2_64bit_selref(uint64_t ReferenceValue,
+                                       struct DisassembleInfo *info) {
   uint32_t offset, left;
   SectionRef S;
 
@@ -2555,9 +2556,10 @@ uint64_t get_objc2_64bit_selref(uint64_t ReferenceValue,
 //
 // If there is no item in the Mach-O file for the address passed in as
 // ReferenceValue nullptr is returned and ReferenceType is unchanged.
-const char *GuessLiteralPointer(uint64_t ReferenceValue, uint64_t ReferencePC,
-                                uint64_t *ReferenceType,
-                                struct DisassembleInfo *info) {
+static const char *GuessLiteralPointer(uint64_t ReferenceValue,
+                                       uint64_t ReferencePC,
+                                       uint64_t *ReferenceType,
+                                       struct DisassembleInfo *info) {
   // First see if there is an external relocation entry at the ReferencePC.
   uint64_t sect_addr = info->S.getAddress();
   uint64_t sect_offset = ReferencePC - sect_addr;
@@ -2691,10 +2693,11 @@ const char *GuessLiteralPointer(uint64_t ReferenceValue, uint64_t ReferencePC,
 // SymbolValue is checked to be an address of literal pointer, symbol pointer,
 // or an Objective-C meta data reference.  If so the output ReferenceType is
 // set to correspond to that as well as setting the ReferenceName.
-const char *SymbolizerSymbolLookUp(void *DisInfo, uint64_t ReferenceValue,
-                                   uint64_t *ReferenceType,
-                                   uint64_t ReferencePC,
-                                   const char **ReferenceName) {
+static const char *SymbolizerSymbolLookUp(void *DisInfo,
+                                          uint64_t ReferenceValue,
+                                          uint64_t *ReferenceType,
+                                          uint64_t ReferencePC,
+                                          const char **ReferenceName) {
   struct DisassembleInfo *info = (struct DisassembleInfo *)DisInfo;
   // If no verbose symbolic information is wanted then just return nullptr.
   if (info->verbose == false) {
index 0137e35c52fd8c26a1f7e7c1ae3ec0dd79b582a6..2e8c640bf0cd5b8d102906720e50fb928adf7f43 100644 (file)
@@ -38,8 +38,8 @@ static void exitWithError(const Twine &Message, StringRef Whence = "") {
 
 enum ProfileKinds { instr, sample };
 
-void mergeInstrProfile(const cl::list<std::string> &Inputs,
-                       StringRef OutputFilename) {
+static void mergeInstrProfile(const cl::list<std::string> &Inputs,
+                              StringRef OutputFilename) {
   if (OutputFilename.compare("-") == 0)
     exitWithError("Cannot write indexed profdata format to stdout.");
 
@@ -65,9 +65,9 @@ void mergeInstrProfile(const cl::list<std::string> &Inputs,
   Writer.write(Output);
 }
 
-void mergeSampleProfile(const cl::list<std::string> &Inputs,
-                        StringRef OutputFilename,
-                        sampleprof::SampleProfileFormat OutputFormat) {
+static void mergeSampleProfile(const cl::list<std::string> &Inputs,
+                               StringRef OutputFilename,
+                               sampleprof::SampleProfileFormat OutputFormat) {
   using namespace sampleprof;
   auto WriterOrErr = SampleProfileWriter::create(OutputFilename, OutputFormat);
   if (std::error_code EC = WriterOrErr.getError())
@@ -97,7 +97,7 @@ void mergeSampleProfile(const cl::list<std::string> &Inputs,
   Writer->write(ProfileMap);
 }
 
-int merge_main(int argc, const char *argv[]) {
+static int merge_main(int argc, const char *argv[]) {
   cl::list<std::string> Inputs(cl::Positional, cl::Required, cl::OneOrMore,
                                cl::desc("<filenames...>"));
 
@@ -130,9 +130,9 @@ int merge_main(int argc, const char *argv[]) {
   return 0;
 }
 
-int showInstrProfile(std::string Filename, bool ShowCounts,
-                     bool ShowAllFunctions, std::string ShowFunction,
-                     raw_fd_ostream &OS) {
+static int showInstrProfile(std::string Filename, bool ShowCounts,
+                            bool ShowAllFunctions, std::string ShowFunction,
+                            raw_fd_ostream &OS) {
   auto ReaderOrErr = InstrProfReader::create(Filename);
   if (std::error_code EC = ReaderOrErr.getError())
     exitWithError(EC.message(), Filename);
@@ -183,9 +183,9 @@ int showInstrProfile(std::string Filename, bool ShowCounts,
   return 0;
 }
 
-int showSampleProfile(std::string Filename, bool ShowCounts,
-                      bool ShowAllFunctions, std::string ShowFunction,
-                      raw_fd_ostream &OS) {
+static int showSampleProfile(std::string Filename, bool ShowCounts,
+                             bool ShowAllFunctions, std::string ShowFunction,
+                             raw_fd_ostream &OS) {
   using namespace sampleprof;
   auto ReaderOrErr = SampleProfileReader::create(Filename, getGlobalContext());
   if (std::error_code EC = ReaderOrErr.getError())
@@ -201,7 +201,7 @@ int showSampleProfile(std::string Filename, bool ShowCounts,
   return 0;
 }
 
-int show_main(int argc, const char *argv[]) {
+static int show_main(int argc, const char *argv[]) {
   cl::opt<std::string> Filename(cl::Positional, cl::Required,
                                 cl::desc("<profdata-file>"));
 
index 58bf206e5fdc67eb96852d58841fb9cce2c6f665..508318c12a94ece0aa372103d6f472dd287682ae 100644 (file)
@@ -339,7 +339,7 @@ static int checkAllExpressions(RuntimeDyldChecker &Checker) {
   return 0;
 }
 
-std::map<void*, uint64_t>
+static std::map<void *, uint64_t>
 applySpecificSectionMappings(RuntimeDyldChecker &Checker) {
 
   std::map<void*, uint64_t> SpecificMappings;
@@ -397,9 +397,9 @@ applySpecificSectionMappings(RuntimeDyldChecker &Checker) {
 //                            Defaults to zero. Set to something big
 //                            (e.g. 1 << 32) to stress-test stubs, GOTs, etc.
 //
-void remapSections(const llvm::Triple &TargetTriple,
-                   const TrivialMemoryManager &MemMgr,
-                   RuntimeDyldChecker &Checker) {
+static void remapSections(const llvm::Triple &TargetTriple,
+                          const TrivialMemoryManager &MemMgr,
+                          RuntimeDyldChecker &Checker) {
 
   // Set up a work list (section addr/size pairs).
   typedef std::list<std::pair<void*, uint64_t>> WorklistT;
index c5bf9d669a93b09495249d969b38d0d3f2f82e83..de3f5a9437870890d6b1f61c9697748bb8340b15 100644 (file)
@@ -42,7 +42,7 @@ static int ReturnValue = EXIT_SUCCESS;
 
 namespace llvm {
 
-bool error(std::error_code EC) {
+static bool error(std::error_code EC) {
   if (!EC)
     return false;
 
index 58376ee7ee9c35f5dc21b748df22c4e7b9d1ecab..ce057da6ceae5880be8230527923b37874224432 100644 (file)
@@ -247,7 +247,7 @@ static void AddStandardLinkPasses(legacy::PassManagerBase &PM) {
 // CodeGen-related helper functions.
 //
 
-CodeGenOpt::Level GetCodeGenOptLevel() {
+static CodeGenOpt::Level GetCodeGenOptLevel() {
   if (OptLevelO1)
     return CodeGenOpt::Less;
   if (OptLevelO2)
index 8322b2ff0a0deb9afe74e0d60925af6e13e0bb27..6939bc4a3455c52226c23601ec83caec3a97baf0 100644 (file)
@@ -282,7 +282,7 @@ raw_ostream &operator<<(raw_ostream &OS, const num_zeros_impl &NZI) {
   return OS;
 }
 
-num_zeros_impl num_zeros(size_t N) {
+static num_zeros_impl num_zeros(size_t N) {
   num_zeros_impl NZI(N);
   return NZI;
 }
index 375cd89849c302a52e0d577334a4c3f5a22586d2..af4d8689067240d3a65ce3fceb41ad03ddf0fe73 100644 (file)
@@ -62,7 +62,8 @@ static cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"),
 
 typedef int (*ConvertFuncPtr)(yaml::Input & YIn, raw_ostream &Out);
 
-int convertYAML(yaml::Input & YIn, raw_ostream &Out, ConvertFuncPtr Convert) {
+static int convertYAML(yaml::Input &YIn, raw_ostream &Out,
+                       ConvertFuncPtr Convert) {
   unsigned CurDocNum = 0;
   do {
     if (++CurDocNum == DocNum)