[clang] [analyzer][CTU] Macro expansions for imported translation units (PR #176126)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 26 07:09:33 PST 2026


================
@@ -1157,6 +1157,12 @@ SourceRange cxcursor::MacroExpansionCursor::getSourceRange() const {
     return getPseudoLoc();
   return getAsMacroExpansion()->getSourceRange();
 }
+std::optional<std::string>
+cxcursor::MacroExpansionCursor::getExpandedText() const {
+  if (isPseudo())
+    return std::nullopt;
+  return getAsMacroExpansion()->getExpandedText();
+}
----------------
steakhal wrote:

Do we need to extend `libclang`? Exposing this makes me uncomfortable. `libclang` should be stable, but we don't offer any sort of stability for the expanded texts.

https://github.com/llvm/llvm-project/pull/176126


More information about the cfe-commits mailing list