https://github.com/hw-1 created https://github.com/llvm/llvm-project/pull/77031
fix bug with PCH check failed, detail with https://github.com/llvm/llvm-project/issues/76923 >From 50e69eac786a646491e278478bb096e361d6c4c1 Mon Sep 17 00:00:00 2001 From: hw-1 <8053554+h...@users.noreply.github.com> Date: Fri, 5 Jan 2024 09:15:52 +0800 Subject: [PATCH] Update Clang.cpp fix bug with PCH check failed, detail with https://github.com/llvm/llvm-project/issues/76923 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 2d8ef841d4f6be..bb8b496dbfe5fc 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -951,7 +951,7 @@ static void handleAMDGPUCodeObjectVersionOptions(const Driver &D, static bool hasClangPchSignature(const Driver &D, StringRef Path) { if (llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> MemBuf = D.getVFS().getBufferForFile(Path)) - return (*MemBuf)->getBuffer().starts_with("CPCH"); + return (*MemBuf)->getBuffer().substr(0x500,-1).starts_with("CPCH"); return false; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits