Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: tools/gn/scope.cc

Issue 555163004: Remove implicit conversion from scoped_refptr to T* in tools/gn (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/scope.h" 5 #include "tools/gn/scope.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "tools/gn/parse_tree.h" 9 #include "tools/gn/parse_tree.h"
10 #include "tools/gn/template.h" 10 #include "tools/gn/template.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 // Templates. 302 // Templates.
303 for (TemplateMap::const_iterator i = templates_.begin(); 303 for (TemplateMap::const_iterator i = templates_.begin();
304 i != templates_.end(); ++i) { 304 i != templates_.end(); ++i) {
305 if (options.skip_private_vars && IsPrivateVar(i->first)) 305 if (options.skip_private_vars && IsPrivateVar(i->first))
306 continue; // Skip this private template. 306 continue; // Skip this private template.
307 307
308 if (!options.clobber_existing) { 308 if (!options.clobber_existing) {
309 const Template* existing_template = dest->GetTemplate(i->first); 309 const Template* existing_template = dest->GetTemplate(i->first);
310 // Since templates are refcounted, we can check if it's the same one by 310 // Since templates are refcounted, we can check if it's the same one by
311 // comparing pointers. 311 // comparing pointers.
312 if (existing_template && i->second != existing_template) { 312 if (existing_template && i->second.get() != existing_template) {
313 // Rule present in both the source and the dest, and they're not the 313 // Rule present in both the source and the dest, and they're not the
314 // same one. 314 // same one.
315 std::string desc_string(desc_for_err); 315 std::string desc_string(desc_for_err);
316 *err = Err(node_for_err, "Template collision.", 316 *err = Err(node_for_err, "Template collision.",
317 "This " + desc_string + " contains a template \"" + 317 "This " + desc_string + " contains a template \"" +
318 i->first + "\""); 318 i->first + "\"");
319 err->AppendSubErr(Err(i->second->GetDefinitionRange(), "defined here.", 319 err->AppendSubErr(Err(i->second->GetDefinitionRange(), "defined here.",
320 "Which would clobber the one in your current scope")); 320 "Which would clobber the one in your current scope"));
321 err->AppendSubErr(Err(existing_template->GetDefinitionRange(), 321 err->AppendSubErr(Err(existing_template->GetDefinitionRange(),
322 "defined here.", 322 "defined here.",
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 464 }
465 465
466 void Scope::AddProvider(ProgrammaticProvider* p) { 466 void Scope::AddProvider(ProgrammaticProvider* p) {
467 programmatic_providers_.insert(p); 467 programmatic_providers_.insert(p);
468 } 468 }
469 469
470 void Scope::RemoveProvider(ProgrammaticProvider* p) { 470 void Scope::RemoveProvider(ProgrammaticProvider* p) {
471 DCHECK(programmatic_providers_.find(p) != programmatic_providers_.end()); 471 DCHECK(programmatic_providers_.find(p) != programmatic_providers_.end());
472 programmatic_providers_.erase(p); 472 programmatic_providers_.erase(p);
473 } 473 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698