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 19namespace llvm { 20 21 /// StringSet - A wrapper for StringMap that provides set-like functionality. 22 template <class AllocatorTy = llvm::MallocAllocator> 23 class StringSet : public llvm::StringMap<char, AllocatorTy> { 24 typedef llvm::StringMap<char, AllocatorTy> base; 25 public: 26 27 std::pair<typename base::iterator, bool> insert(StringRef Key) { 28 assert(!Key.empty()); 29 return base::insert(std::make_pair(Key, '\0')); 30 } 31 }; 32} 33 34#endif // LLVM_ADT_STRINGSET_H 35