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

Side by Side Diff: src/IceGlobalInits.cpp

Issue 877003003: Subzero: Use a "known" version of clang-format. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add a clang-format blacklist. Fix formatting "errors". Created 5 years, 10 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/IceGlobalInits.h ('k') | src/IceInst.cpp » ('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/IceGlobalInits.cpp - Global declarations ---------------===// 1 //===- subzero/src/IceGlobalInits.cpp - Global declarations ---------------===//
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 // This file implements the notion of function declarations, global 10 // This file implements the notion of function declarations, global
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 Init->dumpType(Stream); 117 Init->dumpType(Stream);
118 } 118 }
119 Stream << " }>"; 119 Stream << " }>";
120 } 120 }
121 } 121 }
122 122
123 void VariableDeclaration::dump(GlobalContext *Ctx, Ostream &Stream) const { 123 void VariableDeclaration::dump(GlobalContext *Ctx, Ostream &Stream) const {
124 if (!ALLOW_DUMP) 124 if (!ALLOW_DUMP)
125 return; 125 return;
126 Stream << "@" << ((Ctx && !getSuppressMangling()) 126 Stream << "@"
127 ? Ctx->mangleName(Name) : Name) << " = "; 127 << ((Ctx && !getSuppressMangling()) ? Ctx->mangleName(Name) : Name)
128 << " = ";
128 ::dumpLinkage(Stream, Linkage); 129 ::dumpLinkage(Stream, Linkage);
129 Stream << " " << (IsConstant ? "constant" : "global") << " "; 130 Stream << " " << (IsConstant ? "constant" : "global") << " ";
130 131
131 // Add initializer. 132 // Add initializer.
132 if (Initializers.size() == 1) { 133 if (Initializers.size() == 1) {
133 Initializers.front()->dump(Stream); 134 Initializers.front()->dump(Stream);
134 } else { 135 } else {
135 dumpType(Stream); 136 dumpType(Stream);
136 Stream << " <{ "; 137 Stream << " <{ ";
137 bool IsFirst = true; 138 bool IsFirst = true;
(...skipping 13 matching lines...) Expand all
151 Stream << ", align " << Alignment; 152 Stream << ", align " << Alignment;
152 Stream << "\n"; 153 Stream << "\n";
153 } 154 }
154 155
155 void VariableDeclaration::Initializer::dumpType(Ostream &Stream) const { 156 void VariableDeclaration::Initializer::dumpType(Ostream &Stream) const {
156 if (!ALLOW_DUMP) 157 if (!ALLOW_DUMP)
157 return; 158 return;
158 Stream << "[" << getNumBytes() << " x " << Ice::IceType_i8 << "]"; 159 Stream << "[" << getNumBytes() << " x " << Ice::IceType_i8 << "]";
159 } 160 }
160 161
161 void VariableDeclaration::DataInitializer::dump( 162 void VariableDeclaration::DataInitializer::dump(GlobalContext *,
162 GlobalContext *, Ostream &Stream) const { 163 Ostream &Stream) const {
163 if (!ALLOW_DUMP) 164 if (!ALLOW_DUMP)
164 return; 165 return;
165 dumpType(Stream); 166 dumpType(Stream);
166 Stream << " c\""; 167 Stream << " c\"";
167 // Code taken from PrintEscapedString() in AsmWriter.cpp. Keep 168 // Code taken from PrintEscapedString() in AsmWriter.cpp. Keep
168 // the strings in the same format as the .ll file for practical 169 // the strings in the same format as the .ll file for practical
169 // diffing. 170 // diffing.
170 for (uint8_t C : Contents) { 171 for (uint8_t C : Contents) {
171 if (isprint(C) && C != '\\' && C != '"') 172 if (isprint(C) && C != '\\' && C != '"')
172 Stream << C; 173 Stream << C;
173 else 174 else
174 Stream << '\\' << hexdigit(C >> 4) << hexdigit(C & 0x0F); 175 Stream << '\\' << hexdigit(C >> 4) << hexdigit(C & 0x0F);
175 } 176 }
176 Stream << "\""; 177 Stream << "\"";
177 } 178 }
178 179
179 void VariableDeclaration::ZeroInitializer::dump( 180 void VariableDeclaration::ZeroInitializer::dump(GlobalContext *,
180 GlobalContext *, Ostream &Stream) const { 181 Ostream &Stream) const {
181 if (!ALLOW_DUMP) 182 if (!ALLOW_DUMP)
182 return; 183 return;
183 dumpType(Stream); 184 dumpType(Stream);
184 Stream << " zeroinitializer"; 185 Stream << " zeroinitializer";
185 } 186 }
186 187
187 void VariableDeclaration::RelocInitializer::dumpType(Ostream &Stream) const { 188 void VariableDeclaration::RelocInitializer::dumpType(Ostream &Stream) const {
188 if (!ALLOW_DUMP) 189 if (!ALLOW_DUMP)
189 return; 190 return;
190 Stream << Ice::IceType_i32; 191 Stream << Ice::IceType_i32;
191 } 192 }
192 193
193 void VariableDeclaration::RelocInitializer::dump( 194 void VariableDeclaration::RelocInitializer::dump(GlobalContext *Ctx,
194 GlobalContext *Ctx, Ostream &Stream) const { 195 Ostream &Stream) const {
195 if (!ALLOW_DUMP) 196 if (!ALLOW_DUMP)
196 return; 197 return;
197 if (Offset != 0) { 198 if (Offset != 0) {
198 dumpType(Stream); 199 dumpType(Stream);
199 Stream << " add ("; 200 Stream << " add (";
200 } 201 }
201 dumpType(Stream); 202 dumpType(Stream);
202 Stream << " ptrtoint ("; 203 Stream << " ptrtoint (";
203 Declaration->dumpType(Stream); 204 Declaration->dumpType(Stream);
204 Stream << "* @"; 205 Stream << "* @";
205 if (Ctx) 206 if (Ctx)
206 Stream << Ctx->mangleName(Declaration->getName()); 207 Stream << Ctx->mangleName(Declaration->getName());
207 else 208 else
208 Stream << Declaration->getName(); 209 Stream << Declaration->getName();
209 Stream << " to "; 210 Stream << " to ";
210 dumpType(Stream); 211 dumpType(Stream);
211 Stream << ")"; 212 Stream << ")";
212 if (Offset != 0) { 213 if (Offset != 0) {
213 Stream << ", "; 214 Stream << ", ";
214 dumpType(Stream); 215 dumpType(Stream);
215 Stream << " " << Offset << ")"; 216 Stream << " " << Offset << ")";
216 } 217 }
217 } 218 }
218 219
219 } // end of namespace Ice 220 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceGlobalInits.h ('k') | src/IceInst.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698