Skip to content

Commit

Permalink
Make helpers static. NFC.
Browse files Browse the repository at this point in the history
  • Loading branch information
d0k committed Jul 17, 2020
1 parent 033ef84 commit 9a0689e
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 13 deletions.
6 changes: 4 additions & 2 deletions clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
Expand Up @@ -120,15 +120,17 @@ 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;
}
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;
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/Driver/ToolChains/Arch/RISCV.cpp
Expand Up @@ -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) ||
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaType.cpp
Expand Up @@ -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)) {
Expand Down
3 changes: 2 additions & 1 deletion lld/COFF/DebugTypes.cpp
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lld/MachO/Driver.cpp
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/Analysis/InlineAdvisor.cpp
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
Expand Up @@ -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:
Expand Down Expand Up @@ -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};
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
Expand Up @@ -1010,6 +1010,7 @@ bool LoopIdiomRecognize::processLoopStridedStore(
return true;
}

namespace {
class ExpandedValuesCleaner {
SCEVExpander &Expander;
TargetLibraryInfo *TLI;
Expand All @@ -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
Expand Down

0 comments on commit 9a0689e

Please sign in to comment.