[PATCH] Add warnings for undefined behaviors with pointers

Richard Smith richard at metafoo.co.uk
Tue Jun 3 16:43:48 PDT 2014


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2392-2393
@@ +2391,4 @@
+def warn_this_bool_conversion : Warning<
+  "'this' pointer cannot be null in well-defined C++ code; pointer may be "
+  "assumed always covnerted to a true value">, InGroup<UndefinedBoolConversion>;
+def warn_address_of_reference_bool_conversion : Warning<
----------------
Typo 'covnerted'.

Maybe "pointer may be assumed to always convert to 'true'"?

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2395
@@ +2394,3 @@
+def warn_address_of_reference_bool_conversion : Warning<
+  "reference cannot be bound to dereference null pointer in well-define C++ "
+  "code; pointer may be assumed always converted to a true value">,
----------------
Typo "dereference", "well-define".

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2405
@@ +2404,3 @@
+  "'this' pointer cannot be null in well-defined C++ code; comparison may be "
+  "assumed always %select{true|false}0">,
+  InGroup<TautologicalUndefinedCompare>;
----------------
Perhaps "may be assumed to always evaluate to %select{...}".

http://reviews.llvm.org/D3999






More information about the cfe-commits mailing list