2008-05-13 15:03:16 +00:00
|
|
|
//===--- StringSet.h - The LLVM Compiler Driver -----------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open
|
|
|
|
// Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// StringSet - A set-like wrapper for the StringMap.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_ADT_STRINGSET_H
|
|
|
|
#define LLVM_ADT_STRINGSET_H
|
|
|
|
|
|
|
|
#include "llvm/ADT/StringMap.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2013-03-15 20:16:59 +00:00
|
|
|
/// StringSet - A wrapper for StringMap that provides set-like functionality.
|
2008-05-13 15:03:16 +00:00
|
|
|
template <class AllocatorTy = llvm::MallocAllocator>
|
|
|
|
class StringSet : public llvm::StringMap<char, AllocatorTy> {
|
|
|
|
typedef llvm::StringMap<char, AllocatorTy> base;
|
|
|
|
public:
|
2013-03-15 20:16:59 +00:00
|
|
|
|
2014-11-19 02:56:00 +00:00
|
|
|
std::pair<typename base::iterator, bool> insert(StringRef Key) {
|
2013-03-15 20:16:59 +00:00
|
|
|
assert(!Key.empty());
|
2014-11-19 02:56:00 +00:00
|
|
|
return base::insert(std::make_pair(Key, '\0'));
|
2008-05-13 15:03:16 +00:00
|
|
|
}
|
|
|
|
};
|
2015-06-23 09:49:53 +00:00
|
|
|
}
|
2008-05-13 15:03:16 +00:00
|
|
|
|
|
|
|
#endif // LLVM_ADT_STRINGSET_H
|