CppHashInfo.Filename is a StringRef that references a part of the source file and it is not null-terminated at the end of the file name. AsmParser::parseAndMatchAndEmitTargetInstruction() passes it to getStreamer().emitDwarfFileDirective(), and it eventually comes to isRootFile(). The comparison fails because FileName.data() is not properly terminated.
In addition, the old code might cause a significant speed degradation for long source files. The operator!=() for std::string and const char * can be implemented in a way that it finds the length of the second argument first, which slows the comparison for long data. parseAndMatchAndEmitTargetInstruction() calls emitDwarfFileDirective() every time if CppHashInfo.Filename is not empty. As a result, the longer the source file is, the slower compilation wend, and for a very long file, it might take hours instead of a couple of seconds normally.