r286533 - Speculative fix for va_list/nullability test on Hexagon and PPC.

Jordan Rose via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 10 16:55:14 PST 2016


Author: jrose
Date: Thu Nov 10 18:55:14 2016
New Revision: 286533

URL: http://llvm.org/viewvc/llvm-project?rev=286533&view=rev
Log:
Speculative fix for va_list/nullability test on Hexagon and PPC.

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.

Modified:
    cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=286533&r1=286532&r2=286533&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Thu Nov 10 18:55:14 2016
@@ -3921,6 +3921,10 @@ static TypeSourceInfo *GetFullTypeForDec
     }
 
     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;




More information about the cfe-commits mailing list