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

Side by Side Diff: tools/gn/ninja_binary_target_writer.h

Issue 26537002: Add a UniqueVector class to GN (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: REview comments, remove npos Created 6 years, 4 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/label_ptr.h ('k') | tools/gn/ninja_binary_target_writer.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 #ifndef TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_ 5 #ifndef TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_
6 #define TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_ 6 #define TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "tools/gn/ninja_target_writer.h" 9 #include "tools/gn/ninja_target_writer.h"
10 #include "tools/gn/toolchain.h" 10 #include "tools/gn/toolchain.h"
11 #include "tools/gn/unique_vector.h"
11 12
12 // Writes a .ninja file for a binary target type (an executable, a shared 13 // Writes a .ninja file for a binary target type (an executable, a shared
13 // library, or a static library). 14 // library, or a static library).
14 class NinjaBinaryTargetWriter : public NinjaTargetWriter { 15 class NinjaBinaryTargetWriter : public NinjaTargetWriter {
15 public: 16 public:
16 NinjaBinaryTargetWriter(const Target* target, 17 NinjaBinaryTargetWriter(const Target* target,
17 const Toolchain* toolchain, 18 const Toolchain* toolchain,
18 std::ostream& out); 19 std::ostream& out);
19 virtual ~NinjaBinaryTargetWriter(); 20 virtual ~NinjaBinaryTargetWriter();
20 21
(...skipping 12 matching lines...) Expand all
33 // Writes the build line for linking the target. Includes newline. 34 // Writes the build line for linking the target. Includes newline.
34 void WriteLinkCommand(const OutputFile& external_output_file, 35 void WriteLinkCommand(const OutputFile& external_output_file,
35 const OutputFile& internal_output_file, 36 const OutputFile& internal_output_file,
36 const std::vector<OutputFile>& object_files); 37 const std::vector<OutputFile>& object_files);
37 38
38 // Writes the stamp line for a source set. These are not linked. 39 // Writes the stamp line for a source set. These are not linked.
39 void WriteSourceSetStamp(const std::vector<OutputFile>& object_files); 40 void WriteSourceSetStamp(const std::vector<OutputFile>& object_files);
40 41
41 // Gets all target dependencies and classifies them, as well as accumulates 42 // Gets all target dependencies and classifies them, as well as accumulates
42 // object files from source sets we need to link. 43 // object files from source sets we need to link.
43 void GetDeps(std::set<OutputFile>* extra_object_files, 44 void GetDeps(UniqueVector<OutputFile>* extra_object_files,
44 std::vector<const Target*>* linkable_deps, 45 UniqueVector<const Target*>* linkable_deps,
45 std::vector<const Target*>* non_linkable_deps) const; 46 UniqueVector<const Target*>* non_linkable_deps) const;
46 47
47 // Classifies the dependency as linkable or nonlinkable with the current 48 // Classifies the dependency as linkable or nonlinkable with the current
48 // target, adding it to the appropriate vector. If the dependency is a source 49 // target, adding it to the appropriate vector. If the dependency is a source
49 // set we should link in, the source set's object files will be appended to 50 // set we should link in, the source set's object files will be appended to
50 // |extra_object_files|. 51 // |extra_object_files|.
51 void ClassifyDependency(const Target* dep, 52 void ClassifyDependency(const Target* dep,
52 std::set<OutputFile>* extra_object_files, 53 UniqueVector<OutputFile>* extra_object_files,
53 std::vector<const Target*>* linkable_deps, 54 UniqueVector<const Target*>* linkable_deps,
54 std::vector<const Target*>* non_linkable_deps) const; 55 UniqueVector<const Target*>* non_linkable_deps) const;
55 56
56 // Writes the implicit dependencies for the link or stamp line. This is 57 // Writes the implicit dependencies for the link or stamp line. This is
57 // the "||" and everything following it on the ninja line. 58 // the "||" and everything following it on the ninja line.
58 // 59 //
59 // The implicit dependencies are the non-linkable deps passed in as an 60 // The implicit dependencies are the non-linkable deps passed in as an
60 // argument, plus the data file depdencies in the target. 61 // argument, plus the data file depdencies in the target.
61 void WriteImplicitDependencies( 62 void WriteImplicitDependencies(
62 const std::vector<const Target*>& non_linkable_deps); 63 const UniqueVector<const Target*>& non_linkable_deps);
63 64
64 Toolchain::ToolType tool_type_; 65 Toolchain::ToolType tool_type_;
65 66
66 DISALLOW_COPY_AND_ASSIGN(NinjaBinaryTargetWriter); 67 DISALLOW_COPY_AND_ASSIGN(NinjaBinaryTargetWriter);
67 }; 68 };
68 69
69 #endif // TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_ 70 #endif // TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_
70 71
OLDNEW
« no previous file with comments | « tools/gn/label_ptr.h ('k') | tools/gn/ninja_binary_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698