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

Side by Side Diff: src/IceELFSection.h

Issue 1343843003: Refactor all instances of `typedef y x` to the C++11 `using x = y` syntax. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 3 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/IceELFObjectWriter.h ('k') | src/IceFixups.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/IceELFSection.h - Model of ELF sections ------*- C++ -*-===// 1 //===- subzero/src/IceELFSection.h - Model of ELF sections ------*- 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
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 size_t getNumLocals() const { return LocalSymbols.size(); } 194 size_t getNumLocals() const { return LocalSymbols.size(); }
195 195
196 void updateIndices(const ELFStringTableSection *StrTab); 196 void updateIndices(const ELFStringTableSection *StrTab);
197 197
198 void writeData(ELFStreamer &Str, bool IsELF64); 198 void writeData(ELFStreamer &Str, bool IsELF64);
199 199
200 private: 200 private:
201 // Map from symbol name to its symbol information. 201 // Map from symbol name to its symbol information.
202 // This assumes symbols are unique across all sections. 202 // This assumes symbols are unique across all sections.
203 typedef IceString SymtabKey; 203 using SymtabKey = IceString;
204 typedef std::map<SymtabKey, ELFSym> SymMap; 204 using SymMap = std::map<SymtabKey, ELFSym>;
205 205
206 template <bool IsELF64> 206 template <bool IsELF64>
207 void writeSymbolMap(ELFStreamer &Str, const SymMap &Map); 207 void writeSymbolMap(ELFStreamer &Str, const SymMap &Map);
208 208
209 const ELFSym *NullSymbol; 209 const ELFSym *NullSymbol;
210 // Keep Local and Global symbols separate, since the sh_info needs to 210 // Keep Local and Global symbols separate, since the sh_info needs to
211 // know the index of the last LOCAL. 211 // know the index of the last LOCAL.
212 SymMap LocalSymbols; 212 SymMap LocalSymbols;
213 SymMap GlobalSymbols; 213 SymMap GlobalSymbols;
214 }; 214 };
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 /// Strings can share a string table entry if they share the same 293 /// Strings can share a string table entry if they share the same
294 /// suffix. E.g., "pop" and "lollipop" can both use the characters 294 /// suffix. E.g., "pop" and "lollipop" can both use the characters
295 /// in "lollipop", but "pops" cannot, and "unpop" cannot either. 295 /// in "lollipop", but "pops" cannot, and "unpop" cannot either.
296 /// Though, "pop", "lollipop", and "unpop" share "pop" as the suffix, 296 /// Though, "pop", "lollipop", and "unpop" share "pop" as the suffix,
297 /// "pop" can only share the characters with one of them. 297 /// "pop" can only share the characters with one of them.
298 struct SuffixComparator { 298 struct SuffixComparator {
299 bool operator()(const IceString &StrA, const IceString &StrB) const; 299 bool operator()(const IceString &StrA, const IceString &StrB) const;
300 }; 300 };
301 301
302 typedef std::map<IceString, size_t, SuffixComparator> StringToIndexType; 302 using StringToIndexType = std::map<IceString, size_t, SuffixComparator>;
303 303
304 /// Track strings to their index. Index will be UnknownIndex if not 304 /// Track strings to their index. Index will be UnknownIndex if not
305 /// yet laid out. 305 /// yet laid out.
306 StringToIndexType StringToIndexMap; 306 StringToIndexType StringToIndexMap;
307 307
308 typedef std::vector<uint8_t> RawDataType; 308 using RawDataType = std::vector<uint8_t>;
309 RawDataType StringData; 309 RawDataType StringData;
310 }; 310 };
311 311
312 template <bool IsELF64> void ELFSection::writeHeader(ELFStreamer &Str) { 312 template <bool IsELF64> void ELFSection::writeHeader(ELFStreamer &Str) {
313 Str.writeELFWord<IsELF64>(Header.sh_name); 313 Str.writeELFWord<IsELF64>(Header.sh_name);
314 Str.writeELFWord<IsELF64>(Header.sh_type); 314 Str.writeELFWord<IsELF64>(Header.sh_type);
315 Str.writeELFXword<IsELF64>(Header.sh_flags); 315 Str.writeELFXword<IsELF64>(Header.sh_flags);
316 Str.writeAddrOrOffset<IsELF64>(Header.sh_addr); 316 Str.writeAddrOrOffset<IsELF64>(Header.sh_addr);
317 Str.writeAddrOrOffset<IsELF64>(Header.sh_offset); 317 Str.writeAddrOrOffset<IsELF64>(Header.sh_offset);
318 Str.writeELFXword<IsELF64>(Header.sh_size); 318 Str.writeELFXword<IsELF64>(Header.sh_size);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 Rel.setSymbolAndType(Symbol->getNumber(), Fixup.kind()); 376 Rel.setSymbolAndType(Symbol->getNumber(), Fixup.kind());
377 Str.writeAddrOrOffset<IsELF64>(Rel.r_offset); 377 Str.writeAddrOrOffset<IsELF64>(Rel.r_offset);
378 Str.writeELFWord<IsELF64>(Rel.r_info); 378 Str.writeELFWord<IsELF64>(Rel.r_info);
379 } 379 }
380 } 380 }
381 } 381 }
382 382
383 } // end of namespace Ice 383 } // end of namespace Ice
384 384
385 #endif // SUBZERO_SRC_ICEELFSECTION_H 385 #endif // SUBZERO_SRC_ICEELFSECTION_H
OLDNEW
« no previous file with comments | « src/IceELFObjectWriter.h ('k') | src/IceFixups.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698