Skip to content

Commit

Permalink
Make helper functions static. NFC.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265653 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
d0k committed Apr 7, 2016
1 parent 393a60e commit 47d60da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
24 changes: 10 additions & 14 deletions lib/Target/AMDGPU/Utils/AMDKernelCodeTUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,19 @@ static StringRef get_amd_kernel_code_t_FieldName(int index) {

// Field printing

raw_ostream& printName(raw_ostream& OS, StringRef Name) {
static raw_ostream &printName(raw_ostream &OS, StringRef Name) {
return OS << Name << " = ";
}

template <typename T, T amd_kernel_code_t::*ptr>
void printField(StringRef Name,
const amd_kernel_code_t& C,
raw_ostream& OS) {
static void printField(StringRef Name, const amd_kernel_code_t &C,
raw_ostream &OS) {
printName(OS, Name) << (int)(C.*ptr);
}

template <typename T, T amd_kernel_code_t::*ptr, int shift, int width=1>
void printBitField(StringRef Name,
const amd_kernel_code_t& c,
raw_ostream& OS) {
template <typename T, T amd_kernel_code_t::*ptr, int shift, int width = 1>
static void printBitField(StringRef Name, const amd_kernel_code_t &c,
raw_ostream &OS) {
const auto Mask = (static_cast<T>(1) << width) - 1;
printName(OS, Name) << (int)((c.*ptr >> shift) & Mask);
}
Expand Down Expand Up @@ -117,19 +115,17 @@ static bool expectEqualInt(MCAsmLexer& Lexer, raw_ostream& Err) {
}

template <typename T, T amd_kernel_code_t::*ptr>
bool parseField(amd_kernel_code_t& C,
MCAsmLexer& Lexer,
raw_ostream& Err) {
static bool parseField(amd_kernel_code_t &C, MCAsmLexer &Lexer,
raw_ostream &Err) {
if (!expectEqualInt(Lexer, Err))
return false;
C.*ptr = (T)Lexer.getTok().getIntVal();
return true;
}

template <typename T, T amd_kernel_code_t::*ptr, int shift, int width = 1>
bool parseBitField(amd_kernel_code_t& C,
MCAsmLexer& Lexer,
raw_ostream& Err) {
static bool parseBitField(amd_kernel_code_t &C, MCAsmLexer &Lexer,
raw_ostream &Err) {
if (!expectEqualInt(Lexer, Err))
return false;
const uint64_t Mask = ((UINT64_C(1) << width) - 1) << shift;
Expand Down
2 changes: 1 addition & 1 deletion lib/Transforms/Instrumentation/ThreadSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static bool isVtableAccess(Instruction *I) {

// Do not instrument known races/"benign races" that come from compiler
// instrumentatin. The user has no way of suppressing them.
bool shouldInstrumentReadWriteFromAddress(Value *Addr) {
static bool shouldInstrumentReadWriteFromAddress(Value *Addr) {
// Peel off GEPs and BitCasts.
Addr = Addr->stripInBoundsOffsets();

Expand Down

0 comments on commit 47d60da

Please sign in to comment.