http://llvm.org/bugs/show_bug.cgi?id=14038
Bug #: 14038
Summary: Floating point literals not pretty printed correctly
Product: clang
Version: 3.1
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Classification: Unclassified
Floating point literals are not pretty-printed correctly - they have no
appropriate suffix and if they have no fractional parts, they are printed as
integers. I propose the following fix for that:
--- StmtPrinter.cpp.org 2012-10-07 16:32:27.230756541 +0200
+++ StmtPrinter.cpp 2012-10-07 16:44:05.038769708 +0200
@@ -726,6 +726,12 @@
SmallString<16> Str;
Node->getValue().toString(Str);
OS << Str;
+ if(Str.find('.') == llvm::StringRef::npos)
+ OS<<".0";
+ if(Node->getType()->getAs<BuiltinType>()->getKind() == BuiltinType::Float)
+ OS<<"f";
+ if(Node->getType()->getAs<BuiltinType>()->getKind() ==
BuiltinType::LongDouble)
+ OS<<"l";
}
void StmtPrinter::VisitImaginaryLiteral(ImaginaryLiteral *Node) {
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs