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

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

Issue 1869503004: Convert //tools to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, change iwyu fixes for converted directories to include <memory> Created 4 years, 8 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 | « tools/gn/header_checker.cc ('k') | tools/gn/input_conversion.cc » ('j') | 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/import_manager.h" 5 #include "tools/gn/import_manager.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include <memory>
8
8 #include "base/stl_util.h" 9 #include "base/stl_util.h"
9 #include "tools/gn/parse_tree.h" 10 #include "tools/gn/parse_tree.h"
10 #include "tools/gn/scheduler.h" 11 #include "tools/gn/scheduler.h"
11 #include "tools/gn/scope_per_file_provider.h" 12 #include "tools/gn/scope_per_file_provider.h"
12 13
13 namespace { 14 namespace {
14 15
15 // Returns a newly-allocated scope on success, null on failure. 16 // Returns a newly-allocated scope on success, null on failure.
16 Scope* UncachedImport(const Settings* settings, 17 Scope* UncachedImport(const Settings* settings,
17 const SourceFile& file, 18 const SourceFile& file,
18 const ParseNode* node_for_err, 19 const ParseNode* node_for_err,
19 Err* err) { 20 Err* err) {
20 const ParseNode* node = g_scheduler->input_file_manager()->SyncLoadFile( 21 const ParseNode* node = g_scheduler->input_file_manager()->SyncLoadFile(
21 node_for_err->GetRange(), settings->build_settings(), file, err); 22 node_for_err->GetRange(), settings->build_settings(), file, err);
22 if (!node) 23 if (!node)
23 return nullptr; 24 return nullptr;
24 25
25 scoped_ptr<Scope> scope(new Scope(settings->base_config())); 26 std::unique_ptr<Scope> scope(new Scope(settings->base_config()));
26 scope->set_source_dir(file.GetDir()); 27 scope->set_source_dir(file.GetDir());
27 28
28 // Don't allow ScopePerFileProvider to provide target-related variables. 29 // Don't allow ScopePerFileProvider to provide target-related variables.
29 // These will be relative to the imported file, which is probably not what 30 // These will be relative to the imported file, which is probably not what
30 // people mean when they use these. 31 // people mean when they use these.
31 ScopePerFileProvider per_file_provider(scope.get(), false); 32 ScopePerFileProvider per_file_provider(scope.get(), false);
32 33
33 scope->SetProcessingImport(); 34 scope->SetProcessingImport();
34 node->Execute(scope.get(), err); 35 node->Execute(scope.get(), err);
35 if (err->has_error()) 36 if (err->has_error())
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 84 }
84 } 85 }
85 } 86 }
86 87
87 Scope::MergeOptions options; 88 Scope::MergeOptions options;
88 options.skip_private_vars = true; 89 options.skip_private_vars = true;
89 options.mark_dest_used = true; // Don't require all imported values be used. 90 options.mark_dest_used = true; // Don't require all imported values be used.
90 return imported_scope->NonRecursiveMergeTo(scope, options, node_for_err, 91 return imported_scope->NonRecursiveMergeTo(scope, options, node_for_err,
91 "import", err); 92 "import", err);
92 } 93 }
OLDNEW
« no previous file with comments | « tools/gn/header_checker.cc ('k') | tools/gn/input_conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698