Ejemplo n.º 1
0
        internal static SourceLocation GetSpellingLocation(
            CXSourceLocation cxSourceLocation,
            TranslationUnit translationUnit)
        {
            Debug.Assert(translationUnit != null);
            translationUnit.ThrowIfDisposed();

            if (NativeMethods.clang_equalLocations(cxSourceLocation, NullLocation) != 0)
            {
                return(null);
            }
            else
            {
                CXFileImpl *sourceFilePtr;
                uint        line;
                uint        column;
                uint        offset;
                NativeMethods.clang_getSpellingLocation(
                    cxSourceLocation,
                    &sourceFilePtr,
                    &line,
                    &column,
                    &offset);
                return(new SourceLocation(
                           cxSourceLocation,
                           new SourceFile(sourceFilePtr, translationUnit),
                           line,
                           column,
                           offset));
            }
        }
Ejemplo n.º 2
0
        private SourceLocation(
            CXSourceLocation cxSourceLocation,
            SourceFile soureFile,
            uint line,
            uint column,
            uint offset)
        {
            Debug.Assert(soureFile != null);
            soureFile.ThrowIfDisposed();

            Struct     = cxSourceLocation;
            SourceFile = soureFile;
            Line       = line;
            Column     = column;
            Offset     = offset;
        }
 public static extern void clang_getFileLocation(
     CXSourceLocation location,
     CXFileImpl **file,
     uint *line,
     uint *column,
     uint *offset);
 public static extern CXCursor clang_getCursor(
     CXTranslationUnitImpl *arg1,
     CXSourceLocation arg2);
 public static extern void clang_getPresumedLocation(
     CXSourceLocation location,
     CXString *filename,
     uint *line,
     uint *column);
 public static extern CXSourceRange clang_getRange(
     CXSourceLocation begin,
     CXSourceLocation end);
 public static extern int clang_Location_isFromMainFile(
     CXSourceLocation location);
 public static extern int clang_Location_isInSystemHeader(
     CXSourceLocation location);
 public static extern uint clang_equalLocations(
     CXSourceLocation loc1,
     CXSourceLocation loc2);