[LLVMdev] Some enhancements to ImmutableSet and FoldingSet

Ted Kremenek kremenek at apple.com
Wed Feb 11 12:54:02 PST 2009


On Feb 11, 2009, at 10:36 AM, Ben Laurie wrote:

> I needed these for some work I'm doing in clang...
> <set.patch>_______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Minor nit:

--- include/llvm/ADT/FoldingSet.h	(revision 63488)
+++ include/llvm/ADT/FoldingSet.h	(working copy)
@@ -225,6 +225,7 @@
    void AddInteger(unsigned long I);
    void AddInteger(long long I);
    void AddInteger(unsigned long long I);
+  void AddBoolean(bool B);
    void AddString(const std::string &String);
    void AddString(const char* String);

Index: lib/Support/FoldingSet.cpp
===================================================================
--- lib/Support/FoldingSet.cpp	(revision 63488)
+++ lib/Support/FoldingSet.cpp	(working copy)
@@ -61,6 +61,9 @@
    if ((uint64_t)(int)I != I)
      Bits.push_back(unsigned(I >> 32));
  }
+void FoldingSetNodeID::AddBoolean(bool B) {
+  AddInteger(B ? 1 : 0);
+}

"AddBoolean()" can just be defined inline, since it is so simple.

I've committed this change:

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090209/073619.html



More information about the llvm-dev mailing list