[clang] Update Clang.cpp (PR #77882)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 11 23:20:17 PST 2024


https://github.com/hw-1 created https://github.com/llvm/llvm-project/pull/77882

fix error: .gch' was ignored because it is not a clang PCH file   https://github.com/llvm/llvm-project/issues/76923

>From d3735b032f8d482b8f362e827f412a26d9121c1d Mon Sep 17 00:00:00 2001
From: hw-1 <8053554+hw-1 at users.noreply.github.com>
Date: Fri, 12 Jan 2024 15:19:49 +0800
Subject: [PATCH] Update Clang.cpp

fix error: .gch' was ignored because it is not a clang PCH file   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 1ee7ae602f3ce5..2c35b9b84ac959 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().contains("CPCH");
   return false;
 }
 



More information about the cfe-commits mailing list