mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Use StringMap in EditorDiagConsumer
As noted by the comment, storing a `StringRef` is indeed brittle. Update to use a StringMap. rdar://111589090
This commit is contained in:
@@ -91,10 +91,6 @@ BufferInfoSharedPtr
|
||||
EditorDiagConsumer::getBufferInfo(StringRef FileName,
|
||||
llvm::Optional<unsigned> BufferID,
|
||||
swift::SourceManager &SM) {
|
||||
// NOTE: Using StringRef as a key here relies on SourceMgr using const char*
|
||||
// as buffer identifiers. This is fast, but may be brittle. We can always
|
||||
// switch over to using a StringMap. Note that the logic in
|
||||
// SerializedDiagnosticConsumer::getEmitFile will also need changing.
|
||||
auto Result = BufferInfos.find(FileName);
|
||||
if (Result != BufferInfos.end())
|
||||
return Result->second;
|
||||
|
||||
Reference in New Issue
Block a user