OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "tools/gn/err.h" | 5 #include "tools/gn/err.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 : has_error_(true), | 137 : has_error_(true), |
138 message_(msg), | 138 message_(msg), |
139 help_text_(help_text) { | 139 help_text_(help_text) { |
140 if (value.origin()) { | 140 if (value.origin()) { |
141 LocationRange range = value.origin()->GetRange(); | 141 LocationRange range = value.origin()->GetRange(); |
142 location_ = range.begin(); | 142 location_ = range.begin(); |
143 ranges_.push_back(range); | 143 ranges_.push_back(range); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
| 147 Err::Err(const Err& other) = default; |
| 148 |
147 Err::~Err() { | 149 Err::~Err() { |
148 } | 150 } |
149 | 151 |
150 void Err::PrintToStdout() const { | 152 void Err::PrintToStdout() const { |
151 InternalPrintToStdout(false); | 153 InternalPrintToStdout(false); |
152 } | 154 } |
153 | 155 |
154 void Err::AppendSubErr(const Err& err) { | 156 void Err::AppendSubErr(const Err& err) { |
155 sub_errs_.push_back(err); | 157 sub_errs_.push_back(err); |
156 } | 158 } |
(...skipping 27 matching lines...) Expand all Loading... |
184 } | 186 } |
185 | 187 |
186 // Optional help text. | 188 // Optional help text. |
187 if (!help_text_.empty()) | 189 if (!help_text_.empty()) |
188 OutputString(help_text_ + "\n"); | 190 OutputString(help_text_ + "\n"); |
189 | 191 |
190 // Sub errors. | 192 // Sub errors. |
191 for (const auto& sub_err : sub_errs_) | 193 for (const auto& sub_err : sub_errs_) |
192 sub_err.InternalPrintToStdout(true); | 194 sub_err.InternalPrintToStdout(true); |
193 } | 195 } |
OLD | NEW |