X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FADT%2FStringSet.h;h=3e0cc200b6dda62125010288f5e0c264f697460d;hb=36013dd6a10ace0459bd9a2623cdb548b58be1d1;hp=7bea577f34d33f411f592d15b8be050d119d4441;hpb=dfe91cefd25614bc9ac1626d67df4d5ad5d3553f;p=oota-llvm.git diff --git a/include/llvm/ADT/StringSet.h b/include/llvm/ADT/StringSet.h index 7bea577f34d..3e0cc200b6d 100644 --- a/include/llvm/ADT/StringSet.h +++ b/include/llvm/ADT/StringSet.h @@ -24,20 +24,9 @@ namespace llvm { typedef llvm::StringMap base; public: - /// insert - Insert the specified key into the set. If the key already - /// exists in the set, return false and ignore the request, otherwise insert - /// it and return true. - bool insert(StringRef Key) { - // Get or create the map entry for the key; if it doesn't exist the value - // type will be default constructed which we use to detect insert. - // - // We use '+' as the sentinel value in the map. + std::pair insert(StringRef Key) { assert(!Key.empty()); - StringMapEntry &Entry = this->GetOrCreateValue(Key); - if (Entry.getValue() == '+') - return false; - Entry.setValue('+'); - return true; + return base::insert(std::make_pair(Key, '\0')); } }; }