[clang] [analyzer][CTU] Macro expansions for imported translation units (PR #176126)
Vladimir Vuksanovic via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 27 07:23:30 PST 2026
================
@@ -186,14 +186,14 @@ class CrossTranslationUnitContext {
/// Emit diagnostics for the user for potential configuration errors.
void emitCrossTUDiagnostics(const IndexError &IE);
- /// Returns the MacroExpansionContext for the imported TU to which the given
- /// source-location corresponds.
- /// \p ToLoc Source location in the imported-to AST.
- /// \note If any error happens such as \p ToLoc is a non-imported
+ /// Returns the MacroExpansionContext for the imported TU and the location in
+ /// the imported-from AST to which the given source-location corresponds. \p
+ /// ToLoc Source location in the imported-to AST. \note If any error happens
+ /// such as \p ToLoc is a non-imported
/// source-location, empty is returned.
/// \note Macro expansion tracking for imported TUs is not implemented yet.
/// It returns empty unconditionally.
- std::optional<clang::MacroExpansionContext>
+ std::optional<std::pair<MacroExpansionContext, SourceLocation>>
----------------
vvuksanovic wrote:
It now also returns the corresponding `SourceLocation` in the 'imported from' context. The `MacroExpansionContext` for each TU contains locations in its original context, but this function receives 'imported to' `SourceLocation`s. The getters in `MacroExpansionContext` also expect to receive locations in the 'imported from' context, so they have to be translated somewhere.
I am not sure how this API was intended to be used
https://github.com/llvm/llvm-project/pull/176126
More information about the cfe-commits
mailing list