alokp@chromium.org | 36124de8 | 2012-05-24 02:17:43 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 7 | #ifndef COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_ |
| 8 | #define COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_ |
alokp@chromium.org | 36124de8 | 2012-05-24 02:17:43 +0000 | [diff] [blame] | 9 | |
| 10 | #include <string> |
| 11 | |
Geoff Lang | 197d529 | 2018-04-25 14:29:00 -0400 | [diff] [blame] | 12 | namespace angle |
| 13 | { |
| 14 | |
alokp@chromium.org | 36124de8 | 2012-05-24 02:17:43 +0000 | [diff] [blame] | 15 | namespace pp |
| 16 | { |
| 17 | |
| 18 | struct SourceLocation; |
| 19 | |
| 20 | // Base class for handling directives. |
| 21 | // Preprocessor uses this class to notify the clients about certain |
| 22 | // preprocessor directives. Derived classes are responsible for |
| 23 | // handling them in an appropriate manner. |
| 24 | class DirectiveHandler |
| 25 | { |
| 26 | public: |
| 27 | virtual ~DirectiveHandler(); |
| 28 | |
Jamie Madill | f832c9d | 2016-12-12 17:38:48 -0500 | [diff] [blame] | 29 | virtual void handleError(const SourceLocation &loc, const std::string &msg) = 0; |
alokp@chromium.org | 36124de8 | 2012-05-24 02:17:43 +0000 | [diff] [blame] | 30 | |
| 31 | // Handle pragma of form: #pragma name[(value)] |
Zhenyao Mo | d526f98 | 2014-05-13 14:51:19 -0700 | [diff] [blame] | 32 | virtual void handlePragma(const SourceLocation &loc, |
| 33 | const std::string &name, |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 34 | const std::string &value, |
| 35 | bool stdgl) = 0; |
alokp@chromium.org | 7c88454 | 2012-05-24 19:13:03 +0000 | [diff] [blame] | 36 | |
Zhenyao Mo | d526f98 | 2014-05-13 14:51:19 -0700 | [diff] [blame] | 37 | virtual void handleExtension(const SourceLocation &loc, |
| 38 | const std::string &name, |
| 39 | const std::string &behavior) = 0; |
alokp@chromium.org | 7c88454 | 2012-05-24 19:13:03 +0000 | [diff] [blame] | 40 | |
Jamie Madill | f832c9d | 2016-12-12 17:38:48 -0500 | [diff] [blame] | 41 | virtual void handleVersion(const SourceLocation &loc, int version) = 0; |
alokp@chromium.org | 36124de8 | 2012-05-24 02:17:43 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | } // namespace pp |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 45 | |
Geoff Lang | 197d529 | 2018-04-25 14:29:00 -0400 | [diff] [blame] | 46 | } // namespace angle |
| 47 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 48 | #endif // COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_ |