internal unsafe EntityInfo(Library.EntityInfo handle, ITranslationUnitItemFactory itemFactory) { _itemFactory = itemFactory; _handle = handle; _name = new string(_handle.name); _usr = new string(_handle.USR); }
private unsafe OverriddenCursorSet(Library.CXCursor* handles, uint count, ITranslationUnitItemFactory factory) { _cursors = new List<Cursor>(); for (uint i = 0; i < count; i++) { _cursors.Add(factory.CreateCursor(handles[i])); } }
internal SourceRange(Library.SourceRange handle, ITranslationUnitItemFactory itemFactory) { Debug.Assert(!handle.IsNull); Handle = handle; Start = itemFactory.CreateSourceLocation(Library.clang_getRangeStart(Handle)); End = itemFactory.CreateSourceLocation(Library.clang_getRangeEnd(Handle)); Debug.Assert(Start <= End); Debug.Assert(Start.File == End.File); }
internal DiagnosticSet(IntPtr handle, ITranslationUnitItemFactory itemFactory) { Handle = handle; _diags = new HashSet<Diagnostic>(); for (uint i = 0; i < Library.clang_getNumDiagnosticsInSet(Handle); i++) { _diags.Add(new Diagnostic(Library.clang_getDiagnosticInSet(Handle, i), itemFactory)); } }
/// <summary> /// Create a new Cursor object. /// </summary> /// <param name="handle">Handle to a non null cursor obect.</param> /// <param name="itemFactory">TranslationUnit's item factory / item cache.</param> internal Cursor(Library.Cursor handle, ITranslationUnitItemFactory itemFactory) { Debug.Assert(!handle.IsNull); Handle = handle; _itemFactory = itemFactory; Kind = Library.clang_getCursorKind(Handle); Library.CXType typeHandle = Library.clang_getCursorType(Handle); if (typeHandle.IsValid) _type = _itemFactory.CreateType(typeHandle); }
internal unsafe static OverriddenCursorSet CreateOverriddenCursorSet(Cursor c, ITranslationUnitItemFactory factory) { Library.CXCursor* overrides; uint count; Library.clang_getOverriddenCursors(c.Handle, &overrides, &count); if (count == 0) return Empty; OverriddenCursorSet result = new OverriddenCursorSet(overrides, count, factory); //Assuming that this only deletes the array allocated above and that the handles remain valid Library.clang_disposeOverriddenCursors(overrides); return result; }
internal unsafe EntityReference(Library.CXIdxEntityRefInfo handle, ITranslationUnitItemFactory itemFactory) { _handle = handle; _itemFactory = itemFactory; if (_handle.referencedEntity != (Library.CXIdxEntityInfo*)IntPtr.Zero) _refedEntity = new EntityInfo(*_handle.referencedEntity, _itemFactory); if (_handle.parentEntity != (Library.CXIdxEntityInfo*)IntPtr.Zero) _parentEntity = new EntityInfo(*_handle.parentEntity, _itemFactory); if(_handle.container != (Library.CXIdxContainerInfo*)IntPtr.Zero) _container = _itemFactory.CreateCursor(_handle.container->cursor); }
internal unsafe SourceLocation(Library.SourceLocation handle, ITranslationUnitItemFactory itemFactory) { Debug.Assert(!handle.IsNull); Handle = handle; _itemFactory = itemFactory; IntPtr file = IntPtr.Zero; uint line, column, offset; Library.clang_getInstantiationLocation(Handle, &file, out line, out column, out offset); Line = (int)line; Column = (int)column; Offset = (int)offset; if (file != IntPtr.Zero) { File = _itemFactory.CreateFile(file); } }
internal unsafe DeclInfo(Library.CXIdxDeclInfo handle, ITranslationUnitItemFactory itemFactory) { _handle = handle; _itemFactory = itemFactory; _entityInfo = new EntityInfo(*_handle.entityInfo, itemFactory); if (handle.semanticContainer != (Library.CXIdxContainerInfo*)IntPtr.Zero) _semanticContainer = _itemFactory.CreateCursor(handle.semanticContainer->cursor); if(handle.lexicalContainer != (Library.CXIdxContainerInfo*)IntPtr.Zero) _lexicalContainer = _itemFactory.CreateCursor(handle.lexicalContainer->cursor); if(handle.declAsContainer != (Library.CXIdxContainerInfo*)IntPtr.Zero) _declAsContainer = _itemFactory.CreateCursor(handle.declAsContainer->cursor); // Debug.Assert(Location == Cursor.Location); }
internal Type(Library.CXType handle, ITranslationUnitItemFactory itemFactory) { Debug.Assert(handle.IsValid); Handle = handle; _itemFactory = itemFactory; }
internal File(IntPtr handle, ITranslationUnitItemFactory itemFactory) { Debug.Assert(handle != IntPtr.Zero); Handle = handle; _itemFactory = itemFactory; }
/// <summary> /// Create a new Diagnostic object. /// </summary> /// <param name="handle">Handle to a diagnostic object.</param> /// <param name="itemFactory">TranslationUnit's item factory / item cache.</param> internal Diagnostic(IntPtr handle, ITranslationUnitItemFactory itemFactory) { _itemFactory = itemFactory; Handle = handle; _ranges = new List<SourceRange>(); }