[PATCH] D89554: SourceManager: Clarify that FileInfo always has a ContentCache, NFC

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 21 14:01:02 PDT 2020


dexonsmith added inline comments.


================
Comment at: clang/lib/Basic/SourceManager.cpp:1684
     bool MyInvalid = false;
     ComputeLineNumbers(Diag, Content, ContentCacheAlloc, *this, MyInvalid);
     if (MyInvalid)
----------------
shafik wrote:
> Is the `const_cast` just for this line? Maybe we can localize the cast to this line then?
Good idea, or we could sink it into `ComputeLineNumbers`, or we could make `NumLines` and `SourceLineCache` `mutable`.

In any case I don't want to make this patch more noisy (it's unrelated to this change, the `const_cast` was already here), but I'll write a follow up patch to clean this up.


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

https://reviews.llvm.org/D89554



More information about the cfe-commits mailing list