[cfe-commits] r165925 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CGStmt.cpp CodeGenModule.cpp TargetInfo.cpp
Bill Wendling
isanbard at gmail.com
Mon Oct 15 00:32:29 PDT 2012
Author: void
Date: Mon Oct 15 02:31:59 2012
New Revision: 165925
URL: http://llvm.org/viewvc/llvm-project?rev=165925&view=rev
Log:
Use enum values instead of magic numbers for indexing into the attribute list.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/TargetInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=165925&r1=165924&r2=165925&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Oct 15 02:31:59 2012
@@ -1006,7 +1006,7 @@
if (RetAttrs.hasAttributes())
PAL.push_back(llvm::
- AttributeWithIndex::get(0,
+ AttributeWithIndex::get(llvm::AttrListPtr::ReturnIndex,
llvm::Attributes::get(getLLVMContext(),
RetAttrs)));
@@ -1080,7 +1080,8 @@
++Index;
}
if (FuncAttrs.hasAttributes())
- PAL.push_back(llvm::AttributeWithIndex::get(~0,
+ PAL.push_back(llvm::
+ AttributeWithIndex::get(llvm::AttrListPtr::FunctionIndex,
llvm::Attributes::get(getLLVMContext(),
FuncAttrs)));
}
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=165925&r1=165924&r2=165925&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Mon Oct 15 02:31:59 2012
@@ -1634,7 +1634,8 @@
llvm::CallInst *Result = Builder.CreateCall(IA, Args);
llvm::Attributes::Builder B;
B.addAttribute(llvm::Attributes::NoUnwind);
- Result->addAttribute(~0, llvm::Attributes::get(getLLVMContext(), B));
+ Result->addAttribute(llvm::AttrListPtr::FunctionIndex,
+ llvm::Attributes::get(getLLVMContext(), B));
// Slap the source location of the inline asm into a !srcloc metadata on the
// call. FIXME: Handle metadata for MS-style inline asms.
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=165925&r1=165924&r2=165925&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Oct 15 02:31:59 2012
@@ -1139,7 +1139,7 @@
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 @@
// 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 @@
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.
Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=165925&r1=165924&r2=165925&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon Oct 15 02:31:59 2012
@@ -970,7 +970,8 @@
// Now add the 'alignstack' attribute with a value of 16.
llvm::Attributes::Builder B;
B.addStackAlignmentAttr(16);
- Fn->addAttribute(~0U, llvm::Attributes::get(CGM.getLLVMContext(), B));
+ Fn->addAttribute(llvm::AttrListPtr::FunctionIndex,
+ llvm::Attributes::get(CGM.getLLVMContext(), B));
}
}
}
More information about the cfe-commits
mailing list