Esempio n. 1
0
 private void CollectSymbols(string outputDir, string library)
 {
     using (var linkerOptions = new LinkerOptions())
     {
         linkerOptions.AddLibraryDirs(outputDir);
         var output = GetOutputFile(library);
         linkerOptions.AddLibraries(output);
         using (var parserResult = Parser.ClangParser.ParseLibrary(linkerOptions))
         {
             if (parserResult.Kind == ParserResultKind.Success)
             {
                 lock (@lock)
                 {
                     for (uint i = 0; i < parserResult.LibrariesCount; i++)
                     {
                         var nativeLibrary = ClangParser.ConvertLibrary(parserResult.GetLibraries(i));
                         Context.Symbols.Libraries.Add(nativeLibrary);
                         Context.Symbols.IndexSymbols();
                     }
                 }
             }
             else
             {
                 Diagnostics.Error($"Parsing of {Path.Combine(outputDir, output)} failed.");
             }
         }
     }
 }
Esempio n. 2
0
        public bool ParseLibraries()
        {
            ClangParser.LibraryParsed += OnFileParsed;
            foreach (Module module in Options.Modules)
            {
                using var linkerOptions = new LinkerOptions(Context.LinkerOptions);
                foreach (string libraryDir in module.LibraryDirs)
                {
                    linkerOptions.AddLibraryDirs(libraryDir);
                }

                foreach (string library in module.Libraries)
                {
                    if (!Context.Symbols.Libraries.Any(( NativeLibrary l ) => l.FileName == library))
                    {
                        linkerOptions.AddLibraries(library);
                    }
                }

                using ParserResult parserResult = ClangParser.ParseLibrary(linkerOptions);
                if (parserResult.Kind == ParserResultKind.Success)
                {
                    for (uint num = 0u; num < parserResult.LibrariesCount; num++)
                    {
                        Context.Symbols.Libraries.Add(ClangParser.ConvertLibrary(parserResult.GetLibraries(num)));
                    }
                }
            }

            ClangParser.LibraryParsed -= OnFileParsed;
            Context.Symbols.IndexSymbols();
            SortModulesByDependencies();
            return(true);
        }
Esempio n. 3
0
        public bool ParseLibraries()
        {
            ClangParser.LibraryParsed += OnFileParsed;
            foreach (var module in Options.Modules)
            {
                using (var linkerOptions = new LinkerOptions())
                {
                    foreach (var libraryDir in module.LibraryDirs)
                    {
                        linkerOptions.AddLibraryDirs(libraryDir);
                    }

                    foreach (string library in module.Libraries)
                    {
                        if (Context.Symbols.Libraries.Any(l => l.FileName == library))
                        {
                            continue;
                        }
                        linkerOptions.AddLibraries(library);
                    }

                    using (var res = ClangParser.ParseLibrary(linkerOptions))
                    {
                        if (res.Kind != ParserResultKind.Success)
                        {
                            continue;
                        }

                        for (uint i = 0; i < res.LibrariesCount; i++)
                        {
                            Context.Symbols.Libraries.Add(ClangParser.ConvertLibrary(res.GetLibraries(i)));
                        }
                    }
                }
            }
            ClangParser.LibraryParsed -= OnFileParsed;

            Context.Symbols.IndexSymbols();
            SortModulesByDependencies();

            return(true);
        }