Skip to content

Commit

Permalink
Attributes: Don't print trailing whitespace on the function attribute…
Browse files Browse the repository at this point in the history
… comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179849 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
d0k committed Apr 19, 2013
1 parent db5f927 commit e94e4ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/IR/Attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,14 +482,13 @@ unsigned AttributeSetNode::getStackAlignment() const {

std::string AttributeSetNode::getAsString(bool TargetIndependent,
bool InAttrGrp) const {
std::string Str = "";
std::string Str;
for (SmallVectorImpl<Attribute>::const_iterator I = AttrList.begin(),
E = AttrList.end(); I != E; ) {
E = AttrList.end(); I != E; ++I) {
if (TargetIndependent || !I->isStringAttribute()) {
if (I != AttrList.begin())
Str += ' ';
Str += I->getAsString(InAttrGrp);
if (++I != E) Str += " ";
} else {
++I;
}
}
return Str;
Expand Down
9 changes: 9 additions & 0 deletions test/Other/attribute-comment.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
; RUN: opt -S < %s | FileCheck %s -strict-whitespace

; CHECK: {{^}}; Function Attrs: nounwind readnone ssp uwtable{{$}}
; CHECK-NEXT: define void @test1() #0
define void @test1() #0 {
ret void
}

attributes #0 = { nounwind ssp "less-precise-fpmad"="false" uwtable "no-frame-pointer-elim"="true" readnone "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }

0 comments on commit e94e4ca

Please sign in to comment.