From 75d37b493e2282f993a19a166bd573b03a7535af Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 15 Oct 2012 07:31:59 +0000 Subject: Use enum values instead of magic numbers for indexing into the attribute list. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165925 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.cpp') diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 073b59ef8d..6be225c6b5 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -1139,7 +1139,7 @@ CodeGenModule::GetOrCreateLLVMFunction(StringRef MangledName, if (D.getDecl()) SetFunctionAttributes(D, F, IsIncompleteFunction); if (ExtraAttrs.hasAttributes()) - F->addAttribute(~0, ExtraAttrs); + F->addAttribute(llvm::AttrListPtr::FunctionIndex, ExtraAttrs); // This is the first use or definition of a mangled name. If there is a // deferred decl with this name, remember that we need to emit it at the end @@ -1822,7 +1822,9 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old, // Add the return attributes. if (RAttrs.hasAttributes()) - AttrVec.push_back(llvm::AttributeWithIndex::get(0, RAttrs)); + AttrVec.push_back(llvm:: + AttributeWithIndex::get(llvm::AttrListPtr::ReturnIndex, + RAttrs)); // If the function was passed too few arguments, don't transform. If extra // arguments were passed, we silently drop them. If any of the types @@ -1847,7 +1849,9 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old, llvm::Attributes FnAttrs = AttrList.getFnAttributes(); if (FnAttrs.hasAttributes()) - AttrVec.push_back(llvm::AttributeWithIndex::get(~0, FnAttrs)); + AttrVec.push_back(llvm:: + AttributeWithIndex::get(llvm::AttrListPtr::FunctionIndex, + FnAttrs)); // Okay, we can transform this. Create the new call instruction and copy // over the required information. -- cgit v1.2.3-70-g09d2