1
Description: revert https://gn.googlesource.com/gn/+/0d038c2e0a32a528713d3dfaf1f1e0cdfe87fd46, which breaks the chromium build
3
--- a/tools/gn/build/gen.py
4
+++ b/tools/gn/build/gen.py
5
@@ -522,6 +522,7 @@ def WriteGNNinja(path, platform, host, o
7
'tools/gn/source_dir.cc',
8
'tools/gn/source_file.cc',
9
+ 'tools/gn/source_file_type.cc',
10
'tools/gn/standard_out.cc',
11
'tools/gn/string_utils.cc',
12
'tools/gn/substitution_list.cc',
13
--- a/tools/gn/tools/gn/c_tool.h
14
+++ b/tools/gn/tools/gn/c_tool.h
16
#include "tools/gn/label.h"
17
#include "tools/gn/label_ptr.h"
18
#include "tools/gn/scope.h"
19
+#include "tools/gn/source_file_type.h"
20
#include "tools/gn/substitution_list.h"
21
#include "tools/gn/substitution_pattern.h"
22
#include "tools/gn/tool.h"
23
--- a/tools/gn/tools/gn/compile_commands_writer.cc
24
+++ b/tools/gn/tools/gn/compile_commands_writer.cc
25
@@ -122,7 +122,7 @@ void WriteCommand(const Target* target,
26
const CompileFlags& flags,
27
std::vector<OutputFile>& tool_outputs,
28
PathOutput& path_output,
29
- SourceFile::Type source_type,
30
+ SourceFileType source_type,
31
const char* tool_name,
33
std::string* compile_commands) {
34
@@ -144,16 +144,16 @@ void WriteCommand(const Target* target,
35
} else if (range.type == &CSubstitutionCFlags) {
36
command_out << flags.cflags;
37
} else if (range.type == &CSubstitutionCFlagsC) {
38
- if (source_type == SourceFile::SOURCE_C)
39
+ if (source_type == SOURCE_C)
40
command_out << flags.cflags_c;
41
} else if (range.type == &CSubstitutionCFlagsCc) {
42
- if (source_type == SourceFile::SOURCE_CPP)
43
+ if (source_type == SOURCE_CPP)
44
command_out << flags.cflags_cc;
45
} else if (range.type == &CSubstitutionCFlagsObjC) {
46
- if (source_type == SourceFile::SOURCE_M)
47
+ if (source_type == SOURCE_M)
48
command_out << flags.cflags_objc;
49
} else if (range.type == &CSubstitutionCFlagsObjCc) {
50
- if (source_type == SourceFile::SOURCE_MM)
51
+ if (source_type == SOURCE_MM)
52
command_out << flags.cflags_objcc;
53
} else if (range.type == &SubstitutionLabel ||
54
range.type == &SubstitutionLabelName ||
55
@@ -222,11 +222,9 @@ void CompileCommandsWriter::RenderJSON(c
56
for (const auto& source : target->sources()) {
57
// If this source is not a C/C++/ObjC/ObjC++ source (not header) file,
58
// continue as it does not belong in the compilation database.
59
- SourceFile::Type source_type = source.type();
60
- if (source_type != SourceFile::SOURCE_CPP &&
61
- source_type != SourceFile::SOURCE_C &&
62
- source_type != SourceFile::SOURCE_M &&
63
- source_type != SourceFile::SOURCE_MM)
64
+ SourceFileType source_type = GetSourceFileType(source);
65
+ if (source_type != SOURCE_CPP && source_type != SOURCE_C &&
66
+ source_type != SOURCE_M && source_type != SOURCE_MM)
69
const char* tool_name = Tool::kToolNone;
70
@@ -324,4 +322,4 @@ void CompileCommandsWriter::VisitDeps(co
71
VisitDeps(pair.ptr, visited);
76
\ No newline at end of file
77
--- a/tools/gn/tools/gn/general_tool.h
78
+++ b/tools/gn/tools/gn/general_tool.h
80
#include "base/macros.h"
81
#include "tools/gn/label.h"
82
#include "tools/gn/label_ptr.h"
83
+#include "tools/gn/source_file_type.h"
84
#include "tools/gn/substitution_list.h"
85
#include "tools/gn/substitution_pattern.h"
86
#include "tools/gn/tool.h"
87
--- a/tools/gn/tools/gn/header_checker.cc
88
+++ b/tools/gn/tools/gn/header_checker.cc
90
#include "tools/gn/err.h"
91
#include "tools/gn/filesystem_utils.h"
92
#include "tools/gn/scheduler.h"
93
+#include "tools/gn/source_file_type.h"
94
#include "tools/gn/target.h"
95
#include "tools/gn/trace.h"
96
#include "util/worker_pool.h"
97
@@ -151,10 +152,9 @@ void HeaderChecker::RunCheckOverFiles(co
99
for (const auto& file : files) {
100
// Only check C-like source files (RC files also have includes).
101
- SourceFile::Type type = file.first.type();
102
- if (type != SourceFile::SOURCE_CPP && type != SourceFile::SOURCE_H &&
103
- type != SourceFile::SOURCE_C && type != SourceFile::SOURCE_M &&
104
- type != SourceFile::SOURCE_MM && type != SourceFile::SOURCE_RC)
105
+ SourceFileType type = GetSourceFileType(file.first);
106
+ if (type != SOURCE_CPP && type != SOURCE_H && type != SOURCE_C &&
107
+ type != SOURCE_M && type != SOURCE_MM && type != SOURCE_RC)
110
if (!check_generated_) {
111
--- a/tools/gn/tools/gn/ninja_binary_target_writer.cc
112
+++ b/tools/gn/tools/gn/ninja_binary_target_writer.cc
114
#include "tools/gn/ninja_utils.h"
115
#include "tools/gn/scheduler.h"
116
#include "tools/gn/settings.h"
117
+#include "tools/gn/source_file_type.h"
118
#include "tools/gn/string_utils.h"
119
#include "tools/gn/substitution_writer.h"
120
#include "tools/gn/target.h"
122
bool NinjaBinaryTargetWriter::SourceFileTypeSet::CSourceUsed() {
123
- return Get(SourceFile::SOURCE_CPP) || Get(SourceFile::SOURCE_H) ||
124
- Get(SourceFile::SOURCE_C) || Get(SourceFile::SOURCE_M) ||
125
- Get(SourceFile::SOURCE_MM) || Get(SourceFile::SOURCE_RC) ||
126
- Get(SourceFile::SOURCE_S);
127
+ return Get(SOURCE_CPP) || Get(SOURCE_H) || Get(SOURCE_C) || Get(SOURCE_M) ||
128
+ Get(SOURCE_MM) || Get(SOURCE_RC) || Get(SOURCE_S);
131
bool NinjaBinaryTargetWriter::SourceFileTypeSet::RustSourceUsed() {
132
- return Get(SourceFile::SOURCE_RS);
133
+ return Get(SOURCE_RS);
136
bool NinjaBinaryTargetWriter::SourceFileTypeSet::GoSourceUsed() {
137
- return Get(SourceFile::SOURCE_GO);
138
+ return Get(SOURCE_GO);
141
NinjaBinaryTargetWriter::NinjaBinaryTargetWriter(const Target* target,
142
@@ -50,6 +49,10 @@ NinjaBinaryTargetWriter::NinjaBinaryTarg
143
NinjaBinaryTargetWriter::~NinjaBinaryTargetWriter() = default;
145
void NinjaBinaryTargetWriter::Run() {
146
+ SourceFileTypeSet used_types;
147
+ for (const auto& source : target_->sources())
148
+ used_types.Set(GetSourceFileType(source));
150
NinjaCBinaryTargetWriter writer(target_, out_);
153
--- a/tools/gn/tools/gn/ninja_binary_target_writer.h
154
+++ b/tools/gn/tools/gn/ninja_binary_target_writer.h
155
@@ -23,12 +23,11 @@ class NinjaBinaryTargetWriter : public N
156
class SourceFileTypeSet {
158
SourceFileTypeSet() {
160
- sizeof(bool) * static_cast<int>(SourceFile::SOURCE_NUMTYPES));
161
+ memset(flags_, 0, sizeof(bool) * static_cast<int>(SOURCE_NUMTYPES));
164
- void Set(SourceFile::Type type) { flags_[static_cast<int>(type)] = true; }
165
- bool Get(SourceFile::Type type) const {
166
+ void Set(SourceFileType type) { flags_[static_cast<int>(type)] = true; }
167
+ bool Get(SourceFileType type) const {
168
return flags_[static_cast<int>(type)];
171
@@ -37,7 +36,7 @@ class NinjaBinaryTargetWriter : public N
175
- bool flags_[static_cast<int>(SourceFile::SOURCE_NUMTYPES)];
176
+ bool flags_[static_cast<int>(SOURCE_NUMTYPES)];
179
NinjaBinaryTargetWriter(const Target* target, std::ostream& out);
180
--- a/tools/gn/tools/gn/ninja_c_binary_target_writer.cc
181
+++ b/tools/gn/tools/gn/ninja_c_binary_target_writer.cc
183
#include "tools/gn/ninja_utils.h"
184
#include "tools/gn/scheduler.h"
185
#include "tools/gn/settings.h"
186
+#include "tools/gn/source_file_type.h"
187
#include "tools/gn/string_utils.h"
188
#include "tools/gn/substitution_writer.h"
189
#include "tools/gn/target.h"
190
@@ -66,27 +67,27 @@ void AddSourceSetObjectFiles(const Targe
191
if (source_set->GetOutputFilesForSource(source, &tool_name, &tool_outputs))
192
obj_files->push_back(tool_outputs[0]);
194
- used_types.Set(source.type());
195
+ used_types.Set(GetSourceFileType(source));
198
// Add MSVC precompiled header object files. GCC .gch files are not object
199
// files so they are omitted.
200
if (source_set->config_values().has_precompiled_headers()) {
201
- if (used_types.Get(SourceFile::SOURCE_C)) {
202
+ if (used_types.Get(SOURCE_C)) {
203
const CTool* tool = source_set->toolchain()->GetToolAsC(CTool::kCToolCc);
204
if (tool && tool->precompiled_header_type() == CTool::PCH_MSVC) {
205
GetPCHOutputFiles(source_set, CTool::kCToolCc, &tool_outputs);
206
obj_files->Append(tool_outputs.begin(), tool_outputs.end());
209
- if (used_types.Get(SourceFile::SOURCE_CPP)) {
210
+ if (used_types.Get(SOURCE_CPP)) {
211
const CTool* tool = source_set->toolchain()->GetToolAsC(CTool::kCToolCxx);
212
if (tool && tool->precompiled_header_type() == CTool::PCH_MSVC) {
213
GetPCHOutputFiles(source_set, CTool::kCToolCxx, &tool_outputs);
214
obj_files->Append(tool_outputs.begin(), tool_outputs.end());
217
- if (used_types.Get(SourceFile::SOURCE_M)) {
218
+ if (used_types.Get(SOURCE_M)) {
220
source_set->toolchain()->GetToolAsC(CTool::kCToolObjC);
221
if (tool && tool->precompiled_header_type() == CTool::PCH_MSVC) {
222
@@ -94,7 +95,7 @@ void AddSourceSetObjectFiles(const Targe
223
obj_files->Append(tool_outputs.begin(), tool_outputs.end());
226
- if (used_types.Get(SourceFile::SOURCE_MM)) {
227
+ if (used_types.Get(SOURCE_MM)) {
229
source_set->toolchain()->GetToolAsC(CTool::kCToolObjCxx);
230
if (tool && tool->precompiled_header_type() == CTool::PCH_MSVC) {
231
@@ -118,7 +119,7 @@ void NinjaCBinaryTargetWriter::Run() {
232
// Figure out what source types are needed.
233
SourceFileTypeSet used_types;
234
for (const auto& source : target_->sources())
235
- used_types.Set(source.type());
236
+ used_types.Set(GetSourceFileType(source));
238
WriteCompilerVars(used_types);
240
@@ -234,34 +235,31 @@ void NinjaCBinaryTargetWriter::WriteComp
241
target_->config_values().has_precompiled_headers();
243
EscapeOptions opts = GetFlagOptions();
244
- if (used_types.Get(SourceFile::SOURCE_S) ||
245
- used_types.Get(SourceFile::SOURCE_ASM)) {
246
+ if (used_types.Get(SOURCE_S) || used_types.Get(SOURCE_ASM)) {
247
WriteOneFlag(target_, &CSubstitutionAsmFlags, false, Tool::kToolNone,
248
&ConfigValues::asmflags, opts, path_output_, out_);
250
- if (used_types.Get(SourceFile::SOURCE_C) ||
251
- used_types.Get(SourceFile::SOURCE_CPP) ||
252
- used_types.Get(SourceFile::SOURCE_M) ||
253
- used_types.Get(SourceFile::SOURCE_MM)) {
254
+ if (used_types.Get(SOURCE_C) || used_types.Get(SOURCE_CPP) ||
255
+ used_types.Get(SOURCE_M) || used_types.Get(SOURCE_MM)) {
256
WriteOneFlag(target_, &CSubstitutionCFlags, false, Tool::kToolNone,
257
&ConfigValues::cflags, opts, path_output_, out_);
259
- if (used_types.Get(SourceFile::SOURCE_C)) {
260
+ if (used_types.Get(SOURCE_C)) {
261
WriteOneFlag(target_, &CSubstitutionCFlagsC, has_precompiled_headers,
262
CTool::kCToolCc, &ConfigValues::cflags_c, opts, path_output_,
265
- if (used_types.Get(SourceFile::SOURCE_CPP)) {
266
+ if (used_types.Get(SOURCE_CPP)) {
267
WriteOneFlag(target_, &CSubstitutionCFlagsCc, has_precompiled_headers,
268
CTool::kCToolCxx, &ConfigValues::cflags_cc, opts, path_output_,
271
- if (used_types.Get(SourceFile::SOURCE_M)) {
272
+ if (used_types.Get(SOURCE_M)) {
273
WriteOneFlag(target_, &CSubstitutionCFlagsObjC, has_precompiled_headers,
274
CTool::kCToolObjC, &ConfigValues::cflags_objc, opts,
277
- if (used_types.Get(SourceFile::SOURCE_MM)) {
278
+ if (used_types.Get(SOURCE_MM)) {
279
WriteOneFlag(target_, &CSubstitutionCFlagsObjCc, has_precompiled_headers,
280
CTool::kCToolObjCxx, &ConfigValues::cflags_objcc, opts,
282
@@ -321,14 +319,14 @@ void NinjaCBinaryTargetWriter::WritePCHC
284
const CTool* tool_c = target_->toolchain()->GetToolAsC(CTool::kCToolCc);
285
if (tool_c && tool_c->precompiled_header_type() != CTool::PCH_NONE &&
286
- used_types.Get(SourceFile::SOURCE_C)) {
287
+ used_types.Get(SOURCE_C)) {
288
WritePCHCommand(&CSubstitutionCFlagsC, CTool::kCToolCc,
289
tool_c->precompiled_header_type(), input_dep,
290
order_only_deps, object_files, other_files);
292
const CTool* tool_cxx = target_->toolchain()->GetToolAsC(CTool::kCToolCxx);
293
if (tool_cxx && tool_cxx->precompiled_header_type() != CTool::PCH_NONE &&
294
- used_types.Get(SourceFile::SOURCE_CPP)) {
295
+ used_types.Get(SOURCE_CPP)) {
296
WritePCHCommand(&CSubstitutionCFlagsCc, CTool::kCToolCxx,
297
tool_cxx->precompiled_header_type(), input_dep,
298
order_only_deps, object_files, other_files);
299
@@ -336,7 +334,7 @@ void NinjaCBinaryTargetWriter::WritePCHC
301
const CTool* tool_objc = target_->toolchain()->GetToolAsC(CTool::kCToolObjC);
302
if (tool_objc && tool_objc->precompiled_header_type() == CTool::PCH_GCC &&
303
- used_types.Get(SourceFile::SOURCE_M)) {
304
+ used_types.Get(SOURCE_M)) {
305
WritePCHCommand(&CSubstitutionCFlagsObjC, CTool::kCToolObjC,
306
tool_objc->precompiled_header_type(), input_dep,
307
order_only_deps, object_files, other_files);
308
@@ -345,7 +343,7 @@ void NinjaCBinaryTargetWriter::WritePCHC
309
const CTool* tool_objcxx =
310
target_->toolchain()->GetToolAsC(CTool::kCToolObjCxx);
311
if (tool_objcxx && tool_objcxx->precompiled_header_type() == CTool::PCH_GCC &&
312
- used_types.Get(SourceFile::SOURCE_MM)) {
313
+ used_types.Get(SOURCE_MM)) {
314
WritePCHCommand(&CSubstitutionCFlagsObjCc, CTool::kCToolObjCxx,
315
tool_objcxx->precompiled_header_type(), input_dep,
316
order_only_deps, object_files, other_files);
317
@@ -478,7 +476,7 @@ void NinjaCBinaryTargetWriter::WriteSour
319
const char* tool_name = Tool::kToolNone;
320
if (!target_->GetOutputFilesForSource(source, &tool_name, &tool_outputs)) {
321
- if (source.type() == SourceFile::SOURCE_DEF)
322
+ if (GetSourceFileType(source) == SOURCE_DEF)
323
other_files->push_back(source);
324
continue; // No output for this source.
326
@@ -599,7 +597,7 @@ void NinjaCBinaryTargetWriter::WriteLink
327
const SourceFile* optional_def_file = nullptr;
328
if (!other_files.empty()) {
329
for (const SourceFile& src_file : other_files) {
330
- if (src_file.type() == SourceFile::SOURCE_DEF) {
331
+ if (GetSourceFileType(src_file) == SOURCE_DEF) {
332
optional_def_file = &src_file;
333
implicit_deps.push_back(
334
OutputFile(settings_->build_settings(), src_file));
335
--- a/tools/gn/tools/gn/source_file.cc
336
+++ b/tools/gn/tools/gn/source_file.cc
337
@@ -21,48 +21,18 @@ void AssertValueSourceFileString(const s
338
DCHECK(!EndsWithSlash(s)) << s;
341
-SourceFile::Type GetSourceFileType(const std::string& file) {
342
- base::StringPiece extension = FindExtension(&file);
343
- if (extension == "cc" || extension == "cpp" || extension == "cxx")
344
- return SourceFile::SOURCE_CPP;
345
- if (extension == "h" || extension == "hpp" || extension == "hxx" ||
346
- extension == "hh" || extension == "inc")
347
- return SourceFile::SOURCE_H;
348
- if (extension == "c")
349
- return SourceFile::SOURCE_C;
350
- if (extension == "m")
351
- return SourceFile::SOURCE_M;
352
- if (extension == "mm")
353
- return SourceFile::SOURCE_MM;
354
- if (extension == "rc")
355
- return SourceFile::SOURCE_RC;
356
- if (extension == "S" || extension == "s" || extension == "asm")
357
- return SourceFile::SOURCE_S;
358
- if (extension == "o" || extension == "obj")
359
- return SourceFile::SOURCE_O;
360
- if (extension == "def")
361
- return SourceFile::SOURCE_DEF;
362
- if (extension == "rs")
363
- return SourceFile::SOURCE_RS;
364
- if (extension == "go")
365
- return SourceFile::SOURCE_GO;
367
- return SourceFile::SOURCE_UNKNOWN;
372
-SourceFile::SourceFile() : type_(SOURCE_UNKNOWN) {}
373
+SourceFile::SourceFile() = default;
375
SourceFile::SourceFile(const base::StringPiece& p)
376
- : value_(p.data(), p.size()), type_(GetSourceFileType(value_)) {
377
+ : value_(p.data(), p.size()) {
378
DCHECK(!value_.empty());
379
AssertValueSourceFileString(value_);
380
NormalizePath(&value_);
383
-SourceFile::SourceFile(SwapIn, std::string* value)
384
- : type_(GetSourceFileType(*value)) {
385
+SourceFile::SourceFile(SwapIn, std::string* value) {
387
DCHECK(!value_.empty());
388
AssertValueSourceFileString(value_);
389
--- a/tools/gn/tools/gn/source_file.h
390
+++ b/tools/gn/tools/gn/source_file.h
391
@@ -20,28 +20,6 @@ class SourceDir;
395
- // This should be sequential integers starting from 0 so they can be used as
398
- SOURCE_UNKNOWN = 0,
407
- SOURCE_O, // Object files can be inputs, too. Also counts .obj.
417
enum SwapIn { SWAP_IN };
420
@@ -58,7 +36,6 @@ class SourceFile {
422
bool is_null() const { return value_.empty(); }
423
const std::string& value() const { return value_; }
424
- Type type() const { return type_; }
426
// Returns everything after the last slash.
427
std::string GetName() const;
428
@@ -103,7 +80,6 @@ class SourceFile {
429
friend class SourceDir;
434
// Copy & assign supported.
437
+++ b/tools/gn/tools/gn/source_file_type.cc
439
+// Copyright 2014 The Chromium Authors. All rights reserved.
440
+// Use of this source code is governed by a BSD-style license that can be
441
+// found in the LICENSE file.
443
+#include "tools/gn/source_file_type.h"
445
+#include "tools/gn/filesystem_utils.h"
446
+#include "tools/gn/source_file.h"
448
+SourceFileType GetSourceFileType(const SourceFile& file) {
449
+ base::StringPiece extension = FindExtension(&file.value());
450
+ if (extension == "cc" || extension == "cpp" || extension == "cxx")
452
+ if (extension == "h" || extension == "hpp" || extension == "hxx" ||
455
+ if (extension == "c")
457
+ if (extension == "m")
459
+ if (extension == "mm")
461
+ if (extension == "rc")
463
+ if (extension == "S" || extension == "s" || extension == "asm")
465
+ if (extension == "o" || extension == "obj")
467
+ if (extension == "def")
469
+ if (extension == "rs")
471
+ if (extension == "go")
474
+ return SOURCE_UNKNOWN;
477
+++ b/tools/gn/tools/gn/source_file_type.h
479
+// Copyright 2014 The Chromium Authors. All rights reserved.
480
+// Use of this source code is governed by a BSD-style license that can be
481
+// found in the LICENSE file.
483
+#ifndef TOOLS_GN_SOURCE_FILE_TYPE_H_
484
+#define TOOLS_GN_SOURCE_FILE_TYPE_H_
488
+// This should be sequential integers starting from 0 so they can be used as
490
+enum SourceFileType {
491
+ SOURCE_UNKNOWN = 0,
500
+ SOURCE_O, // Object files can be inputs, too. Also counts .obj.
510
+SourceFileType GetSourceFileType(const SourceFile& file);
512
+#endif // TOOLS_GN_SOURCE_FILE_TYPE_H_
513
--- a/tools/gn/tools/gn/target.cc
514
+++ b/tools/gn/tools/gn/target.cc
516
#include "tools/gn/filesystem_utils.h"
517
#include "tools/gn/functions.h"
518
#include "tools/gn/scheduler.h"
519
+#include "tools/gn/source_file_type.h"
520
#include "tools/gn/substitution_writer.h"
521
#include "tools/gn/tool.h"
522
#include "tools/gn/toolchain.h"
523
@@ -486,10 +487,10 @@ bool Target::GetOutputFilesForSource(con
525
*computed_tool_type = Tool::kToolNone;
527
- SourceFile::Type file_type = source.type();
528
- if (file_type == SourceFile::SOURCE_UNKNOWN)
529
+ SourceFileType file_type = GetSourceFileType(source);
530
+ if (file_type == SOURCE_UNKNOWN)
532
- if (file_type == SourceFile::SOURCE_O) {
533
+ if (file_type == SOURCE_O) {
534
// Object files just get passed to the output and not compiled.
535
outputs->push_back(OutputFile(settings()->build_settings(), source));
537
--- a/tools/gn/tools/gn/tool.cc
538
+++ b/tools/gn/tools/gn/tool.cc
539
@@ -261,27 +261,27 @@ std::unique_ptr<Tool> Tool::CreateTool(c
543
-const char* Tool::GetToolTypeForSourceType(SourceFile::Type type) {
544
+const char* Tool::GetToolTypeForSourceType(SourceFileType type) {
546
- case SourceFile::SOURCE_C:
548
return CTool::kCToolCc;
549
- case SourceFile::SOURCE_CPP:
551
return CTool::kCToolCxx;
552
- case SourceFile::SOURCE_M:
554
return CTool::kCToolObjC;
555
- case SourceFile::SOURCE_MM:
557
return CTool::kCToolObjCxx;
558
- case SourceFile::SOURCE_ASM:
559
- case SourceFile::SOURCE_S:
562
return CTool::kCToolAsm;
563
- case SourceFile::SOURCE_RC:
565
return CTool::kCToolRc;
566
- case SourceFile::SOURCE_UNKNOWN:
567
- case SourceFile::SOURCE_H:
568
- case SourceFile::SOURCE_O:
569
- case SourceFile::SOURCE_DEF:
570
- case SourceFile::SOURCE_GO:
571
- case SourceFile::SOURCE_RS:
572
+ case SOURCE_UNKNOWN:
581
--- a/tools/gn/tools/gn/tool.h
582
+++ b/tools/gn/tools/gn/tool.h
584
#include "tools/gn/label.h"
585
#include "tools/gn/label_ptr.h"
586
#include "tools/gn/scope.h"
587
-#include "tools/gn/source_file.h"
588
+#include "tools/gn/source_file_type.h"
589
#include "tools/gn/substitution_list.h"
590
#include "tools/gn/substitution_pattern.h"
592
@@ -171,7 +171,7 @@ class Tool {
593
Toolchain* toolchain,
596
- static const char* GetToolTypeForSourceType(SourceFile::Type type);
597
+ static const char* GetToolTypeForSourceType(SourceFileType type);
598
static const char* GetToolTypeForTargetFinalOutput(const Target* target);
601
--- a/tools/gn/tools/gn/toolchain.cc
602
+++ b/tools/gn/tools/gn/toolchain.cc
603
@@ -88,16 +88,16 @@ void Toolchain::ToolchainSetupComplete()
604
setup_complete_ = true;
607
-const Tool* Toolchain::GetToolForSourceType(SourceFile::Type type) const {
608
+const Tool* Toolchain::GetToolForSourceType(SourceFileType type) const {
609
return GetTool(Tool::GetToolTypeForSourceType(type));
612
-const CTool* Toolchain::GetToolForSourceTypeAsC(SourceFile::Type type) const {
613
+const CTool* Toolchain::GetToolForSourceTypeAsC(SourceFileType type) const {
614
return GetToolAsC(Tool::GetToolTypeForSourceType(type));
617
const GeneralTool* Toolchain::GetToolForSourceTypeAsGeneral(
618
- SourceFile::Type type) const {
619
+ SourceFileType type) const {
620
return GetToolAsGeneral(Tool::GetToolTypeForSourceType(type));
623
--- a/tools/gn/tools/gn/toolchain.h
624
+++ b/tools/gn/tools/gn/toolchain.h
626
#include "tools/gn/item.h"
627
#include "tools/gn/label_ptr.h"
628
#include "tools/gn/scope.h"
629
+#include "tools/gn/source_file_type.h"
630
#include "tools/gn/substitution_type.h"
631
#include "tools/gn/tool.h"
632
#include "tools/gn/value.h"
633
@@ -87,9 +88,9 @@ class Toolchain : public Item {
636
// Returns the tool for compiling the given source file type.
637
- const Tool* GetToolForSourceType(SourceFile::Type type) const;
638
- const CTool* GetToolForSourceTypeAsC(SourceFile::Type type) const;
639
- const GeneralTool* GetToolForSourceTypeAsGeneral(SourceFile::Type type) const;
640
+ const Tool* GetToolForSourceType(SourceFileType type) const;
641
+ const CTool* GetToolForSourceTypeAsC(SourceFileType type) const;
642
+ const GeneralTool* GetToolForSourceTypeAsGeneral(SourceFileType type) const;
644
// Returns the tool that produces the final output for the given target type.
645
// This isn't necessarily the tool you would expect. For copy target, this
646
--- a/tools/gn/tools/gn/visual_studio_writer.cc
647
+++ b/tools/gn/tools/gn/visual_studio_writer.cc
649
#include "tools/gn/label_pattern.h"
650
#include "tools/gn/parse_tree.h"
651
#include "tools/gn/path_output.h"
652
+#include "tools/gn/source_file_type.h"
653
#include "tools/gn/standard_out.h"
654
#include "tools/gn/target.h"
655
#include "tools/gn/variables.h"