[llvm-commits] [llvm] r76480 - in /llvm/trunk/lib: CodeGen/MachOWriter.cpp Target/DarwinTargetAsmInfo.cpp
Bill Wendling
isanbard at gmail.com
Mon Jul 20 14:38:26 PDT 2009
Author: void
Date: Mon Jul 20 16:38:26 2009
New Revision: 76480
URL: http://llvm.org/viewvc/llvm-project?rev=76480&view=rev
Log:
Simplify the code in DarwinTargetAsmInfo::emitUsedDirectiveFor so that humans can understand it.
Modified:
llvm/trunk/lib/CodeGen/MachOWriter.cpp
llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
Modified: llvm/trunk/lib/CodeGen/MachOWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachOWriter.cpp?rev=76480&r1=76479&r2=76480&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachOWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachOWriter.cpp Mon Jul 20 16:38:26 2009
@@ -774,4 +774,3 @@
}
} // end namespace llvm
-
Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=76480&r1=76479&r2=76480&view=diff
==============================================================================
--- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Mon Jul 20 16:38:26 2009
@@ -107,23 +107,23 @@
/// 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;
}
More information about the llvm-commits
mailing list