[llvm] r179849 - Attributes: Don't print trailing whitespace on the function attribute comment.
Benjamin Kramer
benny.kra at googlemail.com
Fri Apr 19 04:43:22 PDT 2013
Author: d0k
Date: Fri Apr 19 06:43:21 2013
New Revision: 179849
URL: http://llvm.org/viewvc/llvm-project?rev=179849&view=rev
Log:
Attributes: Don't print trailing whitespace on the function attribute comment.
Added:
llvm/trunk/test/Other/attribute-comment.ll
Modified:
llvm/trunk/lib/IR/Attributes.cpp
Modified: llvm/trunk/lib/IR/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Attributes.cpp?rev=179849&r1=179848&r2=179849&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Attributes.cpp (original)
+++ llvm/trunk/lib/IR/Attributes.cpp Fri Apr 19 06:43:21 2013
@@ -482,14 +482,13 @@ unsigned AttributeSetNode::getStackAlign
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;
Added: llvm/trunk/test/Other/attribute-comment.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/attribute-comment.ll?rev=179849&view=auto
==============================================================================
--- llvm/trunk/test/Other/attribute-comment.ll (added)
+++ llvm/trunk/test/Other/attribute-comment.ll Fri Apr 19 06:43:21 2013
@@ -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" }
More information about the llvm-commits
mailing list