dexonsmith accepted this revision. dexonsmith added a comment. This revision is now accepted and ready to land.
LGTM. ================ Comment at: clang/lib/Analysis/PathDiagnostic.cpp:1088 + ID.Add(Range.getEnd()); + ID.Add(static_cast<const SourceLocation &>(Loc)); } ---------------- miyuki wrote: > dexonsmith wrote: > > I'm surprised you need this `static_cast`, can you explain why it was > > necessary? > `Loc` is an object of type `FullSourceLoc`, a class derived from > `SourceLocation`. When the `FoldingSetNodeID::Add` template method is called > with `Loc` it tries to instantiate `FoldingSetTrait<FullSourceLoc>` and fails > (because there is no explicit specialization for `FullSourceLoc` and the > default one relies on the method `FullSourceLoc::Profile` which does not > exist). `FullSourceLoc` does not contain any additional information about the > location itself (it just holds a pointer to the associated `SourceManager`), > so there is no need to specialize `FoldingSetTrait` for it, and casting to > `SourceLocation` will make `FoldingSetNodeID::Add` use the correct > `FoldingSetTrait` specialization. Right, that makes sense. Thanks for explaining! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69844/new/ https://reviews.llvm.org/D69844 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits