Esempio n. 1
0
        public override bool VisitDeclaration(Declaration decl)
        {
            if (AlreadyVisited(decl))
            {
                return(false);
            }

            if (decl.GenerationKind == GenerationKind.None)
            {
                return(true);
            }

            if (!CheckDeclarationAccess(decl))
            {
                Log.Debug("Decl '{0}' was ignored due to invalid access",
                          decl.Name);
                decl.ExplicitlyIgnore();
                return(true);
            }

            if (decl.IsDependent)
            {
                decl.ExplicitlyIgnore();
                Log.Debug("Decl '{0}' was ignored due to dependent context",
                          decl.Name);
                return(true);
            }

            return(true);
        }
Esempio n. 2
0
        public override bool VisitDeclaration(Declaration decl)
        {
            if (AlreadyVisited(decl))
            {
                return(false);
            }

            if (decl.GenerationKind == GenerationKind.None)
            {
                return(true);
            }

            if (decl.IsInvalid)
            {
                decl.ExplicitlyIgnore();
                return(true);
            }

            if (decl.IsDeprecated && !Options.GenerateDeprecatedDeclarations)
            {
                Diagnostics.Debug("Decl '{0}' was ignored due to being deprecated", decl.Name);
                decl.ExplicitlyIgnore();
                return(true);
            }

            if (!CheckDeclarationAccess(decl))
            {
                Diagnostics.Debug("Decl '{0}' was ignored due to invalid access",
                                  decl.Name);
                decl.GenerationKind = decl is Field ? GenerationKind.Internal : GenerationKind.None;
            }

            return(true);
        }
Esempio n. 3
0
        public override bool VisitDeclaration(Declaration decl)
        {
            if (AlreadyVisited(decl))
                return false;

            if (decl.GenerationKind == GenerationKind.None)
                return true;

            if (!CheckDeclarationAccess(decl))
            {
                Log.Debug("Decl '{0}' was ignored due to invalid access",
                    decl.Name);
                decl.ExplicitlyIgnore();
                return true;
            }

            if (decl.IsDependent)
            {
                decl.ExplicitlyIgnore();
                Log.Debug("Decl '{0}' was ignored due to dependent context",
                    decl.Name);
                return true;
            }

            return true;
        }
Esempio n. 4
0
        public override bool VisitDeclaration(Declaration decl)
        {
            if (!base.VisitDeclaration(decl))
            {
                return(false);
            }

            if (!Options.CheckSymbols || Options.IsCLIGenerator)
            {
                return(false);
            }

            var mangledDecl = decl as IMangledDecl;
            var method      = decl as Method;

            if (decl.IsGenerated && mangledDecl != null &&
                !(method != null && (method.IsPure || method.IsSynthetized)) &&
                !VisitMangledDeclaration(mangledDecl))
            {
                decl.ExplicitlyIgnore();
                return(false);
            }

            return(true);
        }
Esempio n. 5
0
        public override bool VisitDeclaration(Declaration decl)
        {
            if (!base.VisitDeclaration(decl))
            {
                return(false);
            }

            if (!Options.CheckSymbols || Options.IsCLIGenerator)
            {
                return(false);
            }

            var mangledDecl = decl as IMangledDecl;
            var method      = decl as Method;

            if (decl.IsGenerated && mangledDecl != null &&
                // virtual functions cannot really be inlined and
                // we don't need their symbols anyway as we call them through the v-table
                !(method != null && (method.IsVirtual || method.IsSynthetized)) &&
                !VisitMangledDeclaration(mangledDecl))
            {
                decl.ExplicitlyIgnore();
                return(false);
            }

            return(true);
        }
        public override bool VisitDeclaration(Declaration decl)
        {
            if (!base.VisitDeclaration(decl))
            {
                return(false);
            }

            // Do not clean up namespace names since it can mess up with the
            // names of anonymous or the global namespace.
            if (decl is Namespace)
            {
                return(true);
            }

            // types with empty names are assumed to be private
            if (decl is Class && string.IsNullOrWhiteSpace(decl.Name))
            {
                decl.Name = decl.Namespace.Name == "_" ? "__" : "_";
                decl.ExplicitlyIgnore();
                return(true);
            }

            var function = decl as Function;
            var method   = function as Method;

            if ((function == null || !function.IsOperator) && !(decl is Enumeration) &&
                (method == null || method.Kind == CXXMethodKind.Normal))
            {
                decl.Name = CheckName(decl.Name);
            }

            return(true);
        }
