Class TIndex

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TIndex = class(TInterfacedObject, IIndex)

Description

Implements IIndex

Hierarchy

  • TInterfacedObject
  • TIndex

Overview

Methods

Public constructor Create(const AExcludeDeclarationsFromPCH, ADisplayDiagnostics: Boolean);
Public destructor Destroy; override;

Description

Methods

Public constructor Create(const AExcludeDeclarationsFromPCH, ADisplayDiagnostics: Boolean);

Provides a shared context for creating translation units.

Example:

      var
        Idx: IIndex;
        TU: ITranslationUnit;
      begin
        Idx := TIndex.Create(True, True);

        // IndexTest.pch was produced with the following command:
        // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
        TU := Idx.CreateTranslationUnit('IndexTest.pch');

        // This will load all the symbols from 'IndexTest.pch'
        TU.Cursor.VisitChildren(MyVisitor);

        // This will load all the symbols from 'IndexTest.c', excluding symbols
        // from 'IndexTest.pch'.
        TU := Idx.CreateTranslationUnitFromSource('IndexTest.c', ['-Xclang',
          '-include-pch=IndexTest.pch']);
        TU.Cursor.VisitChildren(MyVisitor);
      end;

This process of creating the 'pch', loading it separately, and using it (via -include-pch) allows 'AExcludeDeclsFromPCH' to remove redundant callbacks (which gives the indexer the same performance benefit as the compiler).

Parameters
AExcludeDeclarationsFromPCH
When True, allows enumeration of "local" declarations (when loading any new translation units). A "local" declaration is one that belongs in the translation unit itself and not in a precompiled header that was used by the translation unit. If False, all declarations will be enumerated.
ADisplayDiagnostics
TBD
Public destructor Destroy; override;
 

Generated by PasDocEx, based on PasDoc 0.14.0.