summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
authorAlex Denisov <1101.debian@gmail.com>2015-03-04 17:55:52 +0000
committerAlex Denisov <1101.debian@gmail.com>2015-03-04 17:55:52 +0000
commite1d882c726b53eebe4dbece9fdf7fb8dc6469f72 (patch)
tree60507712962fd8ed3cca070487229c64a1052884 /clang/lib/Sema/SemaExprObjC.cpp
parent4d9347993bbaaf9278df52d14e71e460a4afbd9f (diff)
downloadbcm5719-llvm-e1d882c726b53eebe4dbece9fdf7fb8dc6469f72.tar.gz
bcm5719-llvm-e1d882c726b53eebe4dbece9fdf7fb8dc6469f72.zip
New ObjC warning: circular containers.
This commit adds new warning to prevent user from creating 'circular containers'. Mutable collections from NSFoundation allows user to add collection to itself, e.g.: NSMutableArray *a = [NSMutableArray new]; [a addObject:a]; The code above leads to really weird behaviour (crashes, 'endless' recursion) and retain cycles (collection retains itself) if ARC enabled. Patch checks the following collections: - NSMutableArray, - NSMutableDictionary, - NSMutableSet, - NSMutableOrderedSet, - NSCountedSet. llvm-svn: 231265
Diffstat (limited to 'clang/lib/Sema/SemaExprObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index ebe6cbb45d5..7d7d3ecc3de 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -2799,7 +2799,9 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
}
}
}
-
+
+ CheckObjCCircularContainer(Result);
+
return MaybeBindToTemporary(Result);
}
OpenPOWER on IntegriCloud