]> granicus.if.org Git - clang/commitdiff
Rename a helper function, NFC.
authorVedant Kumar <vsk@apple.com>
Thu, 23 Feb 2017 01:22:38 +0000 (01:22 +0000)
committerVedant Kumar <vsk@apple.com>
Thu, 23 Feb 2017 01:22:38 +0000 (01:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295918 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGExprCXX.cpp
lib/CodeGen/CodeGenFunction.h

index 276716ffb7639fb77c6b855bed46e02732b99d03..4e3bbb69c573cb567c7179aa580a00210099ba34 100644 (file)
@@ -952,7 +952,7 @@ LValue CodeGenFunction::EmitUnsupportedLValue(const Expr *E,
                         E->getType());
 }
 
-bool CodeGenFunction::CanElideObjectPointerNullCheck(const Expr *Obj) {
+bool CodeGenFunction::IsDeclRefOrWrappedCXXThis(const Expr *Obj) {
   if (isa<DeclRefExpr>(Obj))
     return true;
 
@@ -987,7 +987,7 @@ LValue CodeGenFunction::EmitCheckedLValue(const Expr *E, TypeCheckKind TCK) {
   if (!isa<DeclRefExpr>(E) && !LV.isBitField() && LV.isSimple()) {
     SanitizerSet SkippedChecks;
     if (const auto *ME = dyn_cast<MemberExpr>(E))
-      if (CanElideObjectPointerNullCheck(ME->getBase()))
+      if (IsDeclRefOrWrappedCXXThis(ME->getBase()))
         SkippedChecks.set(SanitizerKind::Null, true);
     EmitTypeCheck(TCK, E->getExprLoc(), LV.getPointer(),
                   E->getType(), LV.getAlignment(), SkippedChecks);
@@ -3372,7 +3372,7 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
     Address Addr = EmitPointerWithAlignment(BaseExpr, &AlignSource);
     QualType PtrTy = BaseExpr->getType()->getPointeeType();
     SanitizerSet SkippedChecks;
-    if (CanElideObjectPointerNullCheck(BaseExpr))
+    if (IsDeclRefOrWrappedCXXThis(BaseExpr))
       SkippedChecks.set(SanitizerKind::Null, true);
     EmitTypeCheck(TCK_MemberAccess, E->getExprLoc(), Addr.getPointer(), PtrTy,
                   /*Alignment=*/CharUnits::Zero(), SkippedChecks);
index 3751ef116a89dfa4a33c6e51b86138f5d6a6e12f..29c307bbef8921cc5f2b1b462ad789541f66bfe6 100644 (file)
@@ -292,7 +292,7 @@ RValue CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(
 
   SanitizerSet SkippedChecks;
   if (const auto *CMCE = dyn_cast<CXXMemberCallExpr>(CE))
-    if (CanElideObjectPointerNullCheck(CMCE->getImplicitObjectArgument()))
+    if (IsDeclRefOrWrappedCXXThis(CMCE->getImplicitObjectArgument()))
       SkippedChecks.set(SanitizerKind::Null, true);
   EmitTypeCheck(
       isa<CXXConstructorDecl>(CalleeDecl) ? CodeGenFunction::TCK_ConstructorCall
index 80a9a0e5b1199b10a22890b36bd8d55dfce64275..99ab1a19361f2db6e8ab188d551f3ad36de7c28a 100644 (file)
@@ -2030,8 +2030,9 @@ public:
   llvm::BlockAddress *GetAddrOfLabel(const LabelDecl *L);
   llvm::BasicBlock *GetIndirectGotoBlock();
 
-  /// Check if the null check for \p ObjectPointer can be skipped.
-  static bool CanElideObjectPointerNullCheck(const Expr *ObjectPointer);
+  /// Check if \p E is a reference, or a C++ "this" pointer wrapped in value-
+  /// preserving casts.
+  static bool IsDeclRefOrWrappedCXXThis(const Expr *E);
 
   /// EmitNullInitialization - Generate code to set a value of the given type to
   /// null, If the type contains data member pointers, they will be initialized