Пример #1
0
        public static CXRemapping GetRemappingsFromFileList(ReadOnlySpan <string> filePaths)
        {
            using var marshaledPaths = new MarshaledStringArray(filePaths);
            var pMarshaledPaths = stackalloc sbyte *[filePaths.Length];

            marshaledPaths.Fill(pMarshaledPaths);
            return((CXRemapping)clang.getRemappingsFromFileList(pMarshaledPaths, (uint)filePaths.Length));
        }
Пример #2
0
        public static CXTranslationUnit Parse(CXIndex index, string sourceFileName, ReadOnlySpan <string> commandLineArgs, ReadOnlySpan <CXUnsavedFile> unsavedFiles, CXTranslationUnit_Flags options)
        {
            using var marshaledSourceFileName  = new MarshaledString(sourceFileName);
            using var marshaledCommandLineArgs = new MarshaledStringArray(commandLineArgs);

            fixed(CXUnsavedFile *pUnsavedFiles = unsavedFiles)
            {
                var pCommandLineArgs = stackalloc sbyte *[commandLineArgs.Length];

                marshaledCommandLineArgs.Fill(pCommandLineArgs);
                return(clang.parseTranslationUnit(index, marshaledSourceFileName, pCommandLineArgs, commandLineArgs.Length, pUnsavedFiles, (uint)unsavedFiles.Length, (uint)options));
            }
        }
Пример #3
0
        public bool TryIndexSourceFileFullArgv(CXClientData clientData, ReadOnlySpan <IndexerCallbacks> indexCallbacks, CXIndexOptFlags indexOptions, string sourceFilename, ReadOnlySpan <string> commandLineArgs, ReadOnlySpan <CXUnsavedFile> unsavedFiles, out CXTranslationUnit tu, CXTranslationUnit_Flags tuOptions)
        {
            using var marshaledSourceFilename  = new MarshaledString(sourceFilename);
            using var marshaledCommandLineArgs = new MarshaledStringArray(commandLineArgs);

            fixed(IndexerCallbacks *pIndexCallbacks = indexCallbacks)
            fixed(CXUnsavedFile * pUnsavedFiles = unsavedFiles)
            fixed(CXTranslationUnit * pTU       = &tu)
            {
                var pCommandLineArgs = stackalloc sbyte *[commandLineArgs.Length];

                marshaledCommandLineArgs.Fill(pCommandLineArgs);
                return(clang.indexSourceFileFullArgv(this, clientData, pIndexCallbacks, (uint)indexCallbacks.Length, (uint)indexOptions, marshaledSourceFilename, pCommandLineArgs, commandLineArgs.Length, pUnsavedFiles, (uint)unsavedFiles.Length, (CXTranslationUnitImpl **)pTU, (uint)tuOptions) == 0);
            }
        }