Skip to content
Snippets Groups Projects
Commit f07838d7 authored by Steven Wu's avatar Steven Wu
Browse files

Fix the cc1as crash when it outputs assembly

In clang cc1as_main, when the output file type is “asm”, AsmStreamer
owns a formatted_raw_ostream which has a reference to FDOS
(raw_ostream), so AsmStreamer must be closed before FDOS is closed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243085 91177308-0d34-0410-b5e6-96231b3b80d8
parent 3c880489
No related branches found
No related tags found
No related merge requests found
// Run cc1as asm output path just to make sure it works
// REQUIRES: x86-registered-target
// RUN: %clang -cc1as -triple x86_64-apple-macosx10.10.0 -filetype asm %s -o /dev/null
......@@ -406,6 +406,9 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts,
Failed = Parser->Run(Opts.NoInitialTextSection);
}
// Close Streamer first.
// It might have a reference to the output stream.
Str.reset();
// Close the output stream early.
BOS.reset();
FDOS.reset();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment