Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: src/IceTranslator.cpp

Issue 1281003003: Subzero: Fix a memory leak. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Use default instead of {} Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceTranslator.h ('k') | src/PNaClTranslator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTranslator.cpp - ICE to machine code ------*- C++ -*-===// 1 //===- subzero/src/IceTranslator.cpp - ICE to machine code ------*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
11 /// This file defines the general driver class for translating ICE to 11 /// This file defines the general driver class for translating ICE to
12 /// machine code. 12 /// machine code.
13 /// 13 ///
14 //===----------------------------------------------------------------------===// 14 //===----------------------------------------------------------------------===//
15 15
16 #include "IceTranslator.h" 16 #include "IceTranslator.h"
17 17
18 #include "IceCfg.h" 18 #include "IceCfg.h"
19 #include "IceClFlags.h" 19 #include "IceClFlags.h"
20 #include "IceDefs.h" 20 #include "IceDefs.h"
21 #include "IceGlobalInits.h" 21 #include "IceGlobalInits.h"
22 #include "IceTargetLowering.h" 22 #include "IceTargetLowering.h"
23 23
24 using namespace Ice; 24 using namespace Ice;
25 25
26 Translator::Translator(GlobalContext *Ctx) 26 Translator::Translator(GlobalContext *Ctx)
27 : Ctx(Ctx), NextSequenceNumber(GlobalContext::getFirstSequenceNumber()), 27 : Ctx(Ctx), NextSequenceNumber(GlobalContext::getFirstSequenceNumber()),
28 ErrorStatus() {} 28 ErrorStatus() {}
29 29
30 Translator::~Translator() = default;
31
32 IceString Translator::createUnnamedName(const IceString &Prefix, SizeT Index) { 30 IceString Translator::createUnnamedName(const IceString &Prefix, SizeT Index) {
33 if (Index == 0) 31 if (Index == 0)
34 return Prefix; 32 return Prefix;
35 std::string Buffer; 33 std::string Buffer;
36 llvm::raw_string_ostream StrBuf(Buffer); 34 llvm::raw_string_ostream StrBuf(Buffer);
37 StrBuf << Prefix << Index; 35 StrBuf << Prefix << Index;
38 return StrBuf.str(); 36 return StrBuf.str();
39 } 37 }
40 38
41 bool Translator::checkIfUnnamedNameSafe(const IceString &Name, const char *Kind, 39 bool Translator::checkIfUnnamedNameSafe(const IceString &Name, const char *Kind,
(...skipping 16 matching lines...) Expand all
58 void Translator::translateFcn(std::unique_ptr<Cfg> Func) { 56 void Translator::translateFcn(std::unique_ptr<Cfg> Func) {
59 Ctx->optQueueBlockingPush(std::move(Func)); 57 Ctx->optQueueBlockingPush(std::move(Func));
60 } 58 }
61 59
62 void Translator::lowerGlobals( 60 void Translator::lowerGlobals(
63 std::unique_ptr<VariableDeclarationList> VariableDeclarations) { 61 std::unique_ptr<VariableDeclarationList> VariableDeclarations) {
64 EmitterWorkItem *Item = new EmitterWorkItem(getNextSequenceNumber(), 62 EmitterWorkItem *Item = new EmitterWorkItem(getNextSequenceNumber(),
65 VariableDeclarations.release()); 63 VariableDeclarations.release());
66 Ctx->emitQueueBlockingPush(Item); 64 Ctx->emitQueueBlockingPush(Item);
67 } 65 }
OLDNEW
« no previous file with comments | « src/IceTranslator.h ('k') | src/PNaClTranslator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698