Speculative fix for va_list/nullability test on Hexagon and PPC.
authorJordan Rose <jordan_rose@apple.com>
Fri, 11 Nov 2016 00:55:14 +0000 (00:55 +0000)
committerJordan Rose <jordan_rose@apple.com>
Fri, 11 Nov 2016 00:55:14 +0000 (00:55 +0000)
PowerPC's va_list, at least, is a typedef for an array, which means it
decays to a pointer in parameter position. Since the decayed type is
built from the array element type, the typedef sugar is lost.

More rdar://problem/25846421.

llvm-svn: 286533

clang/lib/Sema/SemaType.cpp

index e987379..d43d965 100644 (file)
@@ -3921,6 +3921,10 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
     }
 
     auto isVaList = [&S](QualType T) -> bool {
+      // Handle array va_list parameters that decayed to pointers.
+      if (auto *decayedTy = T->getAs<DecayedType>())
+        T = decayedTy->getOriginalType();
+
       auto *typedefTy = T->getAs<TypedefType>();
       if (!typedefTy)
         return false;