[llvm-commits] [llvm] r77624 - in /llvm/trunk: include/llvm/ADT/Twine.h lib/Support/Twine.cpp
Daniel Dunbar
daniel at zuster.org
Thu Jul 30 14:15:16 PDT 2009
Author: ddunbar
Date: Thu Jul 30 16:15:14 2009
New Revision: 77624
URL: http://llvm.org/viewvc/llvm-project?rev=77624&view=rev
Log:
Twine: Directly support int, long, and long long types.
- This should resolve Cygwin gcc ambiguities.
Modified:
llvm/trunk/include/llvm/ADT/Twine.h
llvm/trunk/lib/Support/Twine.cpp
Modified: llvm/trunk/include/llvm/ADT/Twine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Twine.h?rev=77624&r1=77623&r2=77624&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Twine.h (original)
+++ llvm/trunk/include/llvm/ADT/Twine.h Thu Jul 30 16:15:14 2009
@@ -99,19 +99,26 @@
/// A pointer to a StringRef instance.
StringRefKind,
- /// A pointer to a uint64_t value, to render as an unsigned decimal
+ /// A pointer to an unsigned int value, to render as an unsigned decimal
/// integer.
- UDec32Kind,
+ DecUIKind,
- /// A pointer to a uint64_t value, to render as a signed decimal integer.
- SDec32Kind,
+ /// A pointer to an int value, to render as a signed decimal integer.
+ DecIKind,
- /// A pointer to a uint64_t value, to render as an unsigned decimal
+ /// A pointer to an unsigned long value, to render as an unsigned decimal
/// integer.
- UDec64Kind,
+ DecULKind,
- /// A pointer to a uint64_t value, to render as a signed decimal integer.
- SDec64Kind,
+ /// A pointer to a long value, to render as a signed decimal integer.
+ DecLKind,
+
+ /// A pointer to an unsigned long long value, to render as an unsigned
+ /// decimal integer.
+ DecULLKind,
+
+ /// A pointer to a long long value, to render as a signed decimal integer.
+ DecLLKind,
/// A pointer to a uint64_t value, to render as an unsigned hexadecimal
/// integer.
@@ -252,23 +259,33 @@
}
/// Construct a twine to print \arg Val as an unsigned decimal integer.
- explicit Twine(const uint32_t &Val)
- : LHS(&Val), LHSKind(UDec32Kind), RHSKind(EmptyKind) {
+ explicit Twine(const unsigned int &Val)
+ : LHS(&Val), LHSKind(DecUIKind), RHSKind(EmptyKind) {
+ }
+
+ /// Construct a twine to print \arg Val as a signed decimal integer.
+ explicit Twine(const int &Val)
+ : LHS(&Val), LHSKind(DecIKind), RHSKind(EmptyKind) {
+ }
+
+ /// Construct a twine to print \arg Val as an unsigned decimal integer.
+ explicit Twine(const unsigned long &Val)
+ : LHS(&Val), LHSKind(DecULKind), RHSKind(EmptyKind) {
}
/// Construct a twine to print \arg Val as a signed decimal integer.
- explicit Twine(const int32_t &Val)
- : LHS(&Val), LHSKind(SDec32Kind), RHSKind(EmptyKind) {
+ explicit Twine(const long &Val)
+ : LHS(&Val), LHSKind(DecLKind), RHSKind(EmptyKind) {
}
/// Construct a twine to print \arg Val as an unsigned decimal integer.
- explicit Twine(const uint64_t &Val)
- : LHS(&Val), LHSKind(UDec64Kind), RHSKind(EmptyKind) {
+ explicit Twine(const unsigned long long &Val)
+ : LHS(&Val), LHSKind(DecULLKind), RHSKind(EmptyKind) {
}
/// Construct a twine to print \arg Val as a signed decimal integer.
- explicit Twine(const int64_t &Val)
- : LHS(&Val), LHSKind(SDec64Kind), RHSKind(EmptyKind) {
+ explicit Twine(const long long &Val)
+ : LHS(&Val), LHSKind(DecLLKind), RHSKind(EmptyKind) {
}
// FIXME: Unfortunately, to make sure this is as efficient as possible we
Modified: llvm/trunk/lib/Support/Twine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Twine.cpp?rev=77624&r1=77623&r2=77624&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Twine.cpp (original)
+++ llvm/trunk/lib/Support/Twine.cpp Thu Jul 30 16:15:14 2009
@@ -47,17 +47,23 @@
case Twine::StringRefKind:
OS << *static_cast<const StringRef*>(Ptr);
break;
- case Twine::UDec32Kind:
- OS << *static_cast<const uint32_t*>(Ptr);
+ case Twine::DecUIKind:
+ OS << *static_cast<const unsigned int*>(Ptr);
break;
- case Twine::SDec32Kind:
- OS << *static_cast<const int32_t*>(Ptr);
+ case Twine::DecIKind:
+ OS << *static_cast<const int*>(Ptr);
break;
- case Twine::UDec64Kind:
- OS << *static_cast<const uint64_t*>(Ptr);
+ case Twine::DecULKind:
+ OS << *static_cast<const unsigned long*>(Ptr);
break;
- case Twine::SDec64Kind:
- OS << *static_cast<const int64_t*>(Ptr);
+ case Twine::DecLKind:
+ OS << *static_cast<const long*>(Ptr);
+ break;
+ case Twine::DecULLKind:
+ OS << *static_cast<const unsigned long long*>(Ptr);
+ break;
+ case Twine::DecLLKind:
+ OS << *static_cast<const long long*>(Ptr);
break;
case Twine::UHexKind:
OS.write_hex(*static_cast<const uint64_t*>(Ptr));
@@ -88,20 +94,26 @@
OS << "stringref:\""
<< static_cast<const StringRef*>(Ptr) << "\"";
break;
- case Twine::UDec32Kind:
- OS << "udec32:" << static_cast<const uint64_t*>(Ptr) << "\"";
+ case Twine::DecUIKind:
+ OS << "decUI:\"" << *static_cast<const unsigned int*>(Ptr) << "\"";
+ break;
+ case Twine::DecIKind:
+ OS << "decI:\"" << *static_cast<const int*>(Ptr) << "\"";
+ break;
+ case Twine::DecULKind:
+ OS << "decUL:\"" << *static_cast<const unsigned long*>(Ptr) << "\"";
break;
- case Twine::SDec32Kind:
- OS << "sdec32:" << static_cast<const int64_t*>(Ptr) << "\"";
+ case Twine::DecLKind:
+ OS << "decL:\"" << *static_cast<const long*>(Ptr) << "\"";
break;
- case Twine::UDec64Kind:
- OS << "udec64:" << static_cast<const uint64_t*>(Ptr) << "\"";
+ case Twine::DecULLKind:
+ OS << "decULL:\"" << *static_cast<const unsigned long long*>(Ptr) << "\"";
break;
- case Twine::SDec64Kind:
- OS << "sdec64:" << static_cast<const int64_t*>(Ptr) << "\"";
+ case Twine::DecLLKind:
+ OS << "decLL:\"" << *static_cast<const long long*>(Ptr) << "\"";
break;
case Twine::UHexKind:
- OS << "uhex:" << static_cast<const uint64_t*>(Ptr) << "\"";
+ OS << "uhex:\"" << static_cast<const uint64_t*>(Ptr) << "\"";
break;
}
}
More information about the llvm-commits
mailing list