[llvm] r231664 - Make helper functions static.
Benjamin Kramer
benny.kra at googlemail.com
Mon Mar 9 09:23:47 PDT 2015
Author: d0k
Date: Mon Mar 9 11:23:46 2015
New Revision: 231664
URL: http://llvm.org/viewvc/llvm-project?rev=231664&view=rev
Log:
Make helper functions static.
Found by -Wmissing-prototypes. NFC.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp
llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/trunk/tools/llvm-config/llvm-config.cpp
llvm/trunk/tools/llvm-cov/gcov.cpp
llvm/trunk/tools/llvm-cov/llvm-cov.cpp
llvm/trunk/tools/llvm-lto/llvm-lto.cpp
llvm/trunk/tools/llvm-objdump/MachODump.cpp
llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp
llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
llvm/trunk/tools/llvm-vtabledump/llvm-vtabledump.cpp
llvm/trunk/tools/opt/opt.cpp
llvm/trunk/tools/yaml2obj/yaml2coff.cpp
llvm/trunk/tools/yaml2obj/yaml2obj.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp Mon Mar 9 11:23:46 2015
@@ -851,8 +851,9 @@ int LoopInterchangeProfitability::getIns
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.
Modified: llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp Mon Mar 9 11:23:46 2015
@@ -1165,11 +1165,11 @@ static AttributeSet legalizeCallAttribut
/// 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());
Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Mon Mar 9 11:23:46 2015
@@ -2533,10 +2533,9 @@ getReductionBinOp(LoopVectorizationLegal
}
}
-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:
Modified: llvm/trunk/tools/llvm-config/llvm-config.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/llvm-config.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/llvm-config.cpp (original)
+++ llvm/trunk/tools/llvm-config/llvm-config.cpp Mon Mar 9 11:23:46 2015
@@ -91,9 +91,9 @@ static void VisitComponent(StringRef Nam
/// 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:
/* *** */
-void usage() {
+static void usage() {
errs() << "\
usage: llvm-config <OPTION>... [<COMPONENT>...]\n\
\n\
Modified: llvm/trunk/tools/llvm-cov/gcov.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/gcov.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/gcov.cpp (original)
+++ llvm/trunk/tools/llvm-cov/gcov.cpp Mon Mar 9 11:23:46 2015
@@ -23,9 +23,10 @@
#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.
Modified: llvm/trunk/tools/llvm-cov/llvm-cov.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/llvm-cov.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/llvm-cov.cpp (original)
+++ llvm/trunk/tools/llvm-cov/llvm-cov.cpp Mon Mar 9 11:23:46 2015
@@ -32,7 +32,7 @@ int convertForTestingMain(int argc, cons
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;
Modified: llvm/trunk/tools/llvm-lto/llvm-lto.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-lto/llvm-lto.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-lto/llvm-lto.cpp (original)
+++ llvm/trunk/tools/llvm-lto/llvm-lto.cpp Mon Mar 9 11:23:46 2015
@@ -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_diagn
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::u
/// 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;
Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Mon Mar 9 11:23:46 2015
@@ -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, u
// 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(uint
// 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 Addr
// 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_sy
// 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(u
// 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_nam
// 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
//
// 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
// 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) {
Modified: llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp (original)
+++ llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp Mon Mar 9 11:23:46 2015
@@ -38,8 +38,8 @@ static void exitWithError(const Twine &M
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<st
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<s
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 *arg
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 Filenam
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 Filena
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>"));
Modified: llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp (original)
+++ llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp Mon Mar 9 11:23:46 2015
@@ -339,7 +339,7 @@ static int checkAllExpressions(RuntimeDy
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(RuntimeDyld
// 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;
Modified: llvm/trunk/tools/llvm-vtabledump/llvm-vtabledump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-vtabledump/llvm-vtabledump.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-vtabledump/llvm-vtabledump.cpp (original)
+++ llvm/trunk/tools/llvm-vtabledump/llvm-vtabledump.cpp Mon Mar 9 11:23:46 2015
@@ -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;
Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Mon Mar 9 11:23:46 2015
@@ -247,7 +247,7 @@ static void AddStandardLinkPasses(legacy
// CodeGen-related helper functions.
//
-CodeGenOpt::Level GetCodeGenOptLevel() {
+static CodeGenOpt::Level GetCodeGenOptLevel() {
if (OptLevelO1)
return CodeGenOpt::Less;
if (OptLevelO2)
Modified: llvm/trunk/tools/yaml2obj/yaml2coff.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2coff.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/tools/yaml2obj/yaml2coff.cpp (original)
+++ llvm/trunk/tools/yaml2obj/yaml2coff.cpp Mon Mar 9 11:23:46 2015
@@ -282,7 +282,7 @@ raw_ostream &operator<<(raw_ostream &OS,
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;
}
Modified: llvm/trunk/tools/yaml2obj/yaml2obj.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2obj.cpp?rev=231664&r1=231663&r2=231664&view=diff
==============================================================================
--- llvm/trunk/tools/yaml2obj/yaml2obj.cpp (original)
+++ llvm/trunk/tools/yaml2obj/yaml2obj.cpp Mon Mar 9 11:23:46 2015
@@ -62,7 +62,8 @@ static cl::opt<std::string> OutputFilena
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)
More information about the llvm-commits
mailing list