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
38d8d394
Commit
38d8d394
authored
Jun 30, 2015
by
Jon Skeet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused code in C# codegen
parent
ee835a3f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
47 deletions
+1
-47
csharp_helpers.cc
src/google/protobuf/compiler/csharp/csharp_helpers.cc
+1
-41
csharp_helpers.h
src/google/protobuf/compiler/csharp/csharp_helpers.h
+0
-6
No files found.
src/google/protobuf/compiler/csharp/csharp_helpers.cc
View file @
38d8d394
...
@@ -391,47 +391,7 @@ FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor,
...
@@ -391,47 +391,7 @@ FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor,
}
}
}
}
bool
HasRequiredFields
(
const
Descriptor
*
descriptor
,
std
::
set
<
const
Descriptor
*>*
already_seen
)
{
}
// namespace csharp
if
(
already_seen
->
find
(
descriptor
)
!=
already_seen
->
end
())
{
// The type is already in cache. This means that either:
// a. The type has no required fields.
// b. We are in the midst of checking if the type has required fields,
// somewhere up the stack. In this case, we know that if the type
// has any required fields, they'll be found when we return to it,
// and the whole call to HasRequiredFields() will return true.
// Therefore, we don't have to check if this type has required fields
// here.
return
false
;
}
already_seen
->
insert
(
descriptor
);
// If the type has extensions, an extension with message type could contain
// required fields, so we have to be conservative and assume such an
// extension exists.
if
(
descriptor
->
extension_count
()
>
0
)
{
return
true
;
}
for
(
int
i
=
0
;
i
<
descriptor
->
field_count
();
i
++
)
{
const
FieldDescriptor
*
field
=
descriptor
->
field
(
i
);
if
(
field
->
is_required
())
{
return
true
;
}
if
(
GetCSharpType
(
field
->
type
())
==
CSHARPTYPE_MESSAGE
)
{
if
(
HasRequiredFields
(
field
->
message_type
(),
already_seen
))
{
return
true
;
}
}
}
return
false
;
}
bool
HasRequiredFields
(
const
Descriptor
*
descriptor
)
{
std
::
set
<
const
Descriptor
*>
already_seen
;
return
HasRequiredFields
(
descriptor
,
&
already_seen
);
}
}
// namespace java
}
// namespace compiler
}
// namespace compiler
}
// namespace protobuf
}
// namespace protobuf
}
// namespace google
}
// namespace google
src/google/protobuf/compiler/csharp/csharp_helpers.h
View file @
38d8d394
...
@@ -101,12 +101,6 @@ uint FixedMakeTag(const FieldDescriptor* descriptor);
...
@@ -101,12 +101,6 @@ uint FixedMakeTag(const FieldDescriptor* descriptor);
FieldGeneratorBase
*
CreateFieldGenerator
(
const
FieldDescriptor
*
descriptor
,
int
fieldOrdinal
);
FieldGeneratorBase
*
CreateFieldGenerator
(
const
FieldDescriptor
*
descriptor
,
int
fieldOrdinal
);
bool
HasRequiredFields
(
const
Descriptor
*
descriptor
);
inline
bool
SupportFieldPresence
(
const
FileDescriptor
*
file
)
{
return
file
->
syntax
()
!=
FileDescriptor
::
SYNTAX_PROTO3
;
}
}
// namespace csharp
}
// namespace csharp
}
// namespace compiler
}
// namespace compiler
}
// namespace protobuf
}
// namespace protobuf
...
...
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