Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.
llvm-svn: 222306
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 6991783..305dcd4 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -177,17 +177,11 @@
}
unsigned LineTableInfo::getLineTableFilenameID(StringRef Name) {
- // Look up the filename in the string table, returning the pre-existing value
- // if it exists.
- llvm::StringMapEntry<unsigned> &Entry =
- FilenameIDs.GetOrCreateValue(Name, ~0U);
- if (Entry.getValue() != ~0U)
- return Entry.getValue();
-
- // Otherwise, assign this the next available ID.
- Entry.setValue(FilenamesByID.size());
- FilenamesByID.push_back(&Entry);
- return FilenamesByID.size()-1;
+ auto IterBool =
+ FilenameIDs.insert(std::make_pair(Name, FilenamesByID.size()));
+ if (IterBool.second)
+ FilenamesByID.push_back(&*IterBool.first);
+ return IterBool.first->second;
}
/// AddLineNote - Add a line note to the line table that indicates that there