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

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

Powered by Google App Engine
This is Rietveld 408576698