Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
- index c8898ce196c1..6a603ce2502b 100644
- --- a/clang/lib/CodeGen/CodeGenModule.cpp
- +++ b/clang/lib/CodeGen/CodeGenModule.cpp
- @@ -55,6 +55,7 @@
- #include "llvm/Analysis/TargetLibraryInfo.h"
- #include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
- #include "llvm/IR/AttributeMask.h"
- +#include "llvm/IR/Attributes.h"
- #include "llvm/IR/CallingConv.h"
- #include "llvm/IR/DataLayout.h"
- #include "llvm/IR/Intrinsics.h"
- @@ -4547,6 +4548,15 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(
- if ((isa<llvm::Function>(Entry) || isa<llvm::GlobalAlias>(Entry)) &&
- (Entry->getValueType() == Ty)) {
- + if (IsForDefinition) {
- + llvm::Function *Func = cast<llvm::Function>(Entry);
- + llvm::AttributeList AttributeList = Func->getAttributes();
- + if (D)
- + SetFunctionAttributes(GD, Func, false, IsThunk);
- + for (auto Attribute : AttributeList.getFnAttrs()) {
- + Func->addFnAttr(Attribute);
- + }
- + }
- return Entry;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement