diff options
| author | Arthur Eubanks <aeubanks@google.com> | 2021-08-16 16:29:20 -0700 |
|---|---|---|
| committer | Arthur Eubanks <aeubanks@google.com> | 2021-08-17 21:05:40 -0700 |
| commit | 46cf82532cf1502b6320517a2ef42d8c435e598a (patch) | |
| tree | c4eef49199276faf133fb0041a8747b93be6e589 /clang/lib/CodeGen/CodeGenModule.cpp | |
| parent | b41bfb819d0c3cbffe6dc0679f427ab1f44377b9 (diff) | |
[NFC] Replace Function handling of attributes with less confusing calls
To avoid magic constants and confusing indexes.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index ebd3cc7d7dcc..0a660245a3c1 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2118,7 +2118,7 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F, F->arg_begin()->getType() ->canLosslesslyBitCastTo(F->getReturnType()) && "unexpected this return"); - F->addAttribute(1, llvm::Attribute::Returned); + F->addParamAttr(0, llvm::Attribute::Returned); } // Only a few attributes are set on declarations; these may later be @@ -2144,15 +2144,13 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F, assert(HasBody && "Inline builtin declarations should always have an " "available body!"); if (shouldEmitFunction(FDBody)) - F->addAttribute(llvm::AttributeList::FunctionIndex, - llvm::Attribute::NoBuiltin); + F->addFnAttr(llvm::Attribute::NoBuiltin); } if (FD->isReplaceableGlobalAllocationFunction()) { // A replaceable global allocation function does not act like a builtin by // default, only if it is invoked by a new-expression or delete-expression. - F->addAttribute(llvm::AttributeList::FunctionIndex, - llvm::Attribute::NoBuiltin); + F->addFnAttr(llvm::Attribute::NoBuiltin); } if (isa<CXXConstructorDecl>(FD) || isa<CXXDestructorDecl>(FD)) |
