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

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

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 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/filesystem_utils.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 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/header_checker.h" 5 #include "tools/gn/header_checker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 19 matching lines...) Expand all
30 bool is_generated; 30 bool is_generated;
31 }; 31 };
32 32
33 // If the given file is in the "gen" folder, trims this so it treats the gen 33 // If the given file is in the "gen" folder, trims this so it treats the gen
34 // directory as the source root: 34 // directory as the source root:
35 // //out/Debug/gen/foo/bar.h -> //foo/bar.h 35 // //out/Debug/gen/foo/bar.h -> //foo/bar.h
36 // If the file isn't in the generated root, returns the input unchanged. 36 // If the file isn't in the generated root, returns the input unchanged.
37 SourceFile RemoveRootGenDirFromFile(const Target* target, 37 SourceFile RemoveRootGenDirFromFile(const Target* target,
38 const SourceFile& file) { 38 const SourceFile& file) {
39 const SourceDir& gen = target->settings()->toolchain_gen_dir(); 39 const SourceDir& gen = target->settings()->toolchain_gen_dir();
40 if (!gen.is_null() && base::StartsWithASCII(file.value(), gen.value(), true)) 40 if (!gen.is_null() && base::StartsWith(file.value(), gen.value(),
41 base::CompareCase::SENSITIVE))
41 return SourceFile("//" + file.value().substr(gen.value().size())); 42 return SourceFile("//" + file.value().substr(gen.value().size()));
42 return file; 43 return file;
43 } 44 }
44 45
45 // This class makes InputFiles on the stack as it reads files to check. When 46 // This class makes InputFiles on the stack as it reads files to check. When
46 // we throw an error, the Err indicates a locatin which has a pointer to 47 // we throw an error, the Err indicates a locatin which has a pointer to
47 // an InputFile that must persist as long as the Err does. 48 // an InputFile that must persist as long as the Err does.
48 // 49 //
49 // To make this work, this function creates a clone of the InputFile managed 50 // To make this work, this function creates a clone of the InputFile managed
50 // by the InputFileManager so the error can refer to something that 51 // by the InputFileManager so the error can refer to something that
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 if (targets_with_other_toolchains.size() + 575 if (targets_with_other_toolchains.size() +
575 targets_with_matching_toolchains.size() > 1) 576 targets_with_matching_toolchains.size() > 1)
576 msg += "at least one of "; 577 msg += "at least one of ";
577 msg += "which should somehow be reachable."; 578 msg += "which should somehow be reachable.";
578 579
579 // Danger: must call CreatePersistentRange to put in Err. 580 // Danger: must call CreatePersistentRange to put in Err.
580 return Err(CreatePersistentRange(source_file, range), 581 return Err(CreatePersistentRange(source_file, range),
581 "Include not allowed.", msg); 582 "Include not allowed.", msg);
582 } 583 }
583 584
OLDNEW
« no previous file with comments | « tools/gn/filesystem_utils.cc ('k') | tools/gn/input_conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698