diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-01-18 21:53:16 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-01-18 21:53:16 +0000 |
commit | 1b0c54f1c5dd61e56cb7cbc435fcb3319cff628f (patch) | |
tree | fc692786464bca45139569b988cd5ada7399dfc9 /lib/IR | |
parent | 1a17bd21ff64968817dedb6cd2b7c809cee90804 (diff) | |
download | external_llvm-1b0c54f1c5dd61e56cb7cbc435fcb3319cff628f.zip external_llvm-1b0c54f1c5dd61e56cb7cbc435fcb3319cff628f.tar.gz external_llvm-1b0c54f1c5dd61e56cb7cbc435fcb3319cff628f.tar.bz2 |
Use AttributeSet accessor methods instead of Attribute accessor methods.
Further encapsulation of the Attribute object. Don't allow direct access to the
Attribute object as an aggregate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r-- | lib/IR/AsmWriter.cpp | 13 | ||||
-rw-r--r-- | lib/IR/Attributes.cpp | 5 |
2 files changed, 11 insertions, 7 deletions
diff --git a/lib/IR/AsmWriter.cpp b/lib/IR/AsmWriter.cpp index 1c46a94..ff43128 100644 --- a/lib/IR/AsmWriter.cpp +++ b/lib/IR/AsmWriter.cpp @@ -1557,9 +1557,8 @@ void AssemblyWriter::printFunction(const Function *F) { FunctionType *FT = F->getFunctionType(); const AttributeSet &Attrs = F->getAttributes(); - Attribute RetAttrs = Attrs.getRetAttributes(); - if (RetAttrs.hasAttributes()) - Out << Attrs.getRetAttributes().getAsString() << ' '; + if (Attrs.hasAttributes(AttributeSet::ReturnIndex)) + Out << Attrs.getAsString(AttributeSet::ReturnIndex) << ' '; TypePrinter.print(F->getReturnType(), Out); Out << ' '; WriteAsOperandInternal(Out, F, &TypePrinter, &Machine, F->getParent()); @@ -1849,8 +1848,8 @@ void AssemblyWriter::printInstruction(const Instruction &I) { Type *RetTy = FTy->getReturnType(); const AttributeSet &PAL = CI->getAttributes(); - if (PAL.getRetAttributes().hasAttributes()) - Out << ' ' << PAL.getRetAttributes().getAsString(); + if (PAL.hasAttributes(AttributeSet::ReturnIndex)) + Out << ' ' << PAL.getAsString(AttributeSet::ReturnIndex); // If possible, print out the short form of the call instruction. We can // only do this if the first argument is a pointer to a nonvararg function, @@ -1888,8 +1887,8 @@ void AssemblyWriter::printInstruction(const Instruction &I) { PrintCallingConv(II->getCallingConv(), Out); } - if (PAL.getRetAttributes().hasAttributes()) - Out << ' ' << PAL.getRetAttributes().getAsString(); + if (PAL.hasAttributes(AttributeSet::ReturnIndex)) + Out << ' ' << PAL.getAsString(AttributeSet::ReturnIndex); // If possible, print out the short form of the invoke instruction. We can // only do this if the first argument is a pointer to a nonvararg function, diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp index 173782e..bb98358 100644 --- a/lib/IR/Attributes.cpp +++ b/lib/IR/Attributes.cpp @@ -660,6 +660,11 @@ bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const { return false; } +AttributeSet AttributeSet::addRetAttributes(LLVMContext &C, + AttributeSet Attrs) const { + return addAttr(C, ReturnIndex, getAttributes(ReturnIndex)); +} + AttributeSet AttributeSet::addFnAttributes(LLVMContext &C, AttributeSet Attrs) const { return addAttr(C, FunctionIndex, getAttributes(FunctionIndex)); |