nmusgrave created this revision.
nmusgrave added reviewers: eugenis, kcc.
nmusgrave added a subscriber: cfe-commits.

Updating missed changes in revision D11198

http://reviews.llvm.org/D11251

Files:
  .arcconfig
  .gitignore
  test/CodeGenCXX/sanitize-dtor-callback.cpp
  test/CodeGenCXX/sanitize-no-dtor-callback.cpp

Index: test/CodeGenCXX/sanitize-no-dtor-callback.cpp
===================================================================
--- /dev/null
+++ test/CodeGenCXX/sanitize-no-dtor-callback.cpp
@@ -0,0 +1,23 @@
+// Test without the flag -fsanitize-memory-use-after-dtor, to ensure that
+// instrumentation is not erroneously inserted
+// RUN: %clang_cc1 -fsanitize=memory -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
+
+struct Simple {
+  ~Simple() {}
+};
+Simple s;
+// CHECK-LABEL: define {{.*}}SimpleD1Ev
+// CHECK-NOT: call void @__sanitizer_dtor_callback
+
+struct Inlined {
+  inline ~Inlined() {}
+};
+Inlined i;
+// CHECK-LABEL: define {{.*}}InlinedD1Ev
+// CHECK-NOT: call void @__sanitizer_dtor_callback
+
+// CHECK-LABEL: define {{.*}}SimpleD2Ev
+// CHECK-NOT: call void @__sanitizer_dtor_callback
+
+// CHECK-LABEL: define {{.*}}InlinedD2Ev
+// CHECK-NOT: call void @__sanitizer_dtor_callback
Index: test/CodeGenCXX/sanitize-dtor-callback.cpp
===================================================================
--- test/CodeGenCXX/sanitize-dtor-callback.cpp
+++ test/CodeGenCXX/sanitize-dtor-callback.cpp
@@ -1,72 +1,69 @@
 // Test -fsanitize-memory-use-after-dtor
-// RUN: %clang_cc1 -fsanitize=memory -fsanitize-memory-use-after-dtor -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -fsanitize=memory -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s -check-prefix=NO-DTOR-CHECK
-
-// RUN: %clang_cc1 -std=c++11 -fsanitize=memory -fsanitize-memory-use-after-dtor -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s -check-prefix=STD11
-// RUN: %clang_cc1 -std=c++11 -fsanitize=memory -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s -check-prefix=NO-DTOR-STD11-CHECK
+// RUN: %clang_cc1 -fsanitize=memory -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
 
 struct Simple {
   ~Simple() {}
 };
 Simple s;
 // Simple internal member is poisoned by compiler-generated dtor
-// CHECK-LABEL: @_ZN6SimpleD2Ev
+// CHECK-LABEL: define {{.*}}SimpleD1Ev
 // CHECK: call void @__sanitizer_dtor_callback
+// CHECK-NOT: call void @__sanitizer_dtor_callback
 // CHECK: ret void
 
-// Compiling without the flag does not generate member-poisoning dtor
-// NO-DTOR-CHECK-LABEL: @_ZN6SimpleD2Ev
-// NO-DTOR-CHECK-NOT: call void @__sanitizer_dtor_callback
-// NO-DTOR-CHECK: ret void
-
-
 struct Inlined {
   inline ~Inlined() {}
 };
-Inlined in;
-// Dtor that is inlined where invoked poisons object
-// CHECK-LABEL: @_ZN7InlinedD2Ev
+Inlined i;
+// Simple internal member is poisoned by compiler-generated dtor
+// CHECK-LABEL: define {{.*}}InlinedD1Ev
 // CHECK: call void @__sanitizer_dtor_callback
+// CHECK-NOT: call void @__sanitizer_dtor_callback
 // CHECK: ret void
 
-// Compiling without the flag does not generate member-poisoning dtor
-// NO-DTOR-CHECK-LABEL: @_ZN7InlinedD2Ev
-// NO-DTOR-CHECK-NOT: call void @__sanitizer_dtor_callback
-// NO-DTOR-CHECK: ret void
-
-
 struct Defaulted_Trivial {
   ~Defaulted_Trivial() = default;
 };
