class ASTUnit
Declaration
class ASTUnit { /* full declaration omitted */ };
Description
Utility class for loading a ASTContext from an AST file.
Declared at: clang/include/clang/Frontend/ASTUnit.h:89
Member Variables
- private std::shared_ptr<LangOptions> LangOpts
- private IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diagnostics
- private IntrusiveRefCntPtr<clang::FileManager> FileMgr
- private IntrusiveRefCntPtr<clang::SourceManager> SourceMgr
- private IntrusiveRefCntPtr<clang::InMemoryModuleCache> ModuleCache
- private std::unique_ptr<HeaderSearch> HeaderInfo
- private IntrusiveRefCntPtr<clang::TargetInfo> Target
- private std::shared_ptr<Preprocessor> PP
- private IntrusiveRefCntPtr<clang::ASTContext> Ctx
- private std::shared_ptr<TargetOptions> TargetOpts
- private std::shared_ptr<HeaderSearchOptions> HSOpts
- private std::shared_ptr<PreprocessorOptions> PPOpts
- private IntrusiveRefCntPtr<clang::ASTReader> Reader
- private bool HadModuleLoaderFatalFailure = false
- private std::unique_ptr<ASTWriterData> WriterData
- private clang::FileSystemOptions FileSystemOpts
- private std::unique_ptr<ASTConsumer> Consumer
- The AST consumer that received information about the translation unit as it was parsed or loaded.
- private std::unique_ptr<Sema> TheSema
- The semantic analysis object used to type-check the translation unit.
- private std::shared_ptr<CompilerInvocation> Invocation
- Optional owned invocation, just used to make the invocation used in LoadFromCommandLine available.
- private clang::TrivialModuleLoader ModuleLoader
- Fake module loader: the AST unit doesn't need to load any modules.
- private bool OnlyLocalDecls = false
- private clang::CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None
- Whether to capture any diagnostics produced.
- private bool MainFileIsAST
- Track whether the main file was loaded from an AST or not.
- private clang::TranslationUnitKind TUKind = TU_Complete
- What kind of translation unit this AST represents.
- private bool WantTiming
- Whether we should time each operation.
- private bool OwnsRemappedFileBuffers = true
- Whether the ASTUnit should delete the remapped buffers.
- private std::vector<Decl*> TopLevelDecls
- Track the top-level decls which appeared in an ASTUnit which was loaded from a source file.
- private clang::ASTUnit::FileDeclsTy FileDecls
- Map from FileID to the file-level declarations that it contains. The files and decls are only local (and non-preamble) ones.
- private std::string OriginalSourceFile
- The name of the original source file used to generate this ASTUnit.
- private SmallVector<clang::ASTUnit::StandaloneDiagnostic, 4> PreambleDiagnostics
- The set of diagnostics produced when creating the preamble.
- private SmallVector<clang::StoredDiagnostic, 4> StoredDiagnostics
- The set of diagnostics produced when creating this translation unit.
- private SmallVector<clang::StoredDiagnostic, 4> FailedParseDiagnostics
- The set of diagnostics produced when failing to parse, e.g. due to failure to load the PCH.
- private unsigned int NumStoredDiagnosticsFromDriver = 0
- Diagnostics that come from the driver are retained from one parse to the next.
- private unsigned int PreambleRebuildCountdown = 0
- If zero, we will never build a precompiled preamble. Otherwise, it's treated as a counter that decrements each time we reparse without the benefit of a precompiled preamble. When it hits 1, we'll attempt to rebuild the precompiled header. This way, if building the precompiled preamble fails, we won't try again for some number of calls.
- private unsigned int PreambleCounter = 0
- Counter indicating how often the preamble was build in total.
- private llvm::StringMap<SourceLocation> PreambleSrcLocCache
- Cache contains only source locations from preamble so it is guaranteed that they stay valid when the SourceManager is recreated. This cache is used when loading preamble to increase performance of that loading. It must be cleared when preamble is recreated.
- private llvm::Optional<PrecompiledPreamble> Preamble
- The contents of the preamble.
- private std::unique_ptr<llvm::MemoryBuffer> SavedMainFileBuffer
- When non-NULL, this is the buffer used to store the contents of the main file when it has been padded for use with the precompiled preamble.
- private unsigned int NumWarningsInPreamble = 0
- This value will be used to restore the state of the \c DiagnosticsEngine object when re-using the precompiled preamble. Note that only the number of warnings matters, since we will not save the preamble when any errors are present.
- private std::vector<serialization::DeclID> TopLevelDeclsInPreamble
- A list of the serialization ID numbers for each of the top-level declarations parsed within the precompiled preamble.
- private bool ShouldCacheCodeCompletionResults
- Whether we should be caching code-completion results.
- private bool IncludeBriefCommentsInCodeCompletion
- Whether to include brief documentation within the set of code completions cached.
- private bool UserFilesAreVolatile
- True if non-system source files should be treated as volatile (likely to change while trying to use them).
- private std::shared_ptr<GlobalCodeCompletionAllocator> CachedCompletionAllocator
- Allocator used to store cached code completions.
- private std::unique_ptr<CodeCompletionTUInfo> CCTUInfo
- private std::vector<CachedCodeCompletionResult> CachedCompletionResults
- The set of cached code-completion results.
- private llvm::StringMap<unsigned int> CachedCompletionTypes
- A mapping from the formatted type name to a unique number for that type, which is used for type equality comparisons.
- private unsigned int CompletionCacheTopLevelHashValue = 0
- This hash value is used to determine when we need to refresh the global code-completion cache.
- private unsigned int PreambleTopLevelHashValue = 0
- This hash value is used to determine when we need to refresh the global code-completion cache after a rebuild of the precompiled preamble.
- private unsigned int CurrentTopLevelHashValue = 0
- The current hash value for the top-level declaration and macro definition names
- private unsigned int UnsafeToFree
- Bit used by CIndex to mark when a translation unit may be in an inconsistent state, and is not safe to free.
- private clang::SkipFunctionBodiesScope SkipFunctionBodies = SkipFunctionBodiesScope::None
- private clang::ASTUnit::ConcurrencyState ConcurrencyCheckValue
Method Overview
- public ASTUnit(const clang::ASTUnit &)
- private ASTUnit(bool MainFileIsAST)
- private void CacheCodeCompletionResults()
- private void ClearCachedCompletionResults()
- public void CodeComplete(llvm::StringRef File, unsigned int Line, unsigned int Column, ArrayRef<clang::ASTUnit::RemappedFile> RemappedFiles, bool IncludeMacros, bool IncludeCodePatterns, bool IncludeBriefComments, clang::CodeCompleteConsumer & Consumer, std::shared_ptr<PCHContainerOperations> PCHContainerOps, clang::DiagnosticsEngine & Diag, clang::LangOptions & LangOpts, clang::SourceManager & SourceMgr, clang::FileManager & FileMgr, SmallVectorImpl<clang::StoredDiagnostic> & StoredDiagnostics, SmallVectorImpl<const llvm::MemoryBuffer *> & OwnedBuffers)
- private static void ConfigureDiags(IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags, clang::ASTUnit & AST, clang::CaptureDiagsKind CaptureDiagnostics)
- public static std::unique_ptr<ASTUnit> LoadFromASTFile(const std::string & Filename, const clang::PCHContainerReader & PCHContainerRdr, clang::ASTUnit::WhatToLoad ToLoad, IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags, const clang::FileSystemOptions & FileSystemOpts, bool UseDebugInfo = false, bool OnlyLocalDecls = false, clang::CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None, bool AllowASTWithCompilerErrors = false, bool UserFilesAreVolatile = false, IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = llvm::vfs::getRealFileSystem())
- public static clang::ASTUnit * LoadFromCommandLine(const char ** ArgBegin, const char ** ArgEnd, std::shared_ptr<PCHContainerOperations> PCHContainerOps, IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags, llvm::StringRef ResourceFilesPath, bool OnlyLocalDecls = false, clang::CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None, ArrayRef<clang::ASTUnit::RemappedFile> RemappedFiles = None, bool RemappedFilesKeepOriginalName = true, unsigned int PrecompilePreambleAfterNParses = 0, clang::TranslationUnitKind TUKind = TU_Complete, bool CacheCodeCompletionResults = false, bool IncludeBriefCommentsInCodeCompletion = false, bool AllowPCHWithCompilerErrors = false, clang::SkipFunctionBodiesScope SkipFunctionBodies = SkipFunctionBodiesScope::None, bool SingleFileParse = false, bool UserFilesAreVolatile = false, bool ForSerialization = false, bool RetainExcludedConditionalBlocks = false, llvm::Optional<StringRef> ModuleFormat = llvm::None, std::unique_ptr<ASTUnit> * ErrAST = nullptr, IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr)
- public static std::unique_ptr<ASTUnit> LoadFromCompilerInvocation(std::shared_ptr<CompilerInvocation> CI, std::shared_ptr<PCHContainerOperations> PCHContainerOps, IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags, clang::FileManager * FileMgr, bool OnlyLocalDecls = false, clang::CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None, unsigned int PrecompilePreambleAfterNParses = 0, clang::TranslationUnitKind TUKind = TU_Complete, bool CacheCodeCompletionResults = false, bool IncludeBriefCommentsInCodeCompletion = false, bool UserFilesAreVolatile = false)
- private bool LoadFromCompilerInvocation(std::shared_ptr<PCHContainerOperations> PCHContainerOps, unsigned int PrecompilePreambleAfterNParses, IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS)
- public static clang::ASTUnit * LoadFromCompilerInvocationAction(std::shared_ptr<CompilerInvocation> CI, std::shared_ptr<PCHContainerOperations> PCHContainerOps, IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags, clang::FrontendAction * Action = nullptr, clang::ASTUnit * Unit = nullptr, bool Persistent = true, llvm::StringRef ResourceFilesPath = llvm::StringRef(), bool OnlyLocalDecls = false, clang::CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None, unsigned int PrecompilePreambleAfterNParses = 0, bool CacheCodeCompletionResults = false, bool UserFilesAreVolatile = false, std::unique_ptr<ASTUnit> * ErrAST = nullptr)
- private bool Parse(std::shared_ptr<PCHContainerOperations> PCHContainerOps, std::unique_ptr<llvm::MemoryBuffer> OverrideMainBuffer, IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS)
- private void RealizeTopLevelDeclsFromPreamble()
- public bool Reparse(std::shared_ptr<PCHContainerOperations> PCHContainerOps, ArrayRef<clang::ASTUnit::RemappedFile> RemappedFiles = None, IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr)
- public void ResetForParse()
- public bool Save(llvm::StringRef File)
- private void TranslateStoredDiagnostics(clang::FileManager & FileMgr, clang::SourceManager & SrcMan, const SmallVectorImpl<clang::ASTUnit::StandaloneDiagnostic> & Diags, SmallVectorImpl<clang::StoredDiagnostic> & Out)
- public void addFileLevelDecl(clang::Decl * D)
- public void addTopLevelDecl(clang::Decl * D)
- public clang::ASTUnit::cached_completion_iterator cached_completion_begin()
- public clang::ASTUnit::cached_completion_iterator cached_completion_end()
- public unsigned int cached_completion_size() const
- private void clearFileLevelDecls()
- public static std::unique_ptr<ASTUnit> create(std::shared_ptr<CompilerInvocation> CI, IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags, clang::CaptureDiagsKind CaptureDiagnostics, bool UserFilesAreVolatile)
- public void enableSourceFileDiagnostics()
- public void findFileRegionDecls(clang::FileID File, unsigned int Offset, unsigned int Length, SmallVectorImpl<clang::Decl *> & Decls)
- public const clang::ASTContext & getASTContext() const
- public clang::ASTContext & getASTContext()
- public llvm::StringRef getASTFileName() const
- public clang::ASTMutationListener * getASTMutationListener()
- public IntrusiveRefCntPtr<clang::ASTReader> getASTReader() const
- public std::unique_ptr<llvm::MemoryBuffer> getBufferForFile(llvm::StringRef Filename, std::string * ErrorStr = nullptr)
- public std::shared_ptr<GlobalCodeCompletionAllocator> getCachedCompletionAllocator()
- public llvm::StringMap<unsigned int> & getCachedCompletionTypes()
- public clang::CodeCompletionTUInfo & getCodeCompletionTUInfo()
- public unsigned int & getCurrentTopLevelHashValue()
- public clang::ASTDeserializationListener * getDeserializationListener()
- public const clang::DiagnosticsEngine & getDiagnostics() const
- public clang::DiagnosticsEngine & getDiagnostics()
- public clang::SourceLocation getEndOfPreambleFileID() const
- public const clang::FileManager & getFileManager() const
- public clang::FileManager & getFileManager()
- public const clang::FileSystemOptions & getFileSystemOpts() const
- public const clang::HeaderSearchOptions & getHeaderSearchOpts() const
- public clang::InputKind getInputKind() const
- public const clang::LangOptions & getLangOpts() const
- public llvm::iterator_range<PreprocessingRecord::iterator> getLocalPreprocessingEntities() const
- public clang::SourceLocation getLocation(const clang::FileEntry * File, unsigned int Line, unsigned int Col) const
- public clang::SourceLocation getLocation(const clang::FileEntry * File, unsigned int Offset) const
- private std::unique_ptr<llvm::MemoryBuffer> getMainBufferWithPrecompiledPreamble(std::shared_ptr<PCHContainerOperations> PCHContainerOps, clang::CompilerInvocation & PreambleInvocationIn, IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS, bool AllowRebuild = true, unsigned int MaxLines = 0)
- public llvm::StringRef getMainFileName() const
- public bool getOnlyLocalDecls() const
- public llvm::StringRef getOriginalSourceFileName() const
- public bool getOwnsRemappedFileBuffers() const
- public const clang::FileEntry * getPCHFile()
- public unsigned int getPreambleCounterForTests() const
- public clang::Preprocessor & getPreprocessor()
- public const clang::Preprocessor & getPreprocessor() const
- public const clang::PreprocessorOptions & getPreprocessorOpts() const
- public std::shared_ptr<Preprocessor> getPreprocessorPtr() const
- public clang::Sema & getSema() const
- public const clang::SourceManager & getSourceManager() const
- public clang::SourceManager & getSourceManager()
- public clang::SourceLocation getStartOfMainFileID() const
- public clang::TranslationUnitKind getTranslationUnitKind() const
- public bool hasSema() const
- public bool isInMainFileID(clang::SourceLocation Loc) const
- public bool isInPreambleFileID(clang::SourceLocation Loc) const
- public bool isMainFileAST() const
- public bool isModuleFile() const
- public bool isUnsafeToFree() const
- public clang::SourceLocation mapLocationFromPreamble(clang::SourceLocation Loc) const
- public clang::SourceLocation mapLocationToPreamble(clang::SourceLocation Loc) const
- public clang::SourceRange mapRangeFromPreamble(clang::SourceRange R) const
- public clang::SourceRange mapRangeToPreamble(clang::SourceRange R) const
- public bool serialize(llvm::raw_ostream & OS)
- public void setASTContext(clang::ASTContext * ctx)
- public void setOwnsRemappedFileBuffers(bool val)
- public void setPreprocessor(std::shared_ptr<Preprocessor> pp)
- public void setUnsafeToFree(bool Value)
- public clang::ASTUnit::stored_diag_iterator stored_diag_afterDriver_begin()
- public clang::ASTUnit::stored_diag_const_iterator stored_diag_begin() const
- public clang::ASTUnit::stored_diag_iterator stored_diag_begin()
- public clang::ASTUnit::stored_diag_const_iterator stored_diag_end() const
- public clang::ASTUnit::stored_diag_iterator stored_diag_end()
- public unsigned int stored_diag_size() const
- public clang::ASTUnit::top_level_iterator top_level_begin()
- public bool top_level_empty() const
- public clang::ASTUnit::top_level_iterator top_level_end()
- public std::size_t top_level_size() const
- private void transferASTDataFromCompilerInstance(clang::CompilerInstance & CI)
- public bool visitLocalTopLevelDecls(void * context, clang::ASTUnit::DeclVisitorFn Fn)
- public ~ASTUnit()
Methods
¶ASTUnit(const clang::ASTUnit&)
ASTUnit(const clang::ASTUnit&)
Declared at: clang/include/clang/Frontend/ASTUnit.h:420
Parameters
- const clang::ASTUnit&
¶ASTUnit(bool MainFileIsAST)
ASTUnit(bool MainFileIsAST)
Declared at: clang/include/clang/Frontend/ASTUnit.h:368
Parameters
- bool MainFileIsAST
¶void CacheCodeCompletionResults()
void CacheCodeCompletionResults()
Description
Cache any "global" code-completion results, so that we can avoid recomputing them with each completion.
Declared at: clang/include/clang/Frontend/ASTUnit.h:363
¶void ClearCachedCompletionResults()
void ClearCachedCompletionResults()
Description
Clear out and deallocate
Declared at: clang/include/clang/Frontend/ASTUnit.h:366
¶void CodeComplete(
llvm::StringRef File,
unsigned int Line,
unsigned int Column,
ArrayRef<clang::ASTUnit::RemappedFile>
RemappedFiles,
bool IncludeMacros,
bool IncludeCodePatterns,
bool IncludeBriefComments,
clang::CodeCompleteConsumer& Consumer,
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
clang::DiagnosticsEngine& Diag,
clang::LangOptions& LangOpts,
clang::SourceManager& SourceMgr,
clang::FileManager& FileMgr,
SmallVectorImpl<clang::StoredDiagnostic>&
StoredDiagnostics,
SmallVectorImpl<const llvm::MemoryBuffer*>&
OwnedBuffers)
void CodeComplete(
llvm::StringRef File,
unsigned int Line,
unsigned int Column,
ArrayRef<clang::ASTUnit::RemappedFile>
RemappedFiles,
bool IncludeMacros,
bool IncludeCodePatterns,
bool IncludeBriefComments,
clang::CodeCompleteConsumer& Consumer,
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
clang::DiagnosticsEngine& Diag,
clang::LangOptions& LangOpts,
clang::SourceManager& SourceMgr,
clang::FileManager& FileMgr,
SmallVectorImpl<clang::StoredDiagnostic>&
StoredDiagnostics,
SmallVectorImpl<const llvm::MemoryBuffer*>&
OwnedBuffers)
Description
Perform code completion at the given file, line, and column within this translation unit. FIXME: The Diag, LangOpts, SourceMgr, FileMgr, StoredDiagnostics, and OwnedBuffers parameters are all disgusting hacks. They will go away.
Declared at: clang/include/clang/Frontend/ASTUnit.h:882
Parameters
- llvm::StringRef File
- The file in which code completion will occur.
- unsigned int Line
- The line at which code completion will occur.
- unsigned int Column
- The column at which code completion will occur.
- ArrayRef<clang::ASTUnit::RemappedFile> RemappedFiles
- bool IncludeMacros
- Whether to include macros in the code-completion results.
- bool IncludeCodePatterns
- Whether to include code patterns (such as a for loop) in the code-completion results.
- bool IncludeBriefComments
- Whether to include brief documentation within the set of code completions returned.
- clang::CodeCompleteConsumer& Consumer
- std::shared_ptr<PCHContainerOperations> PCHContainerOps
- clang::DiagnosticsEngine& Diag
- clang::LangOptions& LangOpts
- clang::SourceManager& SourceMgr
- clang::FileManager& FileMgr
- SmallVectorImpl<clang::StoredDiagnostic>& StoredDiagnostics
- SmallVectorImpl<const llvm::MemoryBuffer*>& OwnedBuffers
¶static void ConfigureDiags(
IntrusiveRefCntPtr<clang::DiagnosticsEngine>
Diags,
clang::ASTUnit& AST,
clang::CaptureDiagsKind CaptureDiagnostics)
static void ConfigureDiags(
IntrusiveRefCntPtr<clang::DiagnosticsEngine>
Diags,
clang::ASTUnit& AST,
clang::CaptureDiagsKind CaptureDiagnostics)
Declared at: clang/include/clang/Frontend/ASTUnit.h:255
Parameters
- IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags
- clang::ASTUnit& AST
- clang::CaptureDiagsKind CaptureDiagnostics
¶static std::unique_ptr<ASTUnit> LoadFromASTFile(
const std::string& Filename,
const clang::PCHContainerReader&
PCHContainerRdr,
clang::ASTUnit::WhatToLoad ToLoad,
IntrusiveRefCntPtr<clang::DiagnosticsEngine>
Diags,
const clang::FileSystemOptions&
FileSystemOpts,
bool UseDebugInfo = false,
bool OnlyLocalDecls = false,
clang::CaptureDiagsKind CaptureDiagnostics =
CaptureDiagsKind::None,
bool AllowASTWithCompilerErrors = false,
bool UserFilesAreVolatile = false,
IntrusiveRefCntPtr<llvm::vfs::FileSystem>
VFS = llvm::vfs::getRealFileSystem())
static std::unique_ptr<ASTUnit> LoadFromASTFile(
const std::string& Filename,
const clang::PCHContainerReader&
PCHContainerRdr,
clang::ASTUnit::WhatToLoad ToLoad,
IntrusiveRefCntPtr<clang::DiagnosticsEngine>
Diags,
const clang::FileSystemOptions&
FileSystemOpts,
bool UseDebugInfo = false,
bool OnlyLocalDecls = false,
clang::CaptureDiagsKind CaptureDiagnostics =
CaptureDiagsKind::None,
bool AllowASTWithCompilerErrors = false,
bool UserFilesAreVolatile = false,
IntrusiveRefCntPtr<llvm::vfs::FileSystem>
VFS = llvm::vfs::getRealFileSystem())
Description
Create a ASTUnit from an AST file.
Declared at: clang/include/clang/Frontend/ASTUnit.h:692
Parameters
- const std::string& Filename
- - The AST file to load.
- const clang::PCHContainerReader& PCHContainerRdr
- - The PCHContainerOperations to use for loading and creating modules.
- clang::ASTUnit::WhatToLoad ToLoad
- IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags
- - The diagnostics engine to use for reporting errors; its lifetime is expected to extend past that of the returned ASTUnit.
- const clang::FileSystemOptions& FileSystemOpts
- bool UseDebugInfo = false
- bool OnlyLocalDecls = false
- clang::CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None
- bool AllowASTWithCompilerErrors = false
- bool UserFilesAreVolatile = false
- IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = llvm::vfs::getRealFileSystem()
Returns
- The initialized ASTUnit or null if the AST failed to load.
¶static clang::ASTUnit* LoadFromCommandLine(
const char** ArgBegin,
const char** ArgEnd,
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
IntrusiveRefCntPtr<clang::DiagnosticsEngine>
Diags,
llvm::StringRef ResourceFilesPath,
bool OnlyLocalDecls = false,
clang::CaptureDiagsKind CaptureDiagnostics =
CaptureDiagsKind::None,
ArrayRef<clang::ASTUnit::RemappedFile>
RemappedFiles = None,
bool RemappedFilesKeepOriginalName = true,
unsigned int PrecompilePreambleAfterNParses =
0,
clang::TranslationUnitKind TUKind =
TU_Complete,
bool CacheCodeCompletionResults = false,
bool IncludeBriefCommentsInCodeCompletion =
false,
bool AllowPCHWithCompilerErrors = false,
clang::SkipFunctionBodiesScope
SkipFunctionBodies =
SkipFunctionBodiesScope::None,
bool SingleFileParse = false,
bool UserFilesAreVolatile = false,
bool ForSerialization = false,
bool RetainExcludedConditionalBlocks = false,
llvm::Optional<StringRef> ModuleFormat =
llvm::None,
std::unique_ptr<ASTUnit>* ErrAST = nullptr,
IntrusiveRefCntPtr<llvm::vfs::FileSystem>
VFS = nullptr)
static clang::ASTUnit* LoadFromCommandLine(
const char** ArgBegin,
const char** ArgEnd,
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
IntrusiveRefCntPtr<clang::DiagnosticsEngine>
Diags,
llvm::StringRef ResourceFilesPath,
bool OnlyLocalDecls = false,
clang::CaptureDiagsKind CaptureDiagnostics =
CaptureDiagsKind::None,
ArrayRef<clang::ASTUnit::RemappedFile>
RemappedFiles = None,
bool RemappedFilesKeepOriginalName = true,
unsigned int PrecompilePreambleAfterNParses =
0,
clang::TranslationUnitKind TUKind =
TU_Complete,
bool CacheCodeCompletionResults = false,
bool IncludeBriefCommentsInCodeCompletion =
false,
bool AllowPCHWithCompilerErrors = false,
clang::SkipFunctionBodiesScope
SkipFunctionBodies =
SkipFunctionBodiesScope::None,
bool SingleFileParse = false,
bool UserFilesAreVolatile = false,
bool ForSerialization = false,
bool RetainExcludedConditionalBlocks = false,
llvm::Optional<StringRef> ModuleFormat =
llvm::None,
std::unique_ptr<ASTUnit>* ErrAST = nullptr,
IntrusiveRefCntPtr<llvm::vfs::FileSystem>
VFS = nullptr)
Description
LoadFromCommandLine - Create an ASTUnit from a vector of command line arguments, which must specify exactly one source file.
Declared at: clang/include/clang/Frontend/ASTUnit.h:820
Parameters
- const char** ArgBegin
- - The beginning of the argument vector.
- const char** ArgEnd
- - The end of the argument vector.
- std::shared_ptr<PCHContainerOperations> PCHContainerOps
- - The PCHContainerOperations to use for loading and creating modules.
- IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags
- - The diagnostics engine to use for reporting errors; its lifetime is expected to extend past that of the returned ASTUnit.
- llvm::StringRef ResourceFilesPath
- - The path to the compiler resource files.
- bool OnlyLocalDecls = false
- clang::CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None
- ArrayRef<clang::ASTUnit::RemappedFile> RemappedFiles = None
- bool RemappedFilesKeepOriginalName = true
- unsigned int PrecompilePreambleAfterNParses = 0
- clang::TranslationUnitKind TUKind = TU_Complete
- bool CacheCodeCompletionResults = false
- bool IncludeBriefCommentsInCodeCompletion = false
- bool AllowPCHWithCompilerErrors = false
- clang::SkipFunctionBodiesScope SkipFunctionBodies = SkipFunctionBodiesScope::None
- bool SingleFileParse = false
- bool UserFilesAreVolatile = false
- bool ForSerialization = false
- bool RetainExcludedConditionalBlocks = false
- llvm::Optional<StringRef> ModuleFormat = llvm::None
- - If provided, uses the specific module format.
- std::unique_ptr<ASTUnit>* ErrAST = nullptr
- - If non-null and parsing failed without any AST to return (e.g. because the PCH could not be loaded), this accepts the ASTUnit mainly to allow the caller to see the diagnostics.
- IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr
- - A llvm::vfs::FileSystem to be used for all file accesses. Note that preamble is saved to a temporary directory on a RealFileSystem, so in order for it to be loaded correctly, VFS should have access to it(i.e., be an overlay over RealFileSystem). RealFileSystem will be used if \p VFS is nullptr.
¶static std::unique_ptr<ASTUnit>
LoadFromCompilerInvocation(
std::shared_ptr<CompilerInvocation> CI,
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
IntrusiveRefCntPtr<clang::DiagnosticsEngine>
Diags,
clang::FileManager* FileMgr,
bool OnlyLocalDecls = false,
clang::CaptureDiagsKind CaptureDiagnostics =
CaptureDiagsKind::None,
unsigned int PrecompilePreambleAfterNParses =
0,
clang::TranslationUnitKind TUKind =
TU_Complete,
bool CacheCodeCompletionResults = false,
bool IncludeBriefCommentsInCodeCompletion =
false,
bool UserFilesAreVolatile = false)
static std::unique_ptr<ASTUnit>
LoadFromCompilerInvocation(
std::shared_ptr<CompilerInvocation> CI,
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
IntrusiveRefCntPtr<clang::DiagnosticsEngine>
Diags,
clang::FileManager* FileMgr,
bool OnlyLocalDecls = false,
clang::CaptureDiagsKind CaptureDiagnostics =
CaptureDiagsKind::None,
unsigned int PrecompilePreambleAfterNParses =
0,
clang::TranslationUnitKind TUKind =
TU_Complete,
bool CacheCodeCompletionResults = false,
bool IncludeBriefCommentsInCodeCompletion =
false,
bool UserFilesAreVolatile = false)
Description
LoadFromCompilerInvocation - Create an ASTUnit from a source file, via a CompilerInvocation object.
Declared at: clang/include/clang/Frontend/ASTUnit.h:779
Parameters
- std::shared_ptr<CompilerInvocation> CI
- - The compiler invocation to use; it must have exactly one input source file. The ASTUnit takes ownership of the CompilerInvocation object.
- std::shared_ptr<PCHContainerOperations> PCHContainerOps
- - The PCHContainerOperations to use for loading and creating modules.
- IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags
- - The diagnostics engine to use for reporting errors; its lifetime is expected to extend past that of the returned ASTUnit.
- clang::FileManager* FileMgr
- bool OnlyLocalDecls = false
- clang::CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None
- unsigned int PrecompilePreambleAfterNParses = 0
- clang::TranslationUnitKind TUKind = TU_Complete
- bool CacheCodeCompletionResults = false
- bool IncludeBriefCommentsInCodeCompletion = false
- bool UserFilesAreVolatile = false
¶bool LoadFromCompilerInvocation(
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
unsigned int PrecompilePreambleAfterNParses,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS)
bool LoadFromCompilerInvocation(
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
unsigned int PrecompilePreambleAfterNParses,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS)
Description
Helper function for \c LoadFromCompilerInvocation() and\c LoadFromCommandLine(), which loads an AST from a compiler invocation.
Declared at: clang/include/clang/Frontend/ASTUnit.h:718
Parameters
- std::shared_ptr<PCHContainerOperations> PCHContainerOps
- unsigned int PrecompilePreambleAfterNParses
- After how many parses the preamble of this translation unit should be precompiled, to improve the performance of reparsing. Set to zero to disable preambles.
- IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS
- - A llvm::vfs::FileSystem to be used for all file accesses. Note that preamble is saved to a temporary directory on a RealFileSystem, so in order for it to be loaded correctly, VFS should have access to it(i.e., be an overlay over RealFileSystem).
Returns
\c true if a catastrophic failure occurred (which means that the\c ASTUnit itself is invalid), or \c false otherwise.
¶static clang::ASTUnit*
LoadFromCompilerInvocationAction(
std::shared_ptr<CompilerInvocation> CI,
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
IntrusiveRefCntPtr<clang::DiagnosticsEngine>
Diags,
clang::FrontendAction* Action = nullptr,
clang::ASTUnit* Unit = nullptr,
bool Persistent = true,
llvm::StringRef ResourceFilesPath =
llvm::StringRef(),
bool OnlyLocalDecls = false,
clang::CaptureDiagsKind CaptureDiagnostics =
CaptureDiagsKind::None,
unsigned int PrecompilePreambleAfterNParses =
0,
bool CacheCodeCompletionResults = false,
bool UserFilesAreVolatile = false,
std::unique_ptr<ASTUnit>* ErrAST = nullptr)
static clang::ASTUnit*
LoadFromCompilerInvocationAction(
std::shared_ptr<CompilerInvocation> CI,
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
IntrusiveRefCntPtr<clang::DiagnosticsEngine>
Diags,
clang::FrontendAction* Action = nullptr,
clang::ASTUnit* Unit = nullptr,
bool Persistent = true,
llvm::StringRef ResourceFilesPath =
llvm::StringRef(),
bool OnlyLocalDecls = false,
clang::CaptureDiagsKind CaptureDiagnostics =
CaptureDiagsKind::None,
unsigned int PrecompilePreambleAfterNParses =
0,
bool CacheCodeCompletionResults = false,
bool UserFilesAreVolatile = false,
std::unique_ptr<ASTUnit>* ErrAST = nullptr)
Description
Create an ASTUnit from a source file, via a CompilerInvocation object, by invoking the optionally provided ASTFrontendAction.
Declared at: clang/include/clang/Frontend/ASTUnit.h:752
Parameters
- std::shared_ptr<CompilerInvocation> CI
- - The compiler invocation to use; it must have exactly one input source file. The ASTUnit takes ownership of the CompilerInvocation object.
- std::shared_ptr<PCHContainerOperations> PCHContainerOps
- - The PCHContainerOperations to use for loading and creating modules.
- IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags
- - The diagnostics engine to use for reporting errors; its lifetime is expected to extend past that of the returned ASTUnit.
- clang::FrontendAction* Action = nullptr
- - The ASTFrontendAction to invoke. Its ownership is not transferred.
- clang::ASTUnit* Unit = nullptr
- - optionally an already created ASTUnit. Its ownership is not transferred.
- bool Persistent = true
- - if true the returned ASTUnit will be complete. false means the caller is only interested in getting info through the provided
- llvm::StringRef ResourceFilesPath = llvm::StringRef()
- bool OnlyLocalDecls = false
- clang::CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None
- unsigned int PrecompilePreambleAfterNParses = 0
- bool CacheCodeCompletionResults = false
- bool UserFilesAreVolatile = false
- std::unique_ptr<ASTUnit>* ErrAST = nullptr
- - If non-null and parsing failed without any AST to return (e.g. because the PCH could not be loaded), this accepts the ASTUnit mainly to allow the caller to see the diagnostics. This will only receive an ASTUnit if a new one was created. If an already created ASTUnit was passed in \p Unit then the caller can check that.
¶bool Parse(
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
std::unique_ptr<llvm::MemoryBuffer>
OverrideMainBuffer,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS)
bool Parse(
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
std::unique_ptr<llvm::MemoryBuffer>
OverrideMainBuffer,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS)
Declared at: clang/include/clang/Frontend/ASTUnit.h:370
Parameters
- std::shared_ptr<PCHContainerOperations> PCHContainerOps
- std::unique_ptr<llvm::MemoryBuffer> OverrideMainBuffer
- IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS
¶void RealizeTopLevelDeclsFromPreamble()
void RealizeTopLevelDeclsFromPreamble()
Declared at: clang/include/clang/Frontend/ASTUnit.h:379
¶bool Reparse(
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
ArrayRef<clang::ASTUnit::RemappedFile>
RemappedFiles = None,
IntrusiveRefCntPtr<llvm::vfs::FileSystem>
VFS = nullptr)
bool Reparse(
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
ArrayRef<clang::ASTUnit::RemappedFile>
RemappedFiles = None,
IntrusiveRefCntPtr<llvm::vfs::FileSystem>
VFS = nullptr)
Description
Reparse the source files using the same command-line options that were originally used to produce this translation unit.
Declared at: clang/include/clang/Frontend/ASTUnit.h:853
Parameters
- std::shared_ptr<PCHContainerOperations> PCHContainerOps
- ArrayRef<clang::ASTUnit::RemappedFile> RemappedFiles = None
- IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr
- - A llvm::vfs::FileSystem to be used for all file accesses. Note that preamble is saved to a temporary directory on a RealFileSystem, so in order for it to be loaded correctly, VFS should give an access to this(i.e. be an overlay over RealFileSystem). FileMgr->getVirtualFileSystem() will be used if \p VFS is nullptr.
Returns
True if a failure occurred that causes the ASTUnit not to contain any translation-unit information, false otherwise.
¶void ResetForParse()
void ResetForParse()
Description
Free data that will be re-generated on the next parse. Preamble-related data is not affected.
Declared at: clang/include/clang/Frontend/ASTUnit.h:860
¶bool Save(llvm::StringRef File)
bool Save(llvm::StringRef File)
Description
Save this translation unit to a file with the given name.
Declared at: clang/include/clang/Frontend/ASTUnit.h:896
Parameters
- llvm::StringRef File
Returns
true if there was a file error or false if the save was successful.
¶void TranslateStoredDiagnostics(
clang::FileManager& FileMgr,
clang::SourceManager& SrcMan,
const SmallVectorImpl<
clang::ASTUnit::StandaloneDiagnostic>&
Diags,
SmallVectorImpl<clang::StoredDiagnostic>& Out)
void TranslateStoredDiagnostics(
clang::FileManager& FileMgr,
clang::SourceManager& SrcMan,
const SmallVectorImpl<
clang::ASTUnit::StandaloneDiagnostic>&
Diags,
SmallVectorImpl<clang::StoredDiagnostic>& Out)
Declared at: clang/include/clang/Frontend/ASTUnit.h:258
Parameters
- clang::FileManager& FileMgr
- clang::SourceManager& SrcMan
- const SmallVectorImpl< clang::ASTUnit::StandaloneDiagnostic>& Diags
- SmallVectorImpl<clang::StoredDiagnostic>& Out
¶void addFileLevelDecl(clang::Decl* D)
void addFileLevelDecl(clang::Decl* D)
Description
Add a new local file-level declaration.
Declared at: clang/include/clang/Frontend/ASTUnit.h:532
Parameters
- clang::Decl* D
¶void addTopLevelDecl(clang::Decl* D)
void addTopLevelDecl(clang::Decl* D)
Description
Add a new top-level declaration.
Declared at: clang/include/clang/Frontend/ASTUnit.h:527
Parameters
- clang::Decl* D
¶clang::ASTUnit::cached_completion_iterator
cached_completion_begin()
clang::ASTUnit::cached_completion_iterator
cached_completion_begin()
Declared at: clang/include/clang/Frontend/ASTUnit.h:616
¶clang::ASTUnit::cached_completion_iterator
cached_completion_end()
clang::ASTUnit::cached_completion_iterator
cached_completion_end()
Declared at: clang/include/clang/Frontend/ASTUnit.h:620
¶unsigned int cached_completion_size() const
unsigned int cached_completion_size() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:624
¶void clearFileLevelDecls()
void clearFileLevelDecls()
Declared at: clang/include/clang/Frontend/ASTUnit.h:263
¶static std::unique_ptr<ASTUnit> create(
std::shared_ptr<CompilerInvocation> CI,
IntrusiveRefCntPtr<clang::DiagnosticsEngine>
Diags,
clang::CaptureDiagsKind CaptureDiagnostics,
bool UserFilesAreVolatile)
static std::unique_ptr<ASTUnit> create(
std::shared_ptr<CompilerInvocation> CI,
IntrusiveRefCntPtr<clang::DiagnosticsEngine>
Diags,
clang::CaptureDiagsKind CaptureDiagnostics,
bool UserFilesAreVolatile)
Description
Create a ASTUnit. Gets ownership of the passed CompilerInvocation.
Declared at: clang/include/clang/Frontend/ASTUnit.h:666
Parameters
- std::shared_ptr<CompilerInvocation> CI
- IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags
- clang::CaptureDiagsKind CaptureDiagnostics
- bool UserFilesAreVolatile
¶void enableSourceFileDiagnostics()
void enableSourceFileDiagnostics()
Description
Enable source-range based diagnostic messages. If diagnostic messages with source-range information are to be expected and AST comes not from file (e.g. after LoadFromCompilerInvocation) this function has to be called. The function is to be called only once and the AST should be associated with the same source file afterwards.
Declared at: clang/include/clang/Frontend/ASTUnit.h:452
¶void findFileRegionDecls(
clang::FileID File,
unsigned int Offset,
unsigned int Length,
SmallVectorImpl<clang::Decl*>& Decls)
void findFileRegionDecls(
clang::FileID File,
unsigned int Offset,
unsigned int Length,
SmallVectorImpl<clang::Decl*>& Decls)
Description
Get the decls that are contained in a file in the Offset/Length range. \p Length can be 0 to indicate a point at \p Offset instead of a range.
Declared at: clang/include/clang/Frontend/ASTUnit.h:537
Parameters
- clang::FileID File
- unsigned int Offset
- unsigned int Length
- SmallVectorImpl<clang::Decl*>& Decls
¶const clang::ASTContext& getASTContext() const
const clang::ASTContext& getASTContext() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:439
¶clang::ASTContext& getASTContext()
clang::ASTContext& getASTContext()
Declared at: clang/include/clang/Frontend/ASTUnit.h:440
¶llvm::StringRef getASTFileName() const
llvm::StringRef getASTFileName() const
Description
If this ASTUnit came from an AST file, returns the filename for it.
Declared at: clang/include/clang/Frontend/ASTUnit.h:498
¶clang::ASTMutationListener*
getASTMutationListener()
clang::ASTMutationListener*
getASTMutationListener()
Declared at: clang/include/clang/Frontend/ASTUnit.h:487
¶IntrusiveRefCntPtr<clang::ASTReader>
getASTReader() const
IntrusiveRefCntPtr<clang::ASTReader>
getASTReader() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:481
¶std::unique_ptr<llvm::MemoryBuffer>
getBufferForFile(llvm::StringRef Filename,
std::string* ErrorStr = nullptr)
std::unique_ptr<llvm::MemoryBuffer>
getBufferForFile(llvm::StringRef Filename,
std::string* ErrorStr = nullptr)
Declared at: clang/include/clang/Frontend/ASTUnit.h:652
Parameters
- llvm::StringRef Filename
- std::string* ErrorStr = nullptr
¶std::shared_ptr<GlobalCodeCompletionAllocator>
getCachedCompletionAllocator()
std::shared_ptr<GlobalCodeCompletionAllocator>
getCachedCompletionAllocator()
Description
Retrieve the allocator used to cache global code completions.
Declared at: clang/include/clang/Frontend/ASTUnit.h:312
¶llvm::StringMap<unsigned int>&
getCachedCompletionTypes()
llvm::StringMap<unsigned int>&
getCachedCompletionTypes()
Description
Retrieve the mapping from formatted type names to unique type identifiers.
Declared at: clang/include/clang/Frontend/ASTUnit.h:306
¶clang::CodeCompletionTUInfo&
getCodeCompletionTUInfo()
clang::CodeCompletionTUInfo&
getCodeCompletionTUInfo()
Declared at: clang/include/clang/Frontend/ASTUnit.h:316
¶unsigned int& getCurrentTopLevelHashValue()
unsigned int& getCurrentTopLevelHashValue()
Description
Retrieve a reference to the current top-level name hash value. Note: This is used internally by the top-level tracking action
Declared at: clang/include/clang/Frontend/ASTUnit.h:543
¶clang::ASTDeserializationListener*
getDeserializationListener()
clang::ASTDeserializationListener*
getDeserializationListener()
Declared at: clang/include/clang/Frontend/ASTUnit.h:488
¶const clang::DiagnosticsEngine& getDiagnostics()
const
const clang::DiagnosticsEngine& getDiagnostics()
const
Declared at: clang/include/clang/Frontend/ASTUnit.h:429
¶clang::DiagnosticsEngine& getDiagnostics()
clang::DiagnosticsEngine& getDiagnostics()
Declared at: clang/include/clang/Frontend/ASTUnit.h:430
¶clang::SourceLocation getEndOfPreambleFileID()
const
clang::SourceLocation getEndOfPreambleFileID()
const
Declared at: clang/include/clang/Frontend/ASTUnit.h:569
¶const clang::FileManager& getFileManager() const
const clang::FileManager& getFileManager() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:476
¶clang::FileManager& getFileManager()
clang::FileManager& getFileManager()
Declared at: clang/include/clang/Frontend/ASTUnit.h:477
¶const clang::FileSystemOptions&
getFileSystemOpts() const
const clang::FileSystemOptions&
getFileSystemOpts() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:479
¶const clang::HeaderSearchOptions&
getHeaderSearchOpts() const
const clang::HeaderSearchOptions&
getHeaderSearchOpts() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:466
¶clang::InputKind getInputKind() const
clang::InputKind getInputKind() const
Description
Determine the input kind this AST unit represents.
Declared at: clang/include/clang/Frontend/ASTUnit.h:658
¶const clang::LangOptions& getLangOpts() const
const clang::LangOptions& getLangOpts() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:461
¶llvm::iterator_range<
PreprocessingRecord::iterator>
getLocalPreprocessingEntities() const
llvm::iterator_range<
PreprocessingRecord::iterator>
getLocalPreprocessingEntities() const
Description
Returns an iterator range for the local preprocessing entities of the local Preprocessor, if this is a parsed source file, or the loaded preprocessing entities of the primary module if this is an AST file.
Declared at: clang/include/clang/Frontend/ASTUnit.h:632
¶clang::SourceLocation getLocation(
const clang::FileEntry* File,
unsigned int Line,
unsigned int Col) const
clang::SourceLocation getLocation(
const clang::FileEntry* File,
unsigned int Line,
unsigned int Col) const
Description
Get the source location for the given file:line:col triplet. The difference with SourceManager::getLocation is that this method checks whether the requested location points inside the precompiled preamble in which case the returned source location will be a "loaded" one.
Declared at: clang/include/clang/Frontend/ASTUnit.h:550
Parameters
- const clang::FileEntry* File
- unsigned int Line
- unsigned int Col
¶clang::SourceLocation getLocation(
const clang::FileEntry* File,
unsigned int Offset) const
clang::SourceLocation getLocation(
const clang::FileEntry* File,
unsigned int Offset) const
Description
Get the source location for the given file:offset pair.
Declared at: clang/include/clang/Frontend/ASTUnit.h:554
Parameters
- const clang::FileEntry* File
- unsigned int Offset
¶std::unique_ptr<llvm::MemoryBuffer>
getMainBufferWithPrecompiledPreamble(
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
clang::CompilerInvocation&
PreambleInvocationIn,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
bool AllowRebuild = true,
unsigned int MaxLines = 0)
std::unique_ptr<llvm::MemoryBuffer>
getMainBufferWithPrecompiledPreamble(
std::shared_ptr<PCHContainerOperations>
PCHContainerOps,
clang::CompilerInvocation&
PreambleInvocationIn,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
bool AllowRebuild = true,
unsigned int MaxLines = 0)
Declared at: clang/include/clang/Frontend/ASTUnit.h:374
Parameters
- std::shared_ptr<PCHContainerOperations> PCHContainerOps
- clang::CompilerInvocation& PreambleInvocationIn
- IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS
- bool AllowRebuild = true
- unsigned int MaxLines = 0
¶llvm::StringRef getMainFileName() const
llvm::StringRef getMainFileName() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:495
¶bool getOnlyLocalDecls() const
bool getOnlyLocalDecls() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:490
¶llvm::StringRef getOriginalSourceFileName() const
llvm::StringRef getOriginalSourceFileName() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:483
¶bool getOwnsRemappedFileBuffers() const
bool getOwnsRemappedFileBuffers() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:492
¶const clang::FileEntry* getPCHFile()
const clang::FileEntry* getPCHFile()
Description
Get the PCH file if one was included.
Declared at: clang/include/clang/Frontend/ASTUnit.h:645
¶unsigned int getPreambleCounterForTests() const
unsigned int getPreambleCounterForTests() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:583
¶clang::Preprocessor& getPreprocessor()
clang::Preprocessor& getPreprocessor()
Declared at: clang/include/clang/Frontend/ASTUnit.h:436
¶const clang::Preprocessor& getPreprocessor() const
const clang::Preprocessor& getPreprocessor() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:435
¶const clang::PreprocessorOptions&
getPreprocessorOpts() const
const clang::PreprocessorOptions&
getPreprocessorOpts() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:471
¶std::shared_ptr<Preprocessor> getPreprocessorPtr()
const
std::shared_ptr<Preprocessor> getPreprocessorPtr()
const
Declared at: clang/include/clang/Frontend/ASTUnit.h:437
¶clang::Sema& getSema() const
clang::Sema& getSema() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:456
¶const clang::SourceManager& getSourceManager()
const
const clang::SourceManager& getSourceManager()
const
Declared at: clang/include/clang/Frontend/ASTUnit.h:432
¶clang::SourceManager& getSourceManager()
clang::SourceManager& getSourceManager()
Declared at: clang/include/clang/Frontend/ASTUnit.h:433
¶clang::SourceLocation getStartOfMainFileID() const
clang::SourceLocation getStartOfMainFileID() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:568
¶clang::TranslationUnitKind
getTranslationUnitKind() const
clang::TranslationUnitKind
getTranslationUnitKind() const
Description
Determine what kind of translation unit this AST represents.
Declared at: clang/include/clang/Frontend/ASTUnit.h:655
¶bool hasSema() const
bool hasSema() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:454
¶bool isInMainFileID(
clang::SourceLocation Loc) const
bool isInMainFileID(
clang::SourceLocation Loc) const
Declared at: clang/include/clang/Frontend/ASTUnit.h:567
Parameters
¶bool isInPreambleFileID(
clang::SourceLocation Loc) const
bool isInPreambleFileID(
clang::SourceLocation Loc) const
Declared at: clang/include/clang/Frontend/ASTUnit.h:566
Parameters
¶bool isMainFileAST() const
bool isMainFileAST() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:424
¶bool isModuleFile() const
bool isModuleFile() const
Description
Returns true if the ASTUnit was constructed from a serialized module file.
Declared at: clang/include/clang/Frontend/ASTUnit.h:649
¶bool isUnsafeToFree() const
bool isUnsafeToFree() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:426
¶clang::SourceLocation mapLocationFromPreamble(
clang::SourceLocation Loc) const
clang::SourceLocation mapLocationFromPreamble(
clang::SourceLocation Loc) const
Description
If \p Loc is a loaded location from the preamble, returns the corresponding local location of the main file, otherwise it returns\p Loc.
Declared at: clang/include/clang/Frontend/ASTUnit.h:559
Parameters
¶clang::SourceLocation mapLocationToPreamble(
clang::SourceLocation Loc) const
clang::SourceLocation mapLocationToPreamble(
clang::SourceLocation Loc) const
Description
If \p Loc is a local location of the main file but inside the preamble chunk, returns the corresponding loaded location from the preamble, otherwise it returns \p Loc.
Declared at: clang/include/clang/Frontend/ASTUnit.h:564
Parameters
¶clang::SourceRange mapRangeFromPreamble(
clang::SourceRange R) const
clang::SourceRange mapRangeFromPreamble(
clang::SourceRange R) const
Declared at: clang/include/clang/Frontend/ASTUnit.h:572
Parameters
¶clang::SourceRange mapRangeToPreamble(
clang::SourceRange R) const
clang::SourceRange mapRangeToPreamble(
clang::SourceRange R) const
Declared at: clang/include/clang/Frontend/ASTUnit.h:578
Parameters
¶bool serialize(llvm::raw_ostream& OS)
bool serialize(llvm::raw_ostream& OS)
Description
Serialize this translation unit with the given output stream.
Declared at: clang/include/clang/Frontend/ASTUnit.h:901
Parameters
Returns
True if an error occurred, false otherwise.
¶void setASTContext(clang::ASTContext* ctx)
void setASTContext(clang::ASTContext* ctx)
Declared at: clang/include/clang/Frontend/ASTUnit.h:442
Parameters
- clang::ASTContext* ctx
¶void setOwnsRemappedFileBuffers(bool val)
void setOwnsRemappedFileBuffers(bool val)
Declared at: clang/include/clang/Frontend/ASTUnit.h:493
Parameters
- bool val
¶void setPreprocessor(
std::shared_ptr<Preprocessor> pp)
void setPreprocessor(
std::shared_ptr<Preprocessor> pp)
Declared at: clang/include/clang/Frontend/ASTUnit.h:443
Parameters
- std::shared_ptr<Preprocessor> pp
¶void setUnsafeToFree(bool Value)
void setUnsafeToFree(bool Value)
Declared at: clang/include/clang/Frontend/ASTUnit.h:427
Parameters
- bool Value
¶clang::ASTUnit::stored_diag_iterator
stored_diag_afterDriver_begin()
clang::ASTUnit::stored_diag_iterator
stored_diag_afterDriver_begin()
Declared at: clang/include/clang/Frontend/ASTUnit.h:607
¶clang::ASTUnit::stored_diag_const_iterator
stored_diag_begin() const
clang::ASTUnit::stored_diag_const_iterator
stored_diag_begin() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:589
¶clang::ASTUnit::stored_diag_iterator
stored_diag_begin()
clang::ASTUnit::stored_diag_iterator
stored_diag_begin()
Declared at: clang/include/clang/Frontend/ASTUnit.h:593
¶clang::ASTUnit::stored_diag_const_iterator
stored_diag_end() const
clang::ASTUnit::stored_diag_const_iterator
stored_diag_end() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:597
¶clang::ASTUnit::stored_diag_iterator
stored_diag_end()
clang::ASTUnit::stored_diag_iterator
stored_diag_end()
Declared at: clang/include/clang/Frontend/ASTUnit.h:601
¶unsigned int stored_diag_size() const
unsigned int stored_diag_size() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:605
¶clang::ASTUnit::top_level_iterator
top_level_begin()
clang::ASTUnit::top_level_iterator
top_level_begin()
Declared at: clang/include/clang/Frontend/ASTUnit.h:502
¶bool top_level_empty() const
bool top_level_empty() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:521
¶clang::ASTUnit::top_level_iterator top_level_end()
clang::ASTUnit::top_level_iterator top_level_end()
Declared at: clang/include/clang/Frontend/ASTUnit.h:509
¶std::size_t top_level_size() const
std::size_t top_level_size() const
Declared at: clang/include/clang/Frontend/ASTUnit.h:516
¶void transferASTDataFromCompilerInstance(
clang::CompilerInstance& CI)
void transferASTDataFromCompilerInstance(
clang::CompilerInstance& CI)
Description
Transfers ownership of the objects (like SourceManager) from
Declared at: clang/include/clang/Frontend/ASTUnit.h:383
Parameters
- clang::CompilerInstance& CI
- to this ASTUnit.
¶bool visitLocalTopLevelDecls(
void* context,
clang::ASTUnit::DeclVisitorFn Fn)
bool visitLocalTopLevelDecls(
void* context,
clang::ASTUnit::DeclVisitorFn Fn)
Description
Iterate over local declarations (locally parsed if this is a parsed source file or the loaded declarations of the primary module if this is an AST file).
Declared at: clang/include/clang/Frontend/ASTUnit.h:642
Parameters
- void* context
- clang::ASTUnit::DeclVisitorFn Fn
Returns
true if the iteration was complete or false if it was aborted.
¶~ASTUnit()
~ASTUnit()
Declared at: clang/include/clang/Frontend/ASTUnit.h:422