• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef TOOLS_GN_BUILTIN_TOOL_H_
6 #define TOOLS_GN_BUILTIN_TOOL_H_
7 
8 #include <string>
9 
10 #include "gn/substitution_list.h"
11 #include "gn/substitution_pattern.h"
12 #include "gn/tool.h"
13 
14 // A built-in tool that is always available regardless of toolchain. So far, the
15 // only example of this is the phony rule that ninja provides.
16 class BuiltinTool : public Tool {
17  public:
18   // Builtin tools
19   static const char kBuiltinToolPhony[];
20 
21   // Explicit constructor. Note that |name| must be one of the kBuiltinToolXXX
22   // constant pointers defined above.
23   explicit BuiltinTool(const char* name);
24   ~BuiltinTool();
25 
26   // Manual RTTI and required functions ---------------------------------------
27 
28   bool InitTool(Scope* block_scope, Toolchain* toolchain, Err* err);
29   bool ValidateName(const char* name) const override;
30   void SetComplete() override;
31   bool ValidateSubstitution(const Substitution* sub_type) const override;
32 
33   BuiltinTool* AsBuiltin() override;
34   const BuiltinTool* AsBuiltin() const override;
35 
36  private:
37   BuiltinTool(const BuiltinTool&) = delete;
38   BuiltinTool& operator=(const BuiltinTool&) = delete;
39 };
40 
41 #endif  // TOOLS_GN_BUILTIN_TOOL_H_
42