mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-22 10:33:23 +00:00
Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133351 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4e39f8facb
commit
1a81d48bde
@ -727,37 +727,37 @@ void DIVariable::dump() const {
|
|||||||
|
|
||||||
/// fixupObjcLikeName - Replace contains special characters used
|
/// fixupObjcLikeName - Replace contains special characters used
|
||||||
/// in a typical Objective-C names with '.' in a given string.
|
/// in a typical Objective-C names with '.' in a given string.
|
||||||
static void fixupObjcLikeName(std::string &Str) {
|
static void fixupObjcLikeName(StringRef Str, SmallVectorImpl<char> &Out) {
|
||||||
|
bool isObjCLike = false;
|
||||||
for (size_t i = 0, e = Str.size(); i < e; ++i) {
|
for (size_t i = 0, e = Str.size(); i < e; ++i) {
|
||||||
char C = Str[i];
|
char C = Str[i];
|
||||||
if (C == '[' || C == ']' || C == ' ' || C == ':' || C == '+' ||
|
if (C == '[')
|
||||||
C == '(' || C == ')')
|
isObjCLike = true;
|
||||||
Str[i] = '.';
|
|
||||||
|
if (isObjCLike && (C == '[' || C == ']' || C == ' ' || C == ':' ||
|
||||||
|
C == '+' || C == '(' || C == ')'))
|
||||||
|
Out.push_back('.');
|
||||||
|
else
|
||||||
|
Out.push_back(C);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getFnSpecificMDNode - Return a NameMDNode, if available, that is
|
/// getFnSpecificMDNode - Return a NameMDNode, if available, that is
|
||||||
/// suitable to hold function specific information.
|
/// suitable to hold function specific information.
|
||||||
NamedMDNode *llvm::getFnSpecificMDNode(const Module &M, StringRef FuncName) {
|
NamedMDNode *llvm::getFnSpecificMDNode(const Module &M, StringRef FuncName) {
|
||||||
if (FuncName.find('[') == StringRef::npos)
|
SmallString<32> Name = StringRef("llvm.dbg.lv.");
|
||||||
return M.getNamedMetadata(Twine("llvm.dbg.lv.", FuncName));
|
fixupObjcLikeName(FuncName, Name);
|
||||||
std::string Name = FuncName;
|
|
||||||
fixupObjcLikeName(Name);
|
return M.getNamedMetadata(Name.str());
|
||||||
return M.getNamedMetadata(Twine("llvm.dbg.lv.", Name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getOrInsertFnSpecificMDNode - Return a NameMDNode that is suitable
|
/// getOrInsertFnSpecificMDNode - Return a NameMDNode that is suitable
|
||||||
/// to hold function specific information.
|
/// to hold function specific information.
|
||||||
NamedMDNode *llvm::getOrInsertFnSpecificMDNode(Module &M, StringRef FuncName) {
|
NamedMDNode *llvm::getOrInsertFnSpecificMDNode(Module &M, StringRef FuncName) {
|
||||||
SmallString<32> Out;
|
SmallString<32> Name = StringRef("llvm.dbg.lv.");
|
||||||
if (FuncName.find('[') == StringRef::npos)
|
fixupObjcLikeName(FuncName, Name);
|
||||||
return M.getOrInsertNamedMetadata(Twine("llvm.dbg.lv.", FuncName)
|
|
||||||
.toStringRef(Out));
|
return M.getOrInsertNamedMetadata(Name.str());
|
||||||
|
|
||||||
std::string Name = FuncName;
|
|
||||||
fixupObjcLikeName(Name);
|
|
||||||
return M.getOrInsertNamedMetadata(Twine("llvm.dbg.lv.", Name)
|
|
||||||
.toStringRef(Out));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user