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

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

Issue 1530183005: Special-case paths that appear in libs by not prefixing them with -l. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo in previous patch Created 4 years, 12 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/gn.gyp ('k') | tools/gn/lib_file.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef TOOLS_GN_LIB_FILE_H_
6 #define TOOLS_GN_LIB_FILE_H_
7
8 #include <algorithm>
9 #include <string>
10
11 #include "base/strings/string_piece.h"
12 #include "tools/gn/source_file.h"
13
14 // Represents an entry in "libs" list. Can be either a path (a SourceFile) or
15 // a library name (a string).
16 class LibFile {
17 public:
18 LibFile();
19 explicit LibFile(const base::StringPiece& lib_name);
20 explicit LibFile(const SourceFile& source_file);
21
22 void Swap(LibFile* other);
23 bool is_source_file() const { return name_.empty(); }
24
25 // Returns name, or source_file().value() (whichever is set).
26 const std::string& value() const;
27 const SourceFile& source_file() const;
28
29 bool operator==(const LibFile& other) const {
30 return value() == other.value();
31 }
32 bool operator!=(const LibFile& other) const { return !operator==(other); }
33 bool operator<(const LibFile& other) const { return value() < other.value(); }
34
35 private:
36 std::string name_;
37 SourceFile source_file_;
38 };
39
40 namespace BASE_HASH_NAMESPACE {
41
42 template <>
43 struct hash<LibFile> {
44 std::size_t operator()(const LibFile& v) const {
45 hash<std::string> h;
46 return h(v.value());
47 }
48 };
49
50 } // namespace BASE_HASH_NAMESPACE
51
52 inline void swap(LibFile& lhs, LibFile& rhs) {
53 lhs.Swap(&rhs);
54 }
55
56 #endif // TOOLS_GN_LIB_FILE_H_
OLDNEW
« no previous file with comments | « tools/gn/gn.gyp ('k') | tools/gn/lib_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698