[clang] c99fa0b - Additional testcase for 0130b6cb5a8.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 12:21:53 PST 2020


Author: Richard Smith
Date: 2020-02-04T12:21:42-08:00
New Revision: c99fa0b80cc96424e2dd62f36af99934940f9a16

URL: https://github.com/llvm/llvm-project/commit/c99fa0b80cc96424e2dd62f36af99934940f9a16
DIFF: https://github.com/llvm/llvm-project/commit/c99fa0b80cc96424e2dd62f36af99934940f9a16.diff

LOG: Additional testcase for 0130b6cb5a8.

Added: 
    clang/test/CodeGenCXX/dereferenceable.cpp

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGenCXX/dereferenceable.cpp b/clang/test/CodeGenCXX/dereferenceable.cpp
new file mode 100644
index 000000000000..df8e6acab2db
--- /dev/null
+++ b/clang/test/CodeGenCXX/dereferenceable.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-linux-gnu | FileCheck %s
+
+struct A { void *p; void *q; void *r; };
+
+struct B : A {};
+static_assert(sizeof(B) == 24);
+
+// CHECK: define dereferenceable(24) {{.*}} @_Z1fR1B({{.*}} dereferenceable(24)
+B &f(B &b) { return b; }
+
+struct C : virtual A {};
+static_assert(sizeof(C) == 32);
+
+// CHECK: define dereferenceable(8) {{.*}} @_Z1fR1C({{.*}} dereferenceable(8)
+C &f(C &c) { return c; }


        


More information about the cfe-commits mailing list