Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | // |
michael@0 | 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. |
michael@0 | 3 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | // found in the LICENSE file. |
michael@0 | 5 | // |
michael@0 | 6 | |
michael@0 | 7 | #ifndef COMPILER_PREPROCESSOR_DIRECTIVE_PARSER_H_ |
michael@0 | 8 | #define COMPILER_PREPROCESSOR_DIRECTIVE_PARSER_H_ |
michael@0 | 9 | |
michael@0 | 10 | #include "Lexer.h" |
michael@0 | 11 | #include "Macro.h" |
michael@0 | 12 | #include "pp_utils.h" |
michael@0 | 13 | #include "SourceLocation.h" |
michael@0 | 14 | |
michael@0 | 15 | namespace pp |
michael@0 | 16 | { |
michael@0 | 17 | |
michael@0 | 18 | class Diagnostics; |
michael@0 | 19 | class DirectiveHandler; |
michael@0 | 20 | class Tokenizer; |
michael@0 | 21 | |
michael@0 | 22 | class DirectiveParser : public Lexer |
michael@0 | 23 | { |
michael@0 | 24 | public: |
michael@0 | 25 | DirectiveParser(Tokenizer* tokenizer, |
michael@0 | 26 | MacroSet* macroSet, |
michael@0 | 27 | Diagnostics* diagnostics, |
michael@0 | 28 | DirectiveHandler* directiveHandler); |
michael@0 | 29 | |
michael@0 | 30 | virtual void lex(Token* token); |
michael@0 | 31 | |
michael@0 | 32 | private: |
michael@0 | 33 | PP_DISALLOW_COPY_AND_ASSIGN(DirectiveParser); |
michael@0 | 34 | |
michael@0 | 35 | void parseDirective(Token* token); |
michael@0 | 36 | void parseDefine(Token* token); |
michael@0 | 37 | void parseUndef(Token* token); |
michael@0 | 38 | void parseIf(Token* token); |
michael@0 | 39 | void parseIfdef(Token* token); |
michael@0 | 40 | void parseIfndef(Token* token); |
michael@0 | 41 | void parseElse(Token* token); |
michael@0 | 42 | void parseElif(Token* token); |
michael@0 | 43 | void parseEndif(Token* token); |
michael@0 | 44 | void parseError(Token* token); |
michael@0 | 45 | void parsePragma(Token* token); |
michael@0 | 46 | void parseExtension(Token* token); |
michael@0 | 47 | void parseVersion(Token* token); |
michael@0 | 48 | void parseLine(Token* token); |
michael@0 | 49 | |
michael@0 | 50 | bool skipping() const; |
michael@0 | 51 | void parseConditionalIf(Token* token); |
michael@0 | 52 | int parseExpressionIf(Token* token); |
michael@0 | 53 | int parseExpressionIfdef(Token* token); |
michael@0 | 54 | |
michael@0 | 55 | struct ConditionalBlock |
michael@0 | 56 | { |
michael@0 | 57 | std::string type; |
michael@0 | 58 | SourceLocation location; |
michael@0 | 59 | bool skipBlock; |
michael@0 | 60 | bool skipGroup; |
michael@0 | 61 | bool foundValidGroup; |
michael@0 | 62 | bool foundElseGroup; |
michael@0 | 63 | |
michael@0 | 64 | ConditionalBlock() : |
michael@0 | 65 | skipBlock(false), |
michael@0 | 66 | skipGroup(false), |
michael@0 | 67 | foundValidGroup(false), |
michael@0 | 68 | foundElseGroup(false) |
michael@0 | 69 | { |
michael@0 | 70 | } |
michael@0 | 71 | }; |
michael@0 | 72 | bool mPastFirstStatement; |
michael@0 | 73 | std::vector<ConditionalBlock> mConditionalStack; |
michael@0 | 74 | Tokenizer* mTokenizer; |
michael@0 | 75 | MacroSet* mMacroSet; |
michael@0 | 76 | Diagnostics* mDiagnostics; |
michael@0 | 77 | DirectiveHandler* mDirectiveHandler; |
michael@0 | 78 | }; |
michael@0 | 79 | |
michael@0 | 80 | } // namespace pp |
michael@0 | 81 | #endif // COMPILER_PREPROCESSOR_DIRECTIVE_PARSER_H_ |
michael@0 | 82 |