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

Unified Diff: tools/gn/source_dir.h

Issue 1155713006: GN: Make file/dir resolving return errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/setup.cc ('k') | tools/gn/source_dir.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/source_dir.h
diff --git a/tools/gn/source_dir.h b/tools/gn/source_dir.h
index 755e0927576f0a928120c58fd1e68128481b156f..43f7e534ab0b7ef1283b5aa036c3ddab14535ef9 100644
--- a/tools/gn/source_dir.h
+++ b/tools/gn/source_dir.h
@@ -13,7 +13,9 @@
#include "base/logging.h"
#include "base/strings/string_piece.h"
+class Err;
class SourceFile;
+class Value;
// Represents a directory within the source tree. Source dirs begin and end in
// slashes.
@@ -34,18 +36,28 @@ class SourceDir {
~SourceDir();
// Resolves a file or dir name relative to this source directory. Will return
- // an empty SourceDir/File on error. Empty input is always an error (it's
- // possible we should say ResolveRelativeDir vs. an empty string should be
- // the source dir, but we require "." instead).
+ // an empty SourceDir/File on error and set the give *err pointer (required).
+ // Empty input is always an error.
//
// If source_root is supplied, these functions will additionally handle the
// case where the input is a system-absolute but still inside the source
// tree. This is the case for some external tools.
SourceFile ResolveRelativeFile(
- const base::StringPiece& p,
+ const Value& p,
+ Err* err,
+ const base::StringPiece& source_root = base::StringPiece()) const;
+ SourceDir ResolveRelativeDir(
+ const Value& p,
+ Err* err,
const base::StringPiece& source_root = base::StringPiece()) const;
+
+ // Like ResolveRelativeDir but takes a separate value (which gets blamed)
+ // and string to use (in cases where a substring has been extracted from the
+ // value, as with label resolution).
SourceDir ResolveRelativeDir(
+ const Value& blame_but_dont_use,
const base::StringPiece& p,
+ Err* err,
const base::StringPiece& source_root = base::StringPiece()) const;
// Resolves this source file relative to some given source root. Returns
« no previous file with comments | « tools/gn/setup.cc ('k') | tools/gn/source_dir.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698