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

Side by Side Diff: src/PNaClTranslator.cpp

Issue 1221643012: Subzero: Add -Wshadow to the build. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Change the previous underscore naming style Created 5 years, 5 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
OLDNEW
1 //===- subzero/src/PNaClTranslator.cpp - ICE from bitcode -----------------===// 1 //===- subzero/src/PNaClTranslator.cpp - ICE from bitcode -----------------===//
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 PNaCl bitcode file to Ice, to machine code 10 // This file implements the PNaCl bitcode file to Ice, to machine code
11 // translator. 11 // translator.
12 // 12 //
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #include "PNaClTranslator.h" 15 #include "PNaClTranslator.h"
16 16
17 #include "IceAPInt.h" 17 #include "IceAPInt.h"
18 #include "IceAPFloat.h" 18 #include "IceAPFloat.h"
19 #include "IceCfg.h" 19 #include "IceCfg.h"
20 #include "IceCfgNode.h" 20 #include "IceCfgNode.h"
21 #include "IceClFlags.h" 21 #include "IceClFlags.h"
22 #include "IceDefs.h" 22 #include "IceDefs.h"
23 #include "IceGlobalInits.h" 23 #include "IceGlobalInits.h"
24 #include "IceInst.h" 24 #include "IceInst.h"
25 #include "IceOperand.h" 25 #include "IceOperand.h"
26 26
27 #pragma clang diagnostic push 27 #pragma clang diagnostic push
28 #pragma clang diagnostic ignored "-Wunused-parameter" 28 #pragma clang diagnostic ignored "-Wunused-parameter"
29 #pragma clang diagnostic ignored "-Wshadow"
29 #include "llvm/ADT/SmallString.h" 30 #include "llvm/ADT/SmallString.h"
30 #include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h" 31 #include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h"
31 #include "llvm/Bitcode/NaCl/NaClBitcodeDefs.h" 32 #include "llvm/Bitcode/NaCl/NaClBitcodeDefs.h"
32 #include "llvm/Bitcode/NaCl/NaClBitcodeHeader.h" 33 #include "llvm/Bitcode/NaCl/NaClBitcodeHeader.h"
33 #include "llvm/Bitcode/NaCl/NaClBitcodeParser.h" 34 #include "llvm/Bitcode/NaCl/NaClBitcodeParser.h"
34 #include "llvm/Bitcode/NaCl/NaClReaderWriter.h" 35 #include "llvm/Bitcode/NaCl/NaClReaderWriter.h"
35 #include "llvm/Support/Format.h" 36 #include "llvm/Support/Format.h"
36 #include "llvm/Support/MemoryBuffer.h" 37 #include "llvm/Support/MemoryBuffer.h"
37 #include "llvm/Support/raw_ostream.h" 38 #include "llvm/Support/raw_ostream.h"
38 #pragma clang diagnostic pop 39 #pragma clang diagnostic pop
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 161
161 // Top-level class to read PNaCl bitcode files, and translate to ICE. 162 // Top-level class to read PNaCl bitcode files, and translate to ICE.
162 class TopLevelParser : public NaClBitcodeParser { 163 class TopLevelParser : public NaClBitcodeParser {
163 TopLevelParser() = delete; 164 TopLevelParser() = delete;
164 TopLevelParser(const TopLevelParser &) = delete; 165 TopLevelParser(const TopLevelParser &) = delete;
165 TopLevelParser &operator=(const TopLevelParser &) = delete; 166 TopLevelParser &operator=(const TopLevelParser &) = delete;
166 167
167 public: 168 public:
168 typedef std::vector<Ice::FunctionDeclaration *> FunctionDeclarationListType; 169 typedef std::vector<Ice::FunctionDeclaration *> FunctionDeclarationListType;
169 170
170 TopLevelParser(Ice::Translator &Translator, NaClBitstreamCursor &Cursor, 171 TopLevelParser(Ice::Translator &MyTranslator, NaClBitstreamCursor &Cursor,
171 Ice::ErrorCode &ErrorStatus) 172 Ice::ErrorCode &MyErrorStatus)
172 : NaClBitcodeParser(Cursor), Translator(Translator), 173 : NaClBitcodeParser(Cursor), Translator(MyTranslator),
173 ErrorStatus(ErrorStatus), 174 ErrorStatus(MyErrorStatus),
174 VariableDeclarations(new Ice::VariableDeclarationList()) {} 175 VariableDeclarations(new Ice::VariableDeclarationList()) {}
175 176
176 ~TopLevelParser() override = default; 177 ~TopLevelParser() override = default;
177 178
178 Ice::Translator &getTranslator() const { return Translator; } 179 Ice::Translator &getTranslator() const { return Translator; }
179 180
180 void setBlockParser(BlockParserBaseClass *NewBlockParser) { 181 void setBlockParser(BlockParserBaseClass *NewBlockParser) {
181 BlockParser = NewBlockParser; 182 BlockParser = NewBlockParser;
182 } 183 }
183 184
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 // Because this is the base class of block parsers, we generate error 571 // Because this is the base class of block parsers, we generate error
571 // messages if ParseBlock or ParseRecord is not overridden in derived 572 // messages if ParseBlock or ParseRecord is not overridden in derived
572 // classes. 573 // classes.
573 class BlockParserBaseClass : public NaClBitcodeParser { 574 class BlockParserBaseClass : public NaClBitcodeParser {
574 BlockParserBaseClass() = delete; 575 BlockParserBaseClass() = delete;
575 BlockParserBaseClass(const BlockParserBaseClass &) = delete; 576 BlockParserBaseClass(const BlockParserBaseClass &) = delete;
576 BlockParserBaseClass &operator=(const BlockParserBaseClass &) = delete; 577 BlockParserBaseClass &operator=(const BlockParserBaseClass &) = delete;
577 578
578 public: 579 public:
579 // Constructor for the top-level module block parser. 580 // Constructor for the top-level module block parser.
580 BlockParserBaseClass(unsigned BlockID, TopLevelParser *Context) 581 BlockParserBaseClass(unsigned BlockID, TopLevelParser *MyContext)
581 : NaClBitcodeParser(BlockID, Context), Context(Context) { 582 : NaClBitcodeParser(BlockID, MyContext), Context(MyContext) {
582 Context->setBlockParser(this); 583 Context->setBlockParser(this);
583 } 584 }
584 585
585 ~BlockParserBaseClass() override { Context->setBlockParser(nullptr); } 586 ~BlockParserBaseClass() override { Context->setBlockParser(nullptr); }
586 587
587 // Returns the printable name of the type of block being parsed. 588 // Returns the printable name of the type of block being parsed.
588 virtual const char *getBlockName() const { 589 virtual const char *getBlockName() const {
589 // If this class is used, it is parsing an unknown block. 590 // If this class is used, it is parsing an unknown block.
590 return "unknown"; 591 return "unknown";
591 } 592 }
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 } 2674 }
2674 } 2675 }
2675 2676
2676 /// Parses constants within a function block. 2677 /// Parses constants within a function block.
2677 class ConstantsParser : public BlockParserBaseClass { 2678 class ConstantsParser : public BlockParserBaseClass {
2678 ConstantsParser() = delete; 2679 ConstantsParser() = delete;
2679 ConstantsParser(const ConstantsParser &) = delete; 2680 ConstantsParser(const ConstantsParser &) = delete;
2680 ConstantsParser &operator=(const ConstantsParser &) = delete; 2681 ConstantsParser &operator=(const ConstantsParser &) = delete;
2681 2682
2682 public: 2683 public:
2683 ConstantsParser(unsigned BlockID, FunctionParser *FuncParser) 2684 ConstantsParser(unsigned BlockID, FunctionParser *MyFuncParser)
2684 : BlockParserBaseClass(BlockID, FuncParser), 2685 : BlockParserBaseClass(BlockID, MyFuncParser),
2685 Timer(Ice::TimerStack::TT_parseConstants, getTranslator().getContext()), 2686 Timer(Ice::TimerStack::TT_parseConstants, getTranslator().getContext()),
2686 FuncParser(FuncParser) {} 2687 FuncParser(MyFuncParser) {}
2687 2688
2688 ~ConstantsParser() override = default; 2689 ~ConstantsParser() override = default;
2689 2690
2690 const char *getBlockName() const override { return "constants"; } 2691 const char *getBlockName() const override { return "constants"; }
2691 2692
2692 private: 2693 private:
2693 Ice::TimerMarker Timer; 2694 Ice::TimerMarker Timer;
2694 // The parser of the function block this constants block appears in. 2695 // The parser of the function block this constants block appears in.
2695 FunctionParser *FuncParser; 2696 FunctionParser *FuncParser;
2696 // The type to use for succeeding constants. 2697 // The type to use for succeeding constants.
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
3107 } 3108 }
3108 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { 3109 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) {
3109 ErrStream 3110 ErrStream
3110 << IRFilename 3111 << IRFilename
3111 << ": Bitcode stream should be a multiple of 4 bytes in length.\n"; 3112 << ": Bitcode stream should be a multiple of 4 bytes in length.\n";
3112 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); 3113 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes");
3113 } 3114 }
3114 } 3115 }
3115 3116
3116 } // end of namespace Ice 3117 } // end of namespace Ice
OLDNEW
« src/IceInstARM32.h ('K') | « src/IceTypeConverter.cpp ('k') | unittest/BitcodeMunge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698