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

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

Issue 229423002: Improve public header file checking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: include static cast for 64 bit Created 6 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/variables.cc ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/visibility.h" 5 #include "tools/gn/visibility.h"
6 6
7 #include "base/strings/string_piece.h" 7 #include "base/strings/string_piece.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "tools/gn/err.h" 9 #include "tools/gn/err.h"
10 #include "tools/gn/filesystem_utils.h" 10 #include "tools/gn/filesystem_utils.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const std::vector<Value>& list = value.list_value(); 71 const std::vector<Value>& list = value.list_value();
72 for (size_t i = 0; i < list.size(); i++) { 72 for (size_t i = 0; i < list.size(); i++) {
73 patterns_.push_back(GetPattern(current_dir, list[i], err)); 73 patterns_.push_back(GetPattern(current_dir, list[i], err));
74 if (err->has_error()) 74 if (err->has_error())
75 return false; 75 return false;
76 } 76 }
77 return true; 77 return true;
78 } 78 }
79 79
80 void Visibility::SetPublic() { 80 void Visibility::SetPublic() {
81 patterns_.clear();
81 patterns_.push_back( 82 patterns_.push_back(
82 VisPattern(VisPattern::RECURSIVE_DIRECTORY, SourceDir(), std::string())); 83 VisPattern(VisPattern::RECURSIVE_DIRECTORY, SourceDir(), std::string()));
83 } 84 }
84 85
85 void Visibility::SetPrivate(const SourceDir& current_dir) { 86 void Visibility::SetPrivate(const SourceDir& current_dir) {
87 patterns_.clear();
86 patterns_.push_back( 88 patterns_.push_back(
87 VisPattern(VisPattern::DIRECTORY, current_dir, std::string())); 89 VisPattern(VisPattern::DIRECTORY, current_dir, std::string()));
88 } 90 }
89 91
90 bool Visibility::CanSeeMe(const Label& label) const { 92 bool Visibility::CanSeeMe(const Label& label) const {
91 for (size_t i = 0; i < patterns_.size(); i++) { 93 for (size_t i = 0; i < patterns_.size(); i++) {
92 if (patterns_[i].Matches(label)) 94 if (patterns_[i].Matches(label))
93 return true; 95 return true;
94 } 96 }
95 return false; 97 return false;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 252
251 // static 253 // static
252 bool Visibility::FillItemVisibility(Item* item, Scope* scope, Err* err) { 254 bool Visibility::FillItemVisibility(Item* item, Scope* scope, Err* err) {
253 const Value* vis_value = scope->GetValue(variables::kVisibility, true); 255 const Value* vis_value = scope->GetValue(variables::kVisibility, true);
254 if (vis_value) 256 if (vis_value)
255 item->visibility().Set(scope->GetSourceDir(), *vis_value, err); 257 item->visibility().Set(scope->GetSourceDir(), *vis_value, err);
256 else // Default to public. 258 else // Default to public.
257 item->visibility().SetPublic(); 259 item->visibility().SetPublic();
258 return !err->has_error(); 260 return !err->has_error();
259 } 261 }
OLDNEW
« no previous file with comments | « tools/gn/variables.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698