diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-14 17:57:32 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-14 17:57:32 +0000 |
commit | 59850d0874429601812bc13408cb1f776649027c (patch) | |
tree | b21f6de4e08b89bb7931806bab798fc2a5e3a686 /include/llvm/ADT/FoldingSet.h | |
parent | 18f153bdb9db52e7089a2d5293b96c45a3124a26 (diff) | |
download | src-59850d0874429601812bc13408cb1f776649027c.tar.gz src-59850d0874429601812bc13408cb1f776649027c.zip |
Update llvm to r84119.vendor/llvm/llvm-r84119
Notes
Notes:
svn path=/vendor/llvm/dist/; revision=198090
svn path=/vendor/llvm/llvm-84119/; revision=198091; tag=vendor/llvm/llvm-r84119
Diffstat (limited to 'include/llvm/ADT/FoldingSet.h')
-rw-r--r-- | include/llvm/ADT/FoldingSet.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/include/llvm/ADT/FoldingSet.h b/include/llvm/ADT/FoldingSet.h index 1bcff3dc9eb3..c62c47d27353 100644 --- a/include/llvm/ADT/FoldingSet.h +++ b/include/llvm/ADT/FoldingSet.h @@ -18,7 +18,7 @@ #include "llvm/Support/DataTypes.h" #include "llvm/ADT/SmallVector.h" -#include <string> +#include "llvm/ADT/StringRef.h" #include <iterator> namespace llvm { @@ -227,9 +227,7 @@ public: void AddInteger(long long I); void AddInteger(unsigned long long I); void AddBoolean(bool B) { AddInteger(B ? 1U : 0U); } - void AddString(const char* String, const char* End); - void AddString(const std::string &String); - void AddString(const char* String); + void AddString(StringRef String); template <typename T> inline void Add(const T& x) { FoldingSetTrait<T>::Profile(x, *this); } @@ -439,6 +437,20 @@ public: }; //===----------------------------------------------------------------------===// +/// FastFoldingSetNode - This is a subclass of FoldingSetNode which stores +/// a FoldingSetNodeID value rather than requiring the node to recompute it +/// each time it is needed. This trades space for speed (which can be +/// significant if the ID is long), and it also permits nodes to drop +/// information that would otherwise only be required for recomputing an ID. +class FastFoldingSetNode : public FoldingSetNode { + FoldingSetNodeID FastID; +protected: + explicit FastFoldingSetNode(const FoldingSetNodeID &ID) : FastID(ID) {} +public: + void Profile(FoldingSetNodeID& ID) { ID = FastID; } +}; + +//===----------------------------------------------------------------------===// // Partial specializations of FoldingSetTrait. template<typename T> struct FoldingSetTrait<T*> { |