[llvm-commits] [llvm] r58632 - in /llvm/trunk: include/llvm/ADT/FoldingSet.h lib/Support/FoldingSet.cpp
Dan Gohman
gohman at apple.com
Mon Nov 3 11:40:18 PST 2008
Author: djg
Date: Mon Nov 3 13:40:18 2008
New Revision: 58632
URL: http://llvm.org/viewvc/llvm-project?rev=58632&view=rev
Log:
Overload AddInteger on int/long/long long instead of on int/int64_t,
to avoid overload ambiguities. This fixes build errors introduced
by r58623.
Modified:
llvm/trunk/include/llvm/ADT/FoldingSet.h
llvm/trunk/lib/Support/FoldingSet.cpp
Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=58632&r1=58631&r2=58632&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/FoldingSet.h (original)
+++ llvm/trunk/include/llvm/ADT/FoldingSet.h Mon Nov 3 13:40:18 2008
@@ -221,8 +221,10 @@
void AddPointer(const void *Ptr);
void AddInteger(signed I);
void AddInteger(unsigned I);
- void AddInteger(int64_t I);
- void AddInteger(uint64_t I);
+ void AddInteger(long I);
+ void AddInteger(unsigned long I);
+ void AddInteger(long long I);
+ void AddInteger(unsigned long long I);
void AddFloat(float F);
void AddDouble(double D);
void AddString(const std::string &String);
Modified: llvm/trunk/lib/Support/FoldingSet.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=58632&r1=58631&r2=58632&view=diff
==============================================================================
--- llvm/trunk/lib/Support/FoldingSet.cpp (original)
+++ llvm/trunk/lib/Support/FoldingSet.cpp Mon Nov 3 13:40:18 2008
@@ -41,13 +41,23 @@
void FoldingSetNodeID::AddInteger(unsigned I) {
Bits.push_back(I);
}
-void FoldingSetNodeID::AddInteger(int64_t I) {
- AddInteger((uint64_t)I);
+void FoldingSetNodeID::AddInteger(long I) {
+ AddInteger((unsigned long)I);
}
-void FoldingSetNodeID::AddInteger(uint64_t I) {
- Bits.push_back(unsigned(I));
-
- // If the integer is small, encode it just as 32-bits.
+void FoldingSetNodeID::AddInteger(unsigned long I) {
+ if (sizeof(long) == sizeof(int))
+ AddInteger(unsigned(I));
+ else if (sizeof(long) == sizeof(long long)) {
+ AddInteger((unsigned long long)I);
+ } else {
+ assert(0 && "unexpected sizeof(long)");
+ }
+}
+void FoldingSetNodeID::AddInteger(long long I) {
+ AddInteger((unsigned long long)I);
+}
+void FoldingSetNodeID::AddInteger(unsigned long long I) {
+ AddInteger(unsigned(I));
if ((uint64_t)(int)I != I)
Bits.push_back(unsigned(I >> 32));
}
More information about the llvm-commits
mailing list