[llvm-commits] [llvm-gcc-4.2] r77036 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Daniel Dunbar
daniel at zuster.org
Fri Jul 24 18:37:35 PDT 2009
Author: ddunbar
Date: Fri Jul 24 20:37:35 2009
New Revision: 77036
URL: http://llvm.org/viewvc/llvm-project?rev=77036&view=rev
Log:
Protect from LLVM API changes; this also fixes a potential use-after-free!
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=77036&r1=77035&r2=77036&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Fri Jul 24 20:37:35 2009
@@ -1396,13 +1396,13 @@
// something that would be accurate and useful to a user, it currently
// affects some optimizations that, e.g., count uses.
if (TheDebugInfo && !optimize) {
- const char *Name = GV->getName().c_str();
+ std::string Name = GV->getNameStr();
const char LPrefix[] = "\01L_OBJC_";
const char lPrefix[] = "\01l_OBJC_";
if (flag_objc_abi == -1 || flag_objc_abi == 0 ||
- (strncmp(Name, LPrefix, sizeof(LPrefix) - 1) != 0 &&
- strncmp(Name, lPrefix, sizeof(lPrefix) - 1) != 0))
+ (strncmp(Name.c_str(), LPrefix, sizeof(LPrefix) - 1) != 0 &&
+ strncmp(Name.c_str(), lPrefix, sizeof(lPrefix) - 1) != 0))
TheDebugInfo->EmitGlobalVariable(GV, decl);
}
More information about the llvm-commits
mailing list