[flang-commits] [flang] [flang][test] Fix ASAN error in unit tests (PR #218917)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Thu Aug 27 05:44:54 PDT 2026


================
@@ -33,11 +33,12 @@
 
 using namespace Fortran::frontend;
 
-CompilerInstance::CompilerInstance()
-    : invocation(new CompilerInvocation()),
-      allSources(new Fortran::parser::AllSources()),
+CompilerInstance::CompilerInstance(
+    std::shared_ptr<CompilerInvocation> invocation)
+    : invocation(invocation), allSources(new Fortran::parser::AllSources()),
----------------
eugeneepshteyn wrote:

Since this parameter is passed by value, could we initialize the member with invocation(std::move(invocation))? That matches the cited Clang change and avoids a shared_ptr reference-count increment/decrement.

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


More information about the flang-commits mailing list