summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGObjC.cpp16
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp12
2 files changed, 2 insertions, 26 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 067718e2b8e..c011ab4dfc9 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -117,22 +117,10 @@ llvm::Value *CodeGenFunction::EmitObjCCollectionLiteral(const Expr *E,
const ObjCArrayLiteral *ALE = dyn_cast<ObjCArrayLiteral>(E);
if (!ALE)
DLE = cast<ObjCDictionaryLiteral>(E);
-
- // Optimize empty collections by referencing constants, when available.
+
+ // Compute the type of the array we're initializing.
uint64_t NumElements =
ALE ? ALE->getNumElements() : DLE->getNumElements();
- if (NumElements == 0 && CGM.getLangOpts().ObjCRuntime.hasEmptyCollections()) {
- StringRef ConstantName = ALE ? "__NSArray0__" : "__NSDictionary0__";
- QualType IdTy(CGM.getContext().getObjCIdType());
- llvm::Constant *Constant =
- CGM.CreateRuntimeVariable(ConvertType(IdTy), ConstantName);
- LValue LV = LValue::MakeAddr(Constant, IdTy,
- Context.getTypeAlignInChars(IdTy), Context);
- return Builder.CreateBitCast(EmitLoadOfScalar(LV, E->getLocStart()),
- ConvertType(E->getType()));
- }
-
- // Compute the type of the array we're initializing.
llvm::APInt APNumElements(Context.getTypeSize(Context.getSizeType()),
NumElements);
QualType ElementType = Context.getObjCIdType().withConst();
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index d65570fcef7..485d012b6e6 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -5980,21 +5980,9 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) {
} else if (ObjCBoxedExpr *BoxedExpr = dyn_cast<ObjCBoxedExpr>(E)) {
D = BoxedExpr->getBoxingMethod();
} else if (ObjCArrayLiteral *ArrayLit = dyn_cast<ObjCArrayLiteral>(E)) {
- // Don't do reclaims if we're using the zero-element array
- // constant.
- if (ArrayLit->getNumElements() == 0 &&
- Context.getLangOpts().ObjCRuntime.hasEmptyCollections())
- return E;
-
D = ArrayLit->getArrayWithObjectsMethod();
} else if (ObjCDictionaryLiteral *DictLit
= dyn_cast<ObjCDictionaryLiteral>(E)) {
- // Don't do reclaims if we're using the zero-element dictionary
- // constant.
- if (DictLit->getNumElements() == 0 &&
- Context.getLangOpts().ObjCRuntime.hasEmptyCollections())
- return E;
-
D = DictLit->getDictWithObjectsMethod();
}
OpenPOWER on IntegriCloud