[PATCH] D53263: [CodeGen] Fix places where the return type of a FunctionDecl was being used in place of the function type
Ben via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 14 15:20:50 PDT 2018
bobsayshilol created this revision.
bobsayshilol added reviewers: sberg, ahatanak.
Herald added subscribers: cfe-commits, jfb.
`FunctionDecl::Create()` takes as its `T` parameter the type of function that should be created, not the return type. Passing in the return type looks to have been copypasta'd around a bit, but the number of correct usages outweighs the incorrect ones so I've opted for keeping what `T` is the same and fixing up the call sites instead.
This fixes a crash in Clang when attempting to compile the following snippet of code with `-fblocks -fsanitize=function -x objective-c++` (the original repro case):
void g(void(^)());
void f()
{
__block int a = 0;
g(^(){ a++; });
}
as well as the following which only requires `-fsanitize=function -x c++`:
void f(char * buf)
{
__builtin_os_log_format(buf, "");
}
I haven't added the above as tests or checked that all of the current tests build so I don't expect this to get merged straight away, but I wanted to check that this is matching guidelines and potentially avoiding any duplicate work if someone else also starts trying to track down this issue too.
Repository:
rC Clang
https://reviews.llvm.org/D53263
Files:
lib/AST/Decl.cpp
lib/CodeGen/CGBlocks.cpp
lib/CodeGen/CGBuiltin.cpp
lib/CodeGen/CGNonTrivialStruct.cpp
lib/CodeGen/CGObjC.cpp
lib/CodeGen/CGStmtOpenMP.cpp
lib/CodeGen/ItaniumCXXABI.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53263.169631.patch
Type: text/x-patch
Size: 17440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181014/61d0827a/attachment-0001.bin>
More information about the cfe-commits
mailing list