]> granicus.if.org Git - clang/commitdiff
[TrailingObjects] Fix bug in "Convert classes in ExprObjC.h"
authorJames Y Knight <jyknight@google.com>
Thu, 31 Dec 2015 06:01:19 +0000 (06:01 +0000)
committerJames Y Knight <jyknight@google.com>
Thu, 31 Dec 2015 06:01:19 +0000 (06:01 +0000)
(Detected by asan)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256665 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprObjC.cpp

index 0b6bfcd6006bdc709ee7ad69522f96dcc1047dc8..0936a81a597a09ae0e419a42ee12d2330f24ea8f 100644 (file)
@@ -59,7 +59,8 @@ ObjCDictionaryLiteral::ObjCDictionaryLiteral(ArrayRef<ObjCDictionaryElement> VK,
       NumElements(VK.size()), HasPackExpansions(HasPackExpansions), Range(SR),
       DictWithObjectsMethod(method) {
   KeyValuePair *KeyValues = getTrailingObjects<KeyValuePair>();
-  ExpansionData *Expansions = getTrailingObjects<ExpansionData>();
+  ExpansionData *Expansions =
+      HasPackExpansions ? getTrailingObjects<ExpansionData>() : nullptr;
   for (unsigned I = 0; I < NumElements; I++) {
     if (VK[I].Key->isTypeDependent() || VK[I].Key->isValueDependent() ||
         VK[I].Value->isTypeDependent() || VK[I].Value->isValueDependent())