]> granicus.if.org Git - clang/commitdiff
Revert "[ubsan] PR34266: When sanitizing the 'this' value for a member function that...
authorAdrian Prantl <aprantl@apple.com>
Thu, 24 Aug 2017 18:18:24 +0000 (18:18 +0000)
committerAdrian Prantl <aprantl@apple.com>
Thu, 24 Aug 2017 18:18:24 +0000 (18:18 +0000)
This reverts commit r311589 because of bot breakage.
http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan_check/4115/consoleFull#15752874848254eaf0-7326-4999-85b0-388101f2d404.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311680 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclCXX.h
lib/CodeGen/CodeGenFunction.cpp
test/CodeGenCXX/catch-undef-behavior.cpp

index bbd3360d755edec8adf6305edc3f5c3b826ecfa0..289eb156903c197d6eac7c49e4283e8350864410 100644 (file)
@@ -2027,10 +2027,7 @@ public:
 
   /// \brief Returns the type of the \c this pointer.
   ///
-  /// Should only be called for instance (i.e., non-static) methods. Note
-  /// that for the call operator of a lambda closure type, this returns the
-  /// desugared 'this' type (a pointer to the closure type), not the captured
-  /// 'this' type.
+  /// Should only be called for instance (i.e., non-static) methods.
   QualType getThisType(ASTContext &C) const;
 
   unsigned getTypeQualifiers() const {
index 0df7d271070b4659d13420c8c6bc4b4a5e778f8c..4201804e18547ae6a6429374a1f67fc84358e6ee 100644 (file)
@@ -1014,11 +1014,11 @@ void CodeGenFunction::StartFunction(GlobalDecl GD,
     }
 
     // Check the 'this' pointer once per function, if it's available.
-    if (CXXABIThisValue) {
+    if (CXXThisValue) {
       SanitizerSet SkippedChecks;
       SkippedChecks.set(SanitizerKind::ObjectSize, true);
       QualType ThisTy = MD->getThisType(getContext());
-      EmitTypeCheck(TCK_Load, Loc, CXXABIThisValue, ThisTy,
+      EmitTypeCheck(TCK_Load, Loc, CXXThisValue, ThisTy,
                     getContext().getTypeAlignInChars(ThisTy->getPointeeType()),
                     SkippedChecks);
     }
index 4733556c627bb3f3e3a88c83e493819f4dacd5f5..179c3341226720f4065c77c553e6a443e14861d2 100644 (file)
@@ -449,27 +449,6 @@ void upcast_to_vbase() {
 }
 }
 
-struct ThisAlign {
-  void this_align_lambda();
-};
-void ThisAlign::this_align_lambda() {
-  // CHECK-LABEL: define {{.*}}@"_ZZN9ThisAlign17this_align_lambdaEvENK3$_0clEv"
-  // CHECK-SAME: (%{{.*}}* %[[this:[^)]*]])
-  // CHECK: %[[this_addr:.*]] = alloca
-  // CHECK: store %{{.*}}* %[[this]], %{{.*}}** %[[this_addr]],
-  // CHECK: %[[this_inner:.*]] = load %{{.*}}*, %{{.*}}** %[[this_addr]],
-  // CHECK: %[[this_outer_addr:.*]] = getelementptr inbounds %{{.*}}, %{{.*}}* %[[this_inner]], i32 0, i32 0
-  // CHECK: %[[this_outer:.*]] = load %{{.*}}*, %{{.*}}** %[[this_outer_addr]],
-  //
-  // CHECK: %[[this_inner_isnonnull:.*]] = icmp ne %{{.*}}* %[[this_inner]], null
-  // CHECK: %[[this_inner_asint:.*]] = ptrtoint %{{.*}}* %[[this_inner]] to i
-  // CHECK: %[[this_inner_misalignment:.*]] = and i{{32|64}} %[[this_inner_asint]], {{3|7}},
-  // CHECK: %[[this_inner_isaligned:.*]] = icmp eq i{{32|64}} %[[this_inner_misalignment]], 0
-  // CHECK: %[[this_inner_valid:.*]] = and i1 %[[this_inner_isnonnull]], %[[this_inner_isaligned]],
-  // CHECK: br i1 %[[this_inner_valid:.*]]
-  [&] { return this; } ();
-}
-
 namespace CopyValueRepresentation {
   // CHECK-LABEL: define {{.*}} @_ZN23CopyValueRepresentation2S3aSERKS0_
   // CHECK-NOT: call {{.*}} @__ubsan_handle_load_invalid_value