nridge added inline comments.
================ Comment at: clang-tools-extra/clangd/InlayHints.cpp:520 auto ExprStartLoc = SM.getTopMacroCallerLoc(E->getBeginLoc()); - auto Decomposed = SM.getDecomposedLoc(ExprStartLoc); + auto Decomposed = SM.getDecomposedExpansionLoc(ExprStartLoc); if (Decomposed.first != MainFileID) ---------------- I admit I struggle with this spelling/expansion loc stuff. But having spent a bit of time reading the implementations of these functions, would I be correct to say that another, perhaps easier to follow, way to express the same thing would be: ``` auto Decomposed = SM.getDecomposedLoc(SM.getFileLoc(E->getBeginLoc())); ``` ? ================ Comment at: clang-tools-extra/clangd/InlayHints.cpp:521 + auto Decomposed = SM.getDecomposedExpansionLoc(ExprStartLoc); if (Decomposed.first != MainFileID) return false; ---------------- zyounan wrote: > stupid question: I was suspicious with this check that when would > `Decomposed.first` not being the same as MainFileID? Should the "top-caller" > of the macro always be in main file? I didn't find a case that differs, > except when `getDecomposedLoc` provides wrong FileID. I tried adding an assertion in this early-return branch, and it tripped in `ParameterHints.IncludeAtNonGlobalScope`. The code there is: ``` Annotations FooInc(R"cpp( void bar() { foo(42); } )cpp"); Annotations FooCC(R"cpp( struct S { void foo(int param); #include "foo.inc" }; )cpp"); ``` so I guess the decomposed loc there is a file loc, but not in the main file (but rather in `foo.inc`). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D144074/new/ https://reviews.llvm.org/D144074 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits