From 5f6eaac6115a44f4ef3d819123f8694d3d5825ea Mon Sep 17 00:00:00 2001 From: Manuel Jacob Date: Sat, 16 Jan 2016 20:30:46 +0000 Subject: GlobalValue: use getValueType() instead of getType()->getPointerElementType(). Reviewers: mjacob Subscribers: jholewinski, arsenm, dsanders, dblaikie Patch by Eduard Burtescu. Differential Revision: http://reviews.llvm.org/D16260 llvm-svn: 257999 --- llvm/lib/Target/CppBackend/CPPBackend.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Target/CppBackend/CPPBackend.cpp') diff --git a/llvm/lib/Target/CppBackend/CPPBackend.cpp b/llvm/lib/Target/CppBackend/CPPBackend.cpp index 5ea6551ebc9..dd5590307ee 100644 --- a/llvm/lib/Target/CppBackend/CPPBackend.cpp +++ b/llvm/lib/Target/CppBackend/CPPBackend.cpp @@ -437,7 +437,7 @@ std::string CppWriter::getCppName(const Value* val) { if (const GlobalVariable* GV = dyn_cast(val)) { name = std::string("gvar_") + - getTypePrefix(GV->getType()->getElementType()); + getTypePrefix(GV->getValueType()); } else if (isa(val)) { name = std::string("func_"); } else if (const Constant* C = dyn_cast(val)) { @@ -997,13 +997,13 @@ void CppWriter::printVariableHead(const GlobalVariable *GV) { if (is_inline) { Out << " = mod->getGlobalVariable(mod->getContext(), "; printEscapedString(GV->getName()); - Out << ", " << getCppName(GV->getType()->getElementType()) << ",true)"; + Out << ", " << getCppName(GV->getValueType()) << ",true)"; nl(Out) << "if (!" << getCppName(GV) << ") {"; in(); nl(Out) << getCppName(GV); } Out << " = new GlobalVariable(/*Module=*/*mod, "; nl(Out) << "/*Type=*/"; - printCppName(GV->getType()->getElementType()); + printCppName(GV->getValueType()); Out << ","; nl(Out) << "/*isConstant=*/" << (GV->isConstant()?"true":"false"); Out << ","; -- cgit v1.2.3