Fix a bug in my previous patch, CGF is not valid for constants outside a function
llvm-svn: 54108
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index 2aaf297..9efe801 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/lib/CodeGen/CGExprConstant.cpp
@@ -627,8 +627,8 @@
llvm::Constant *EmitConversion(llvm::Constant *Src, QualType SrcType,
QualType DstType) {
- SrcType = CGF->getContext().getCanonicalType(SrcType);
- DstType = CGF->getContext().getCanonicalType(DstType);
+ SrcType = CGM.getContext().getCanonicalType(SrcType);
+ DstType = CGM.getContext().getCanonicalType(DstType);
if (SrcType == DstType) return Src;
// Handle conversions to bool first, they are special: comparisons against 0.