[PATCH] D19244: Extend checking of va_start builtin

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 18 16:27:08 PDT 2016


rsmith added inline comments.

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7417-7421
@@ -7416,4 +7416,7 @@
   InGroup<Varargs>;
-def warn_va_start_of_reference_type_is_undefined : Warning<
-  "'va_start' has undefined behavior with reference types">, InGroup<Varargs>;
+def warn_va_start_type_is_undefined : Warning<
+  "'va_start' has undefined behavior with "
+  "%select{types that undergo default argument promotion|reference types|"
+  "an object declared with the register storage class}0">,
+  InGroup<Varargs>;
 def err_first_argument_to_va_arg_not_of_type_va_list : Error<
----------------
I'm not sure that

    'va_start' has undefined behavior with an object declared with the register storage class

is clear enough about what object it's talking about. Can you explicitly state that the problem is with the type of the parameter name passed to `va_start` here, somehow?

================
Comment at: lib/Sema/SemaChecking.cpp:2722
@@ -2720,2 +2721,3 @@
       ParamLoc = PV->getLocation();
+      IsRegister = PV->getStorageClass() == SC_Register;
     }
----------------
Where is this restriction specified? Does this only apply to C?


http://reviews.llvm.org/D19244





More information about the cfe-commits mailing list