[PATCH] D93222: [RFC][analyzer] Introduce MacroExpansionContext to libAnalysis
Whisperity via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 16 04:12:39 PST 2020
whisperity added inline comments.
================
Comment at: clang/lib/Analysis/MacroExpansionContext.cpp:22
+ : PP(PP), SM(PP.getSourceManager()), LangOpts(LangOpts) {
+ class MacroExpansionRangeRecorder : public PPCallbacks {
+ const Preprocessor &PP;
----------------
xazax.hun wrote:
> steakhal wrote:
> > xazax.hun wrote:
> > > It may be more idiomatic to put classes in an anonymous namespace rather than expanding them in a method.
> > I tried, but I could not hide the `MacroExpansionRangeRecorder` class as a detail.
> > https://godbolt.org/z/bcYK7x
> > Let me know if there is a better way to hide details.
> I don't see any problems with the code you linked. What do you mean by could not hide it better? I think, it is very common to have utility functions with the current file as the visibility.
@steakhal You need to forward declare the class in the detail namespace first **within the header** (so both the namespace and the qualified name `detail::Class` is introduced), and then the `friend class` declaration works as intended, see: https://godbolt.org/z/hs45ze
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93222/new/
https://reviews.llvm.org/D93222
More information about the cfe-commits
mailing list