[PATCH] D25850: [WIP] Accept nullability annotations (_Nullable) on array parameters

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 20 20:21:48 PDT 2016


rsmith added a comment.

This generally makes sense to me. `_Nonnull` in this position seems very similar to `static` (which typically also implies non-nullness).



================
Comment at: lib/CodeGen/CGDebugInfo.cpp:2493-2499
   case Type::Adjusted:
-  case Type::Decayed:
+  case Type::Decayed: {
     // Decayed and adjusted types use the adjusted type in LLVM and DWARF.
-    return CreateType(
-        cast<PointerType>(cast<AdjustedType>(Ty)->getAdjustedType()), Unit);
+    QualType Adjusted = cast<AdjustedType>(Ty)->getAdjustedType();
+    (void)AttributedType::stripOuterNullability(Adjusted);
+    return CreateType(cast<PointerType>(Adjusted), Unit);
+  }
----------------
I think this should be handled by `UnwrapTypeForDebugInfo` instead of here; this is after all just a type sugar node.


================
Comment at: lib/Sema/SemaType.cpp:6659
               attr.isContextSensitiveKeywordAttribute(),
+              state.getDeclarator().isPrototypeContext(),
               /*implicit=*/false)) {
----------------
I'm not sure this is enough; you should make sure you also reject

  void f(int [5][_Nonnull 1]) {}

and the like.


Repository:
  rL LLVM

https://reviews.llvm.org/D25850





More information about the cfe-commits mailing list