Added FoldingSet style 'profiling' support for APSInt.

llvm-svn: 46189
This commit is contained in:
Ted Kremenek 2008-01-19 04:31:12 +00:00
parent 702d3b8f37
commit dce31b9785
2 changed files with 27 additions and 0 deletions

View File

@ -125,6 +125,10 @@ public:
assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
return IsUnsigned ? uge(RHS) : sge(RHS);
}
/// Profile - Used to insert APSInt objects, or objects that contain APSInt
/// objects, into FoldingSets.
void Profile(FoldingSetNodeID& ID) const;
};
} // end namespace llvm

23
lib/Support/APSInt.cpp Normal file
View File

@ -0,0 +1,23 @@
//===-- llvm/ADT/APSInt.cpp - Arbitrary Precision Signed Int ---*- C++ -*--===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the APSInt class, which is a simple class that
// represents an arbitrary sized integer that knows its signedness.
//
//===----------------------------------------------------------------------===//
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/FoldingSet.h"
using namespace llvm;
void APSInt::Profile(FoldingSetNodeID& ID) const {
ID.AddInteger((unsigned) (IsUnsigned ? 1 : 0));
APInt::Profile(ID);
}