Save getObjCGCAttrKind and use it in two places
for efficiancy (still part of //rdar://8761767).
Per John's comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123401 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp
index 84e0344..8b2d6f5 100644
--- a/lib/CodeGen/CGDeclCXX.cpp
+++ b/lib/CodeGen/CGDeclCXX.cpp
@@ -36,10 +36,11 @@
if (!CGF.hasAggregateLLVMType(T)) {
llvm::Value *V = CGF.EmitScalarExpr(Init);
CodeGenModule &CGM = CGF.CGM;
- if (CGF.getContext().getObjCGCAttrKind(T) == Qualifiers::Strong)
+ Qualifiers::GC GCAttr = CGM.getContext().getObjCGCAttrKind(T);
+ if (GCAttr == Qualifiers::Strong)
CGM.getObjCRuntime().EmitObjCGlobalAssign(CGF, V, DeclPtr,
D.isThreadSpecified());
- else if (CGF.getContext().getObjCGCAttrKind(T) == Qualifiers::Weak)
+ else if (GCAttr == Qualifiers::Weak)
CGM.getObjCRuntime().EmitObjCWeakAssign(CGF, V, DeclPtr);
else
CGF.EmitStoreOfScalar(V, DeclPtr, isVolatile, Alignment, T);