[clang] bc847b3 - [cc1as] Close MCAsmParser before MCStreamer

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 2 15:57:05 PST 2020


Author: Fangrui Song
Date: 2020-11-02T15:56:57-08:00
New Revision: bc847b31435e48ad0e54b322a716a4b9f07bc232

URL: https://github.com/llvm/llvm-project/commit/bc847b31435e48ad0e54b322a716a4b9f07bc232
DIFF: https://github.com/llvm/llvm-project/commit/bc847b31435e48ad0e54b322a716a4b9f07bc232.diff

LOG: [cc1as] Close MCAsmParser before MCStreamer

This is a pre-existing problem exposed by D90511 (asan failurs with
clang/test/Driver/relax.s and a few other tests).

Added: 
    

Modified: 
    clang/tools/driver/cc1as_main.cpp

Removed: 
    


################################################################################
diff  --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index 6839b2eee016..07dddc6dc85b 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -520,8 +520,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts,
     Failed = Parser->Run(Opts.NoInitialTextSection);
   }
 
-  // Close Streamer first.
-  // It might have a reference to the output stream.
+  // Parser has a reference to the output stream (Str), so close Parser first.
+  Parser.reset();
   Str.reset();
   // Close the output stream early.
   BOS.reset();


        


More information about the cfe-commits mailing list