mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Simplify the code in DarwinTargetAsmInfo::emitUsedDirectiveFor so that humans can understand it.
llvm-svn: 76480
This commit is contained in:
parent
16a69eeaeb
commit
ca94e95735
@ -774,4 +774,3 @@ MachOSym::MachOSym(const GlobalValue *gv, std::string name, uint8_t sect,
|
||||
}
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
|
@ -107,23 +107,23 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM)
|
||||
/// emitUsedDirectiveFor - On Darwin, internally linked data beginning with
|
||||
/// the PrivateGlobalPrefix or the LessPrivateGlobalPrefix does not have the
|
||||
/// directive emitted (this occurs in ObjC metadata).
|
||||
bool
|
||||
DarwinTargetAsmInfo::emitUsedDirectiveFor(const GlobalValue* GV,
|
||||
Mangler *Mang) const {
|
||||
if (GV==0)
|
||||
return false;
|
||||
bool DarwinTargetAsmInfo::emitUsedDirectiveFor(const GlobalValue* GV,
|
||||
Mangler *Mang) const {
|
||||
if (!GV) return false;
|
||||
|
||||
/// FIXME: WHAT IS THIS?
|
||||
|
||||
if (GV->hasLocalLinkage() && !isa<Function>(GV) &&
|
||||
((strlen(getPrivateGlobalPrefix()) != 0 &&
|
||||
Mang->getMangledName(GV).substr(0,strlen(getPrivateGlobalPrefix())) ==
|
||||
getPrivateGlobalPrefix()) ||
|
||||
(strlen(getLessPrivateGlobalPrefix()) != 0 &&
|
||||
Mang->getMangledName(GV).substr(0,
|
||||
strlen(getLessPrivateGlobalPrefix())) ==
|
||||
getLessPrivateGlobalPrefix())))
|
||||
return false;
|
||||
// Check whether the mangled name has the "Private" or "LessPrivate" prefix.
|
||||
if (GV->hasLocalLinkage() && !isa<Function>(GV)) {
|
||||
const std::string &Name = Mang->getMangledName(GV);
|
||||
const char *PGPrefix = getPrivateGlobalPrefix();
|
||||
const char *LPGPrefix = getLessPrivateGlobalPrefix();
|
||||
unsigned PGPLen = strlen(PGPrefix);
|
||||
unsigned LPGPLen = strlen(LPGPrefix);
|
||||
|
||||
if ((PGPLen != 0 && Name.substr(0, PGPLen) == PGPrefix) ||
|
||||
(LPGPLen != 0 && Name.substr(0, LPGPLen) == LPGPrefix))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user