a temporary minimal hack to get clang building after the getStringValue changes in llvm mainline.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52753 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index 53eaf57..73a692d 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -22,6 +22,15 @@
#include "llvm/ADT/StringMap.h"
#include <map>
+// FIXME: Remove THIS!
+#include "llvm/Analysis/ValueTracking.h"
+std::string getStringValue(llvm::Constant *C) {
+ std::string R;
+ bool V = GetConstantStringInfo(C, R);
+ assert(V && "Couldn't convert string");
+ return R;
+}
+
using llvm::dyn_cast;
// The version of the runtime that this class targets. Must match the version
@@ -221,23 +230,23 @@
// Untyped selector
if (SelTypes == 0) {
// If it's already cached, return it.
- if (UntypedSelectors[CName->getStringValue()]) {
+ if (UntypedSelectors[getStringValue(CName)]) {
// FIXME: Volatility
- return Builder.CreateLoad(UntypedSelectors[CName->getStringValue()]);
+ return Builder.CreateLoad(UntypedSelectors[getStringValue(CName)]);
}
// If it isn't, cache it.
llvm::GlobalAlias *Sel = new llvm::GlobalAlias(
llvm::PointerType::getUnqual(SelectorTy),
llvm::GlobalValue::InternalLinkage, ".objc_untyped_selector_alias",
NULL, &TheModule);
- UntypedSelectors[CName->getStringValue()] = Sel;
+ UntypedSelectors[getStringValue(CName)] = Sel;
// FIXME: Volatility
return Builder.CreateLoad(Sel);
}
// Typed selectors
if (llvm::Constant *CTypes = dyn_cast<llvm::Constant>(SelTypes)) {
- TypedSelector Selector = TypedSelector(CName->getStringValue(),
- CTypes->getStringValue());
+ TypedSelector Selector = TypedSelector(getStringValue(CName),
+ getStringValue(CTypes));
// If it's already cached, return it.
if (TypedSelectors[Selector]) {
// FIXME: Volatility
@@ -439,7 +448,8 @@
llvm::ConstantExpr::getGetElementPtr(MethodTypes[i], Zeros, 2));
llvm::Constant *Method =
TheModule.getFunction(SymbolNameForMethod(ClassName, CategoryName,
- MethodNames[i]->getStringValue(), isClassMethodList));
+ getStringValue(MethodNames[i]),
+ isClassMethodList));
Method = llvm::ConstantExpr::getBitCast(Method,
llvm::PointerType::getUnqual(IMPTy));
Elements.push_back(Method);
@@ -567,7 +577,7 @@
Elements.push_back(NullP);
// Create an instance of the structure
return MakeGlobal(ClassTy, Elements,
- SymbolNameForClass(Name->getStringValue()));
+ SymbolNameForClass(getStringValue(Name)));
}
llvm::Constant *CGObjCGNU::GenerateProtocolMethodList(