Example #1
0
        public byte [] GetFileContents(ClangFile file)
        {
            ulong size;
            var   ptr = LibClang.clang_getFileContents(Handle, file.Handle, out size);
            var   ret = new byte [size];

            if (size > int.MaxValue)
            {
                throw new InvalidOperationException("The returned file content size was more than Int32.MaxValue, which is unusual.");
            }
            Marshal.Copy(ret, 0, ptr, (int)size);
            return(ret);
        }
Example #2
0
        // HighLevelAPI

        /// <summary>
        /// Find references of a declaration in a specific file.
        /// </summary>
        /// <param name="file">File to search for references.</param>
        /// <param name="visitor">callback that will receive pairs of ClangCursor/ClangSourceRange for
        /// each reference found.
        /// </param>
        /// <returns>One of the FindResult enumerators.</returns>
        public FindResult FindReferenceInFile(ClangFile file, Func <object, ClangCursor, ClangSourceRange, VisitorResult> visitor)
        {
            return(LibClang.clang_findReferencesInFile(source, file.Handle, new CXCursorAndRangeVisitor((ctx, cursor, range) => visitor(ctx, new ClangCursor(cursor), new ClangSourceRange(range)))));
        }
Example #3
0
 public static bool Equals(ClangFile file1, ClangFile file2)
 {
     return(LibClang.clang_File_isEqual(file1.Handle, file2.Handle) != 0);
 }
Example #4
0
 public IndexFileLocation(IntPtr indexFile, ClangFile file, int line, int column, int offset)
     : base(file, line, column, offset)
 {
 }
Example #5
0
 public PhysicalLocation(ClangFile file, int line, int column, int offset)
     : base(line, column)
 {
     File   = file;
     Offset = offset;
 }
Example #6
0
 public bool IsMultipleIncludeGuarded(ClangFile file)
 {
     return(LibClang.clang_isFileMultipleIncludeGuarded(Handle, file.Handle) != 0);
 }
Example #7
0
        // HighLevelAPI

        public FindResult FindIncludesInFile(ClangFile file, Func <ClangCursor, ClangSourceRange, VisitorResult> visitor)
        {
            return(LibClang.clang_findIncludesInFile(Handle, file.Handle, new CXCursorAndRangeVisitor((ctx, cursor, range) => visitor(new ClangCursor(cursor), new ClangSourceRange(range)))));
        }
Example #8
0
 public ClangSourceLocation GetLocationForOffset(ClangFile file, int offset)
 {
     return(new ClangSourceLocation(LibClang.clang_getLocationForOffset(Handle, file.Handle, (uint)offset)));
 }
Example #9
0
 public ClangSourceLocation GetLocation(ClangFile file, int line, int column)
 {
     return(new ClangSourceLocation(LibClang.clang_getLocation(Handle, file.Handle, (uint)line, (uint)column)));
 }