Esempio n. 7
0
        public override bool VisitDeclaration(Declaration decl)
        {
            if (!base.VisitDeclaration(decl))
            {
                return(false);
            }

            // Do not clean up namespace names since it can mess up with the
            // names of anonymous or the global namespace.
            if (decl is Namespace)
            {
                return(true);
            }

            // types with empty names are assumed to be private
            if (decl is Class && string.IsNullOrWhiteSpace(decl.Name))
            {
                decl.Name = decl.Namespace.Name == "_" ? "__" : "_";
                decl.ExplicitlyIgnore();
                return(true);
            }

            Function function = decl as Function;

            if ((function == null || !function.IsOperator) && !(decl is Enumeration))
            {
                decl.Name = CheckName(decl.Name);
            }

            StringHelpers.CleanupText(ref decl.DebugText);
            return(true);
        }
        public override bool VisitDeclaration(Declaration decl)
        {
            if (!base.VisitDeclaration(decl))
                return false;

            // Do not clean up namespace names since it can mess up with the
            // names of anonymous or the global namespace.
            if (decl is Namespace)
                return true;

            // types with empty names are assumed to be private
            if (decl is Class && string.IsNullOrWhiteSpace(decl.Name))
            {
                decl.Name = decl.Namespace.Name == "_" ? "__" : "_";
                decl.ExplicitlyIgnore();
                return true;
            }

            Function function = decl as Function;
            if ((function == null || !function.IsOperator) && !(decl is Enumeration))
                decl.Name = CheckName(decl.Name);

            StringHelpers.CleanupText(ref decl.DebugText);
            return true;
        }
Esempio n. 9
0
 private static void IgnorePrivateDeclaration(Declaration declaration)
 {
     if (declaration.Name != null &&
         (declaration.Name.StartsWith("Private", StringComparison.Ordinal) ||
          declaration.Name.EndsWith("Private", StringComparison.Ordinal)))
     {
         declaration.ExplicitlyIgnore();
     }
     else
     {
         DeclarationContext declarationContext = declaration as DeclarationContext;
         if (declarationContext != null)
         {
             IgnorePrivateDeclarations(declarationContext);
         }
     }
 }
Esempio n. 10
0
        public override bool VisitDeclaration(Declaration decl)
        {
            var options = Driver.Options;
            if (!options.CheckSymbols || options.IsCLIGenerator)
                return false;

            var mangledDecl = decl as IMangledDecl;
            var method = decl as Method;
            if (mangledDecl != null && !(method != null && (method.IsPure || method.IsSynthetized)) &&
                !VisitMangledDeclaration(mangledDecl))
            {
                decl.ExplicitlyIgnore();
                return false;
            }

            return base.VisitDeclaration(decl);
        }
Esempio n. 11
0
        private bool CheckForSymbol(Declaration decl)
        {
            var mangledDecl = decl as IMangledDecl;
            var method      = decl as Method;

            if (decl.IsGenerated && mangledDecl != null &&
                // virtual functions cannot really be inlined and
                // we don't need their symbols anyway as we call them through the v-table
                !(method != null && (method.IsVirtual || method.IsSynthetized)) &&
                !VisitMangledDeclaration(mangledDecl))
            {
                decl.ExplicitlyIgnore();
                return(false);
            }

            return(true);
        }
Esempio n. 12
0
        void CheckIgnoreMacros(Declaration decl, IEnumerable<MacroExpansion> expansions)
        {
            if (expansions.Any(e => e.Text == Prefix + "_IGNORE" &&
                                    e.MacroLocation != MacroLocation.ClassBody &&
                                    e.MacroLocation != MacroLocation.FunctionBody &&
                                    e.MacroLocation != MacroLocation.FunctionParameters))
            {
                Log.Debug("Decl '{0}' was ignored due to ignore macro",
                    decl.Name);
                decl.ExplicitlyIgnore();
            }

            if (expansions.Any(e => e.Text == Prefix + "_IGNORE_GEN" &&
                                    e.MacroLocation != MacroLocation.ClassBody &&
                                    e.MacroLocation != MacroLocation.FunctionBody &&
                                    e.MacroLocation != MacroLocation.FunctionParameters))
                decl.GenerationKind = GenerationKind.Internal;
        }
Esempio n. 13
0
        void CheckIgnoreMacros(Declaration decl, IEnumerable <MacroExpansion> expansions)
        {
            if (expansions.Any(e => e.Text == Prefix + "_IGNORE" &&
                               e.MacroLocation != MacroLocation.ClassBody &&
                               e.MacroLocation != MacroLocation.FunctionBody &&
                               e.MacroLocation != MacroLocation.FunctionParameters))
            {
                Diagnostics.Debug("Decl '{0}' was ignored due to ignore macro",
                                  decl.Name);
                decl.ExplicitlyIgnore();
            }

            if (expansions.Any(e => e.Text == Prefix + "_IGNORE_GEN" &&
                               e.MacroLocation != MacroLocation.ClassBody &&
                               e.MacroLocation != MacroLocation.FunctionBody &&
                               e.MacroLocation != MacroLocation.FunctionParameters))
            {
                decl.GenerationKind = GenerationKind.Internal;
            }
        }
Esempio n. 14
0
 private static void IgnorePrivateDeclaration(Declaration declaration)
 {
     if (declaration.Name != null &&
         (declaration.Name.StartsWith("Private", System.StringComparison.Ordinal) ||
          declaration.Name.EndsWith("Private", System.StringComparison.Ordinal)))
     {
         declaration.ExplicitlyIgnore();
     }
     else
     {
         DeclarationContext declarationContext = declaration as DeclarationContext;
         if (declarationContext != null)
         {
             IgnorePrivateDeclarations(declarationContext);
         }
     }
 }
 public override bool VisitDeclaration(Declaration decl)
 {
     if (decl.Namespace != null && decl.TranslationUnit.IsSystemHeader)
         decl.ExplicitlyIgnore();
     return base.VisitDeclaration(decl);
 }