[PATCH] D40720: No -fsanitize=function warning when calling noexcept function through non-noexcept pointer in C++17

Stephan Bergmann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 05:06:32 PST 2017


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rC320978: No -fsanitize=function warning when calling noexcept function through non… (authored by sberg, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D40720?vs=125152&id=127340#toc

Repository:
  rC Clang

https://reviews.llvm.org/D40720

Files:
  lib/CodeGen/CGExpr.cpp


Index: lib/CodeGen/CGExpr.cpp
===================================================================
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -4504,10 +4504,14 @@
           Builder.CreateICmpEQ(CalleeRTTI, FTRTTIConst);
       llvm::Constant *StaticData[] = {
         EmitCheckSourceLocation(E->getLocStart()),
-        EmitCheckTypeDescriptor(CalleeType)
+        EmitCheckTypeDescriptor(CalleeType),
+        cast<FunctionProtoType>(FnType)->isNothrow(getContext())
+          ? llvm::Constant::getNullValue(FTRTTIConst->getType())
+          : FTRTTIConst
       };
       EmitCheck(std::make_pair(CalleeRTTIMatch, SanitizerKind::Function),
-                SanitizerHandler::FunctionTypeMismatch, StaticData, CalleePtr);
+                SanitizerHandler::FunctionTypeMismatch, StaticData,
+                {CalleePtr, CalleeRTTI});
 
       Builder.CreateBr(Cont);
       EmitBlock(Cont);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40720.127340.patch
Type: text/x-patch
Size: 909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171218/2603b381/attachment.bin>


More information about the cfe-commits mailing list