================
@@ -409,19 +412,26 @@ bool JSONCompilationDatabase::parse(std::string 
&ErrorMessage) {
       ErrorMessage = "Missing key: \"directory\".";
       return false;
     }
+    SmallString<8> DirectoryStorage;
+    SmallString<128> DirectoryPath(Directory->getValue(DirectoryStorage));
----------------
ArcsinX wrote:

nit: From my experience, in most cases `"directory"` value in 
`compile_commands.json` is the same for all records. So, here we do a heavy 
(relatively to 
[getRawValue](https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Support/YAMLParser.h#L229))
 call to 
[getValue](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/YAMLParser.cpp#L2032)
 and `DirectoryName` recalculation for every compile command.
Maybe we can keep previous values of `getRawValue` and `DirectoryName`, so if 
`getRawValue` is unchanged, we don't need to perform recalculate of 
`DirectoryName` and just use previous value?

https://github.com/llvm/llvm-project/pull/235400
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to