whisperity added inline comments.

================
Comment at: 
clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp:87-88
     const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) 
{
-    PP->addPPCallbacks(
-        ::std::make_unique<IncludeModernizePPCallbacks>(*this, getLangOpts()));
+  PP->addPPCallbacks(::std::make_unique<detail::IncludeModernizePPCallbacks>(
+      *this, getLangOpts(), PP->getSourceManager()));
+}
----------------
steakhal wrote:
> whisperity wrote:
> > (🔮: Same here. Is this state that might keep a dangling reference if 
> > multiple TUs are consumed in sequence?)
> How can I acquire the right `SourceManager` if not like this?
> I haven't found any alternative.
> What do you suggest?
Is the `PP` a different variable when a new translation unit is consumed by the 
same check instance? If so, then there is no problem. A simple debug print 
`llvm::errs() << PP << '\n';`, recompile, re-run with `clang-tidy a.cpp b.cpp` 
should show how the infrastructure behaves. I do not know the exact behaviour 
of the preprocessor layer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125209

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to