[llvm-commits] [llvm] r109212 - /llvm/trunk/include/llvm/ADT/StringSet.h
Chris Lattner
sabre at nondot.org
Thu Jul 22 20:21:53 PDT 2010
Author: lattner
Date: Thu Jul 22 22:21:53 2010
New Revision: 109212
URL: http://llvm.org/viewvc/llvm-project?rev=109212&view=rev
Log:
modernize stringset interface
Modified:
llvm/trunk/include/llvm/ADT/StringSet.h
Modified: llvm/trunk/include/llvm/ADT/StringSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringSet.h?rev=109212&r1=109211&r2=109212&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringSet.h (original)
+++ llvm/trunk/include/llvm/ADT/StringSet.h Thu Jul 22 22:21:53 2010
@@ -15,7 +15,6 @@
#define LLVM_ADT_STRINGSET_H
#include "llvm/ADT/StringMap.h"
-#include <cassert>
namespace llvm {
@@ -26,10 +25,10 @@
class StringSet : public llvm::StringMap<char, AllocatorTy> {
typedef llvm::StringMap<char, AllocatorTy> base;
public:
- bool insert(const std::string& InLang) {
+ bool insert(StringRef InLang) {
assert(!InLang.empty());
- const char* KeyStart = &InLang[0];
- const char* KeyEnd = KeyStart + InLang.size();
+ const char *KeyStart = InLang.data();
+ const char *KeyEnd = KeyStart + InLang.size();
return base::insert(llvm::StringMapEntry<char>::
Create(KeyStart, KeyEnd, base::getAllocator(), '+'));
}
More information about the llvm-commits
mailing list