Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
6793c1af
Commit
6793c1af
authored
Apr 05, 2010
by
kenton@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use full paths when writing MSVS-style errors. Patch from Oleg Smolsky.
parent
eeb8fd7d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
command_line_interface.cc
src/google/protobuf/compiler/command_line_interface.cc
+13
-3
command_line_interface_unittest.cc
...ogle/protobuf/compiler/command_line_interface_unittest.cc
+1
-1
No files found.
src/google/protobuf/compiler/command_line_interface.cc
View file @
6793c1af
...
...
@@ -182,14 +182,23 @@ bool TryCreateParentDirectory(const string& prefix, const string& filename) {
class
CommandLineInterface
::
ErrorPrinter
:
public
MultiFileErrorCollector
,
public
io
::
ErrorCollector
{
public
:
ErrorPrinter
(
ErrorFormat
format
)
:
format_
(
format
)
{}
ErrorPrinter
(
ErrorFormat
format
,
DiskSourceTree
*
tree
=
NULL
)
:
format_
(
format
),
tree_
(
tree
)
{}
~
ErrorPrinter
()
{}
// implements MultiFileErrorCollector ------------------------------
void
AddError
(
const
string
&
filename
,
int
line
,
int
column
,
const
string
&
message
)
{
cerr
<<
filename
;
// Print full path when running under MSVS
std
::
string
dfile
;
if
(
format_
==
CommandLineInterface
::
ERROR_FORMAT_MSVS
&&
tree_
!=
NULL
&&
tree_
->
VirtualFileToDiskFile
(
filename
,
&
dfile
))
{
cerr
<<
dfile
;
}
else
{
cerr
<<
filename
;
}
// Users typically expect 1-based line/column numbers, so we add 1
// to each here.
...
...
@@ -215,6 +224,7 @@ class CommandLineInterface::ErrorPrinter : public MultiFileErrorCollector,
private
:
const
ErrorFormat
format_
;
DiskSourceTree
*
tree_
;
};
// -------------------------------------------------------------------
...
...
@@ -583,7 +593,7 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
}
// Allocate the Importer.
ErrorPrinter
error_collector
(
error_format_
);
ErrorPrinter
error_collector
(
error_format_
,
&
source_tree
);
Importer
importer
(
&
source_tree
,
&
error_collector
);
vector
<
const
FileDescriptor
*>
parsed_files
;
...
...
src/google/protobuf/compiler/command_line_interface_unittest.cc
View file @
6793c1af
...
...
@@ -1153,7 +1153,7 @@ TEST_F(CommandLineInterfaceTest, MsvsFormatErrors) {
"--proto_path=$tmpdir --error_format=msvs foo.proto"
);
ExpectErrorText
(
"foo.proto(2) : error in column=1: Expected top-level statement "
"
$tmpdir/
foo.proto(2) : error in column=1: Expected top-level statement "
"(e.g.
\"
message
\"
).
\n
"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment