Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2024
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
  2. index c8898ce196c1..6a603ce2502b 100644
  3. --- a/clang/lib/CodeGen/CodeGenModule.cpp
  4. +++ b/clang/lib/CodeGen/CodeGenModule.cpp
  5. @@ -55,6 +55,7 @@
  6. #include "llvm/Analysis/TargetLibraryInfo.h"
  7. #include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
  8. #include "llvm/IR/AttributeMask.h"
  9. +#include "llvm/IR/Attributes.h"
  10. #include "llvm/IR/CallingConv.h"
  11. #include "llvm/IR/DataLayout.h"
  12. #include "llvm/IR/Intrinsics.h"
  13. @@ -4547,6 +4548,15 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(
  14.  
  15. if ((isa<llvm::Function>(Entry) || isa<llvm::GlobalAlias>(Entry)) &&
  16. (Entry->getValueType() == Ty)) {
  17. + if (IsForDefinition) {
  18. + llvm::Function *Func = cast<llvm::Function>(Entry);
  19. + llvm::AttributeList AttributeList = Func->getAttributes();
  20. + if (D)
  21. + SetFunctionAttributes(GD, Func, false, IsThunk);
  22. + for (auto Attribute : AttributeList.getFnAttrs()) {
  23. + Func->addFnAttr(Attribute);
  24. + }
  25. + }
  26. return Entry;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement