aboutsummaryrefslogtreecommitdiff
path: root/src/ProtoGen
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2011-05-20 15:50:54 -0500
committerrogerk <devnull@localhost>2011-05-20 15:50:54 -0500
commit445bdcebe78994f09a97fcc95721703c14f1172b (patch)
tree471c601c5b896fea958cfe689d3bc9bd6644bd78 /src/ProtoGen
parent714b8699fe4c87183c6fd7192b47122b1afee932 (diff)
downloadprotobuf-445bdcebe78994f09a97fcc95721703c14f1172b.tar.gz
protobuf-445bdcebe78994f09a97fcc95721703c14f1172b.tar.bz2
protobuf-445bdcebe78994f09a97fcc95721703c14f1172b.zip
Completed adding attributes to all generated types
Diffstat (limited to 'src/ProtoGen')
-rw-r--r--src/ProtoGen/EnumGenerator.cs2
-rw-r--r--src/ProtoGen/MessageGenerator.cs9
-rw-r--r--src/ProtoGen/ServiceGenerator.cs6
-rw-r--r--src/ProtoGen/ServiceInterfaceGenerator.cs11
-rw-r--r--src/ProtoGen/UmbrellaClassGenerator.cs3
5 files changed, 31 insertions, 0 deletions
diff --git a/src/ProtoGen/EnumGenerator.cs b/src/ProtoGen/EnumGenerator.cs
index c1013345..f1ddcbc3 100644
--- a/src/ProtoGen/EnumGenerator.cs
+++ b/src/ProtoGen/EnumGenerator.cs
@@ -47,6 +47,8 @@ namespace Google.ProtocolBuffers.ProtoGen
// TODO(jonskeet): Write out enum descriptors? Can be retrieved from file...
public void Generate(TextGenerator writer)
{
+ writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
+ writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]", GetType().Assembly.GetName().Name, GetType().Assembly.GetName().Version);
writer.WriteLine("{0} enum {1} {{", ClassAccessLevel, Descriptor.Name);
writer.Indent();
foreach (EnumValueDescriptor value in Descriptor.Values)
diff --git a/src/ProtoGen/MessageGenerator.cs b/src/ProtoGen/MessageGenerator.cs
index 9eff86c4..7eded006 100644
--- a/src/ProtoGen/MessageGenerator.cs
+++ b/src/ProtoGen/MessageGenerator.cs
@@ -138,6 +138,9 @@ namespace Google.ProtocolBuffers.ProtoGen
public void Generate(TextGenerator writer)
{
+ writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
+ writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
+ writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]", GetType().Assembly.GetName().Name, GetType().Assembly.GetName().Version);
writer.WriteLine("{0} sealed partial class {1} : pb::{2}Message{3}<{1}, {1}.Builder> {{",
ClassAccessLevel, ClassName,
Descriptor.Proto.ExtensionRangeCount > 0 ? "Extendable" : "Generated",
@@ -181,6 +184,9 @@ namespace Google.ProtocolBuffers.ProtoGen
if (Descriptor.EnumTypes.Count + Descriptor.NestedTypes.Count > 0)
{
writer.WriteLine("#region Nested types");
+ writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
+ writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
+ writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]", GetType().Assembly.GetName().Name, GetType().Assembly.GetName().Version);
writer.WriteLine("public static class Types {");
writer.Indent();
WriteChildren(writer, null, Descriptor.EnumTypes);
@@ -484,6 +490,9 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine(" return (Builder) new Builder().MergeFrom(prototype);");
writer.WriteLine("}");
writer.WriteLine();
+ writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
+ writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
+ writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]", GetType().Assembly.GetName().Name, GetType().Assembly.GetName().Version);
writer.WriteLine("{0} sealed partial class Builder : pb::{2}Builder{3}<{1}, Builder> {{",
ClassAccessLevel, ClassName,
Descriptor.Proto.ExtensionRangeCount > 0 ? "Extendable" : "Generated", RuntimeSuffix);
diff --git a/src/ProtoGen/ServiceGenerator.cs b/src/ProtoGen/ServiceGenerator.cs
index baeee4f4..2c3e6167 100644
--- a/src/ProtoGen/ServiceGenerator.cs
+++ b/src/ProtoGen/ServiceGenerator.cs
@@ -53,6 +53,9 @@ namespace Google.ProtocolBuffers.ProtoGen
public void Generate(TextGenerator writer)
{
+ writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
+ writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
+ writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]", GetType().Assembly.GetName().Name, GetType().Assembly.GetName().Version);
writer.WriteLine("{0} abstract class {1} : pb::IService {{", ClassAccessLevel, Descriptor.Name);
writer.Indent();
@@ -151,6 +154,9 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine(" return new Stub(channel);");
writer.WriteLine("}");
writer.WriteLine();
+ writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
+ writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
+ writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]", GetType().Assembly.GetName().Name, GetType().Assembly.GetName().Version);
writer.WriteLine("{0} class Stub : {1} {{", ClassAccessLevel, GetClassName(Descriptor));
writer.Indent();
writer.WriteLine("internal Stub(pb::IRpcChannel channel) {");
diff --git a/src/ProtoGen/ServiceInterfaceGenerator.cs b/src/ProtoGen/ServiceInterfaceGenerator.cs
index 698b7016..a2df74de 100644
--- a/src/ProtoGen/ServiceInterfaceGenerator.cs
+++ b/src/ProtoGen/ServiceInterfaceGenerator.cs
@@ -105,6 +105,8 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine("[global::System.Runtime.InteropServices.GuidAttribute(\"{0}\")]",
new Guid(options.InterfaceId));
}
+ writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
+ writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]", GetType().Assembly.GetName().Name, GetType().Assembly.GetName().Version);
writer.WriteLine("{0} partial interface I{1} {{", ClassAccessLevel, Descriptor.Name);
writer.Indent();
@@ -142,6 +144,9 @@ namespace Google.ProtocolBuffers.ProtoGen
{
if (Descriptor.File.CSharpOptions.ClsCompliance)
writer.WriteLine("[global::System.CLSCompliant(false)]");
+ writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
+ writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
+ writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]", GetType().Assembly.GetName().Name, GetType().Assembly.GetName().Version);
writer.WriteLine("{0} partial class {1} : I{1}, pb::IRpcDispatch, global::System.IDisposable {{",
ClassAccessLevel, Descriptor.Name);
writer.Indent();
@@ -186,6 +191,9 @@ namespace Google.ProtocolBuffers.ProtoGen
{
if (Descriptor.File.CSharpOptions.ClsCompliance)
writer.WriteLine("[global::System.CLSCompliant(false)]");
+ writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
+ writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
+ writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]", GetType().Assembly.GetName().Name, GetType().Assembly.GetName().Version);
writer.WriteLine("public partial class Dispatch : pb::IRpcDispatch, global::System.IDisposable {");
writer.Indent();
writer.WriteLine("private readonly bool dispose;");
@@ -234,6 +242,9 @@ namespace Google.ProtocolBuffers.ProtoGen
{
if (Descriptor.File.CSharpOptions.ClsCompliance)
writer.WriteLine("[global::System.CLSCompliant(false)]");
+ writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
+ writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
+ writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]", GetType().Assembly.GetName().Name, GetType().Assembly.GetName().Version);
writer.WriteLine(
"public partial class ServerStub : pb::IRpcServerStub, global::System.IDisposable {");
writer.Indent();
diff --git a/src/ProtoGen/UmbrellaClassGenerator.cs b/src/ProtoGen/UmbrellaClassGenerator.cs
index 4e5f8ae4..36a9e4cc 100644
--- a/src/ProtoGen/UmbrellaClassGenerator.cs
+++ b/src/ProtoGen/UmbrellaClassGenerator.cs
@@ -161,6 +161,9 @@ namespace Google.ProtocolBuffers.ProtoGen
{
writer.WriteLine("[global::System.Diagnostics.Contracts.ContractVerificationAttribute(false)]");
}
+ writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
+ writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
+ writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]", GetType().Assembly.GetName().Name, GetType().Assembly.GetName().Version);
writer.WriteLine("{0} static partial class {1} {{", ClassAccessLevel,
Descriptor.CSharpOptions.UmbrellaClassname);
writer.WriteLine();