summaryrefslogtreecommitdiffstats
path: root/chromium/build/patches/chromium-gn-bootstrap-revert-4980.patch
blob: fe550e9a16b3a315fe2ebca10d61e0d6170eff0a (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
Description: revert https://gn.googlesource.com/gn/+/8730b0feb6b991fa47368566501ab9ccfb453c92, which breaks the chromium build

--- a/tools/gn/tools/gn/binary_target_generator.cc
+++ b/tools/gn/tools/gn/binary_target_generator.cc
@@ -68,38 +68,6 @@ void BinaryTargetGenerator::DoRun() {
     return;
 }
 
-bool BinaryTargetGenerator::FillSources() {
-  bool ret = TargetGenerator::FillSources();
-  for (std::size_t i = 0; i < target_->sources().size(); ++i) {
-    const auto& source = target_->sources()[i];
-    switch (source.type()) {
-      case SourceFile::SOURCE_CPP:
-      case SourceFile::SOURCE_H:
-      case SourceFile::SOURCE_C:
-      case SourceFile::SOURCE_M:
-      case SourceFile::SOURCE_MM:
-      case SourceFile::SOURCE_S:
-      case SourceFile::SOURCE_ASM:
-      case SourceFile::SOURCE_O:
-        // These are allowed.
-        break;
-      case SourceFile::SOURCE_RC:
-      case SourceFile::SOURCE_DEF:
-      case SourceFile::SOURCE_RS:
-      case SourceFile::SOURCE_GO:
-      case SourceFile::SOURCE_UNKNOWN:
-      case SourceFile::SOURCE_NUMTYPES:
-        *err_ =
-            Err(scope_->GetValue(variables::kSources, true)->list_value()[i],
-                std::string("Only source, header, and object files belong in "
-                            "the sources of a ") +
-                    Target::GetStringForOutputType(target_->output_type()) +
-                    ". " + source.value() + " is not one of the valid types.");
-    }
-  }
-  return ret;
-}
-
 bool BinaryTargetGenerator::FillCompleteStaticLib() {
   if (target_->output_type() == Target::STATIC_LIBRARY) {
     const Value* value = scope_->GetValue(variables::kCompleteStaticLib, true);
--- a/tools/gn/tools/gn/binary_target_generator.h
+++ b/tools/gn/tools/gn/binary_target_generator.h
@@ -22,7 +22,6 @@ class BinaryTargetGenerator : public Tar
 
  protected:
   void DoRun() override;
-  bool FillSources() override;
 
  private:
   bool FillCompleteStaticLib();
--- a/tools/gn/tools/gn/source_dir.cc
+++ b/tools/gn/tools/gn/source_dir.cc
@@ -98,10 +98,10 @@ SourceFile SourceDir::ResolveRelativeFil
     return ret;
 
   const std::string& input_string = p.string_value();
-  if (!ValidateResolveInput<std::string>(true, p, input_string, err))
+  if (!ValidateResolveInput<std::string>(true, p, input_string, err)) {
     return ret;
-
-  ret.SetValue(ResolveRelative(input_string, value_, true, source_root));
+  }
+  ret.value_ = ResolveRelative(input_string, value_, true, source_root);
   return ret;
 }
 
--- a/tools/gn/tools/gn/source_file.cc
+++ b/tools/gn/tools/gn/source_file.cc
@@ -55,19 +55,18 @@ SourceFile::Type GetSourceFileType(const
 SourceFile::SourceFile() : type_(SOURCE_UNKNOWN) {}
 
 SourceFile::SourceFile(const base::StringPiece& p)
-    : value_(p.data(), p.size()) {
+    : value_(p.data(), p.size()), type_(GetSourceFileType(value_)) {
   DCHECK(!value_.empty());
   AssertValueSourceFileString(value_);
   NormalizePath(&value_);
-  type_ = GetSourceFileType(value_);
 }
 
-SourceFile::SourceFile(SwapIn, std::string* value) {
+SourceFile::SourceFile(SwapIn, std::string* value)
+    : type_(GetSourceFileType(*value)) {
   value_.swap(*value);
   DCHECK(!value_.empty());
   AssertValueSourceFileString(value_);
   NormalizePath(&value_);
-  type_ = GetSourceFileType(value_);
 }
 
 SourceFile::~SourceFile() = default;
@@ -93,8 +92,3 @@ SourceDir SourceFile::GetDir() const {
 base::FilePath SourceFile::Resolve(const base::FilePath& source_root) const {
   return ResolvePath(value_, true, source_root);
 }
-
-void SourceFile::SetValue(const std::string& value) {
-  value_ = value;
-  type_ = GetSourceFileType(value_);
-}
--- a/tools/gn/tools/gn/source_file.h
+++ b/tools/gn/tools/gn/source_file.h
@@ -97,16 +97,11 @@ class SourceFile {
     return value_ < other.value_;
   }
 
-  void swap(SourceFile& other) {
-    value_.swap(other.value_);
-    std::swap(type_, other.type_);
-  }
+  void swap(SourceFile& other) { value_.swap(other.value_); }
 
  private:
   friend class SourceDir;
 
-  void SetValue(const std::string& value);
-
   std::string value_;
   Type type_;
 
--- a/tools/gn/tools/gn/target_generator.h
+++ b/tools/gn/tools/gn/target_generator.h
@@ -47,7 +47,7 @@ class TargetGenerator {
 
   const BuildSettings* GetBuildSettings() const;
 
-  virtual bool FillSources();
+  bool FillSources();
   bool FillPublic();
   bool FillConfigs();
   bool FillOutputs(bool allow_substitutions);