[PATCH] D79426: [clangd] Change PreambleOnlyAction with content truncation

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 25 05:19:28 PDT 2020


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/Preamble.cpp:125
   auto ContentsBuffer = llvm::MemoryBuffer::getMemBuffer(Contents);
+  auto Bounds =
+      ComputePreambleBounds(*CI->getLangOpts(), ContentsBuffer.get(), 0);
----------------
Maybe add a comment here:
```
// This means we're scanning (though not preprocessing) the preamble section twice.
// However, it's important to precisely follow the preamble bounds used elsewhere.
```

This guards somewhat against someone sending the reverse patch. Chesterton's fence etc.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79426/new/

https://reviews.llvm.org/D79426





More information about the cfe-commits mailing list