-int main() {
+void create_def_trivial() {
   Defaulted_Trivial def_trivial;
 }
 // The compiler is explicitly signalled to handle object cleanup.
-// No complex member attributes ensures that the compiler destroys
-// the memory inline. However, it must still poison this memory.
-// STD11-CHECK-LABEL: alloca %struct.Defaulted_Trivial
-// STD11: call void @__sanitizer_dtor_callback
-// STD11: ret void
-
-// Compiling without the flag does not generate member-poisoning dtor
-// NO-DTOR-STD11-CHECK-LABEL: alloca %struct.Defaulted_Trivial
-// NO-DTOR-STD11-CHECK-NOT: call void @__sanitizer_dtor_callback
-// NO-DTOR-STD11-CHECK: ret void
-
+// No complex member attributes. Compiler destroys inline, so
+// no destructor defined.
+// CHECK-LABEL: define {{.*}}create_def_trivial
+// CHECK-NOT: call {{.*}}Defaulted_Trivial
+// CHECK-NOT: call void @__sanitizer_dtor_callback
+// CHECK: ret void
 
 struct Defaulted_Non_Trivial {
   Simple s;
   ~Defaulted_Non_Trivial() = default;
 };
 Defaulted_Non_Trivial def_non_trivial;
 // Explicitly compiler-generated dtor poisons object.
 // By including a Simple member in the struct, the compiler is
-// forced to generate a non-trivial destructor..
-// STD11-CHECK-LABEL: @_ZN21Defaulted_Non_TrivialD2Ev
-// STD11: call void @__sanitizer_dtor_callback
-// STD11: ret void
+// forced to generate a non-trivial destructor.
+// CHECK-LABEL: define {{.*}}Defaulted_Non_TrivialD1Ev
+// CHECK: call void @__sanitizer_dtor_callback
+// CHECK-NOT: call void @__sanitizer_dtor_callback
+// CHECK: ret void
+
+
+// Note: ordering is important. In the emitted bytecode, these
+// second dtors defined after the first. Explicitly checked here
+// to confirm that all invoked dtors have member poisoning
+// instrumentation inserted.
+// CHECK-LABEL: define {{.*}}SimpleD2Ev
+// CHECK: call void @__sanitizer_dtor_callback
+// CHECK-NOT: call void @__sanitizer_dtor_callback
+// CHECK: ret void
 
-// Compiling without the flag does not generate member-poisoning dtor
-// NO-DTOR-STD11-CHECK-LABEL: @_ZN21Defaulted_Non_TrivialD2Ev
-// NO-DTOR-STD11-CHECK-NOT: call void @__sanitizer_dtor_callback
-// NO-DTOR-STD11-CHECK: ret void
+// CHECK-LABEL: define {{.*}}InlinedD2Ev
+// CHECK: call void @__sanitizer_dtor_callback
+// CHECK-NOT: call void @__sanitizer_dtor_callback
+// CHECK: ret void
+
+// CHECK-LABEL: define {{.*}}Defaulted_Non_TrivialD2Ev
+// CHECK: call void @__sanitizer_dtor_callback
+// CHECK-NOT: call void @__sanitizer_dtor_callback
+// CHECK: ret void
Index: .gitignore
===================================================================
--- .gitignore
+++ /dev/null
@@ -1,35 +0,0 @@
-#==============================================================================#
-# This file specifies intentionally untracked files that git should ignore.
-# See: http://www.kernel.org/pub/software/scm/git/docs/gitignore.html
-#
-# This file is intentionally different from the output of `git svn show-ignore`,
-# as most of those are useless.
-#==============================================================================#
-
-#==============================================================================#
-# File extensions to be ignored anywhere in the tree.
-#==============================================================================#
-# Temp files created by most text editors.
-*~
-# Merge files created by git.
-*.orig
-# Byte compiled python modules.
-*.pyc
-# vim swap files
-.*.sw?
-.sw?
-
-#==============================================================================#
-# Explicit files to ignore (only matches one).
-#==============================================================================#
-cscope.files
-cscope.out
-
-#==============================================================================#
-# Directories to ignore (do not add trailing '/'s, they skip symlinks).
-#==============================================================================#
-# Clang extra user tools, which is tracked independently (clang-tools-extra).
-tools/extra
-# Sphinx build products
-docs/_build
-docs/analyzer/_build
Index: .arcconfig
===================================================================
--- .arcconfig
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "project_id" : "clang",
-  "conduit_uri" : "http://reviews.llvm.org/";
-}
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to