r295918 - Rename a helper function, NFC.
Vedant Kumar via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 22 17:22:38 PST 2017
Author: vedantk
Date: Wed Feb 22 19:22:38 2017
New Revision: 295918
URL: http://llvm.org/viewvc/llvm-project?rev=295918&view=rev
Log:
Rename a helper function, NFC.
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=295918&r1=295917&r2=295918&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Feb 22 19:22:38 2017
@@ -952,7 +952,7 @@ LValue CodeGenFunction::EmitUnsupportedL
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::EmitCheckedLValu
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(c
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);
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=295918&r1=295917&r2=295918&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Wed Feb 22 19:22:38 2017
@@ -292,7 +292,7 @@ RValue CodeGenFunction::EmitCXXMemberOrO
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
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=295918&r1=295917&r2=295918&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Feb 22 19:22:38 2017
@@ -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
More information about the cfe-commits
mailing list