1 /* Compiler handling for plugin
2 Copyright (C) 2014-2020 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef CC1_PLUGIN_COMPILER_HH
21 #define CC1_PLUGIN_COMPILER_HH
26 // Base class for compiler.
30 explicit compiler (bool v
)
35 virtual ~compiler () = default;
37 // Find the compiler. BASE is the base name of the compiler, see
38 // compiler-name.hh. This sets COMPILER to the resulting path.
39 // Returns nullptr on success, or a malloc'd error string on
41 virtual char *find (const char *base
, std::string
&compiler
) const;
43 void set_verbose (bool v
)
52 /* Compiler to set by set_triplet_regexp. */
53 class compiler_triplet_regexp
: public compiler
56 std::string triplet_regexp_
;
59 char *find (const char *base
, std::string
&compiler
) const override
;
61 compiler_triplet_regexp (bool v
, const char *triplet_regexp
)
62 : compiler (v
), triplet_regexp_ (triplet_regexp
)
67 /* Compiler to set by set_driver_filename. */
68 class compiler_driver_filename
: public compiler
71 std::string driver_filename_
;
73 char *find (const char *base
, std::string
&compiler
) const override
;
75 compiler_driver_filename (bool v
, const char *driver_filename
)
76 : compiler (v
), driver_filename_ (driver_filename
)
83 #endif // CC1_PLUGIN_COMPILER_HH