[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)

llvm-svn: 256665

clang/lib/AST/ExprObjC.cpp

index 0b6bfcd..0936a81 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())