blob: 858bc1da6306af2f7329ee3563058bb8181cf013 [file] [log] [blame]
alokp@chromium.org36124de82012-05-24 02:17:43 +00001//
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 Lang0a73dd82014-11-19 16:18:08 -05007#ifndef COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
8#define COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
alokp@chromium.org36124de82012-05-24 02:17:43 +00009
10#include <string>
11
Geoff Lang197d5292018-04-25 14:29:00 -040012namespace angle
13{
14
alokp@chromium.org36124de82012-05-24 02:17:43 +000015namespace pp
16{
17
18struct 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.
24class DirectiveHandler
25{
26 public:
27 virtual ~DirectiveHandler();
28
Jamie Madillf832c9d2016-12-12 17:38:48 -050029 virtual void handleError(const SourceLocation &loc, const std::string &msg) = 0;
alokp@chromium.org36124de82012-05-24 02:17:43 +000030
31 // Handle pragma of form: #pragma name[(value)]
Zhenyao Mod526f982014-05-13 14:51:19 -070032 virtual void handlePragma(const SourceLocation &loc,
33 const std::string &name,
Zhenyao Mo94ac7b72014-10-15 18:22:08 -070034 const std::string &value,
35 bool stdgl) = 0;
alokp@chromium.org7c884542012-05-24 19:13:03 +000036
Zhenyao Mod526f982014-05-13 14:51:19 -070037 virtual void handleExtension(const SourceLocation &loc,
38 const std::string &name,
39 const std::string &behavior) = 0;
alokp@chromium.org7c884542012-05-24 19:13:03 +000040
Jamie Madillf832c9d2016-12-12 17:38:48 -050041 virtual void handleVersion(const SourceLocation &loc, int version) = 0;
alokp@chromium.org36124de82012-05-24 02:17:43 +000042};
43
44} // namespace pp
Geoff Lang0a73dd82014-11-19 16:18:08 -050045
Geoff Lang197d5292018-04-25 14:29:00 -040046} // namespace angle
47
Geoff Lang0a73dd82014-11-19 16:18:08 -050048#endif // COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_