================
@@ -0,0 +1,74 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection \
+// RUN:   -verify %s
+
+void clang_analyzer_dump(const char *);
+void clang_analyzer_dump(const bool);
+void clang_analyzer_eval(bool);
+
+using Callback = void (*)(const char *);
+using CallbackRef = void (&)(const char *);
+
+static int Storage;
+
+static void pointerTarget(const char *Value) {
+  int *Ptr = nullptr;
+
+  if (Value)
+    Ptr = &Storage;
+
+  clang_analyzer_dump(Value); // expected-warning{{"pointer"}}
+  *Ptr = 0;
+}
+
+static void referenceTarget(const char *Value) {
+  int *Ptr = nullptr;
+
+  if (Value)
+    Ptr = &Storage;
+
+  clang_analyzer_dump(Value); // expected-warning{{"reference"}}
+  *Ptr = 0;
+}
+
+static Callback const ConstPointer = pointerTarget;
+static Callback const AddressPointer = &pointerTarget;
+static Callback const CastPointer = (Callback)pointerTarget;
+static Callback MutablePointer = pointerTarget;
+static CallbackRef Reference = referenceTarget;
+
+extern CallbackRef ExternalReference;
+
+void myGlobalFn();
+static const bool Truthy = &myGlobalFn;
+
+void testPointers(unsigned Value) {
+  if (Value != 1)
+    return;
----------------
bozicrHT wrote:

You're right, I overlooked that.

https://github.com/llvm/llvm-project/pull/217608
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to