================
@@ -1927,19 +1927,15 @@ bool ASTReader::ReadSLocEntry(int ID) {
     unsigned RecCode = MaybeRecCode.get();
 
     if (RecCode == SM_SLOC_BUFFER_BLOB_COMPRESSED) {
-      // Inspect the first byte to differentiate zlib (\x78) and zstd
-      // (little-endian 0xFD2FB528).
-      const llvm::compression::Format F =
-          Blob.size() > 0 && Blob.data()[0] == 0x78
-              ? llvm::compression::Format::Zlib
-              : llvm::compression::Format::Zstd;
-      if (const char *Reason = llvm::compression::getReasonIfUnsupported(F)) {
+      ArrayRef<uint8_t> Compressed = llvm::arrayRefFromStringRef(Blob);
+      if (const char *Reason =
+              llvm::compression::getReasonIfUnsupported(Compressed)) {
         Error(Reason);
         return nullptr;
       }
----------------
jh7370 wrote:

Can't we just use the return from `decompress` here, since this `decompress` 
overload calls `getReasonIfUnsupported` and stuffs it into the `Error`? I think 
if this causes a slight change in the error message, that's fine (though I 
imagine it would mean fixing up a test or two).

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

Reply via email to