[clangd] Fix data race surfaced in clangd-tsan buildbot

We can have concurrent accesses to same PreambleData (e.g.
code-completion and ast-builds). Hence we need to
deep copy TargetOpts.

GitOrigin-RevId: aefad851672e6dd17592895066a39aa5b388e5db
diff --git a/clangd/Preamble.cpp b/clangd/Preamble.cpp
index d5818e0..ecd4901 100644
--- a/clangd/Preamble.cpp
+++ b/clangd/Preamble.cpp
@@ -918,7 +918,9 @@
   // no guarantees around using arbitrary options when reusing PCHs, and
   // different target opts can result in crashes, see
   // ParsedASTTest.PreambleWithDifferentTarget.
-  CI.TargetOpts = Baseline->TargetOpts;
+  // Make sure this is a deep copy, as the same Baseline might be used
+  // concurrently.
+  *CI.TargetOpts = *Baseline->TargetOpts;
 
   // No need to map an empty file.
   if (PatchContents.empty())