| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "courgette/program_detector.h" | 5 #include "courgette/program_detector.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "courgette/assembly_program.h" | 9 #include "courgette/assembly_program.h" |
| 10 #include "courgette/disassembler.h" | 10 #include "courgette/disassembler.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 DetectDisassembler(buffer, length)); | 71 DetectDisassembler(buffer, length)); |
| 72 if (!disassembler) | 72 if (!disassembler) |
| 73 return C_INPUT_NOT_RECOGNIZED; | 73 return C_INPUT_NOT_RECOGNIZED; |
| 74 | 74 |
| 75 std::unique_ptr<AssemblyProgram> program( | 75 std::unique_ptr<AssemblyProgram> program( |
| 76 new AssemblyProgram(disassembler->kind())); | 76 new AssemblyProgram(disassembler->kind())); |
| 77 | 77 |
| 78 if (!disassembler->Disassemble(program.get())) | 78 if (!disassembler->Disassemble(program.get())) |
| 79 return C_DISASSEMBLY_FAILED; | 79 return C_DISASSEMBLY_FAILED; |
| 80 | 80 |
| 81 if (!program->TrimLabels()) | |
| 82 return C_TRIM_FAILED; | |
| 83 | |
| 84 *output = std::move(program); | 81 *output = std::move(program); |
| 85 return C_OK; | 82 return C_OK; |
| 86 } | 83 } |
| 87 | 84 |
| 88 } // namespace courgette | 85 } // namespace courgette |
| OLD | NEW |