[PATCH] D89580: SourceManager: Fix an SLocEntry memory regression introduced with FileEntryRef

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 23 09:45:03 PDT 2020


dexonsmith planned changes to this revision.
dexonsmith added inline comments.


================
Comment at: clang/include/clang/Basic/SourceManager.h:293
       X.ContentAndKind.setInt(FileCharacter);
-      X.Filename = Filename;
+      const_cast<ContentCache &>(Con).Filename = Filename;
       return X;
----------------
JDevlieghere wrote:
> Would it possibly make more sense to drop the `const` qualifier from the argument? 
Yes, that's probably better. I'll make a prep commit that changes `getOrCreateContentCache()` to return non-`const` and thread that through to here, and then this is just `Con.Filename = Filename`.


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

https://reviews.llvm.org/D89580



More information about the cfe-commits mailing list