aaron.ballman added inline comments.
================ Comment at: clang/lib/Basic/SourceManager.cpp:882-884 const SrcMgr::SLocEntry &E = getLoadedSLocEntry(I); + if (E.getOffset() == 0) + return FileID(); // invalid entry. ---------------- ivanmurashko wrote: > aaron.ballman wrote: > > This looks incorrect to me -- I don't think an offset of `0` is invalid. I > > think a better way to do this is: > > ``` > > bool Invalid; > > const SrcMgr::SLocEntry &E = getLoadedSLocEntry(I, &Invalid); > > if (Invalid) > > return FileID(); // Invalid entry. > > ``` > That's reasonable, do we want to update other places at the function as well > (line 903 for instance)? Assuming my idea works the way I think it will, yes, I think that's a good idea. :-) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130847/new/ https://reviews.llvm.org/D130847 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits