]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - contrib/llvm/include/llvm/ADT/StringSet.h
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / contrib / llvm / include / llvm / ADT / StringSet.h
1 //===--- StringSet.h - The LLVM Compiler Driver -----------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open
6 // Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  StringSet - A set-like wrapper for the StringMap.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_ADT_STRINGSET_H
15 #define LLVM_ADT_STRINGSET_H
16
17 #include "llvm/ADT/StringMap.h"
18
19 namespace llvm {
20
21   /// StringSet - A wrapper for StringMap that provides set-like
22   /// functionality.  Only insert() and count() methods are used by my
23   /// code.
24   template <class AllocatorTy = llvm::MallocAllocator>
25   class StringSet : public llvm::StringMap<char, AllocatorTy> {
26     typedef llvm::StringMap<char, AllocatorTy> base;
27   public:
28     bool insert(StringRef InLang) {
29       assert(!InLang.empty());
30       const char *KeyStart = InLang.data();
31       const char *KeyEnd = KeyStart + InLang.size();
32       return base::insert(llvm::StringMapEntry<char>::
33                           Create(KeyStart, KeyEnd, base::getAllocator(), '+'));
34     }
35   };
36 }
37
38 #endif // LLVM_ADT_STRINGSET_H