[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:32 PST 2026


================
@@ -577,10 +597,19 @@ CrossTranslationUnitContext::ASTLoader::loadFromDump(StringRef ASTDumpPath) {
       new TextDiagnosticPrinter(llvm::errs(), *DiagOpts);
   auto Diags = llvm::makeIntrusiveRefCnt<DiagnosticsEngine>(
       DiagnosticIDs::create(), *DiagOpts, DiagClient);
-  return ASTUnit::LoadFromASTFile(
+  auto Unit = ASTUnit::LoadFromASTFile(
       ASTDumpPath, CI.getPCHContainerOperations()->getRawReader(),
       ASTUnit::LoadEverything, CI.getVirtualFileSystemPtr(), DiagOpts, Diags,
       CI.getFileSystemOpts(), CI.getHeaderSearchOpts());
+
+  std::unique_ptr<MacroExpansionContext> MacroExpansions;
+  if (Unit) {
+    MacroExpansions.reset(new MacroExpansionContext(
----------------
steakhal wrote:

Why not `make_unique` here?

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


More information about the cfe-commits mailing list