|
clang 23.0.0git
|
#include "clang/Frontend/ASTUnit.h"#include "clang/AST/ASTConsumer.h"#include "clang/AST/ASTContext.h"#include "clang/AST/CommentCommandTraits.h"#include "clang/AST/Decl.h"#include "clang/AST/DeclBase.h"#include "clang/AST/DeclCXX.h"#include "clang/AST/DeclGroup.h"#include "clang/AST/DeclObjC.h"#include "clang/AST/DeclTemplate.h"#include "clang/AST/DeclarationName.h"#include "clang/AST/ExternalASTSource.h"#include "clang/AST/PrettyPrinter.h"#include "clang/AST/Type.h"#include "clang/AST/TypeOrdering.h"#include "clang/Basic/Diagnostic.h"#include "clang/Basic/DiagnosticFrontend.h"#include "clang/Basic/FileManager.h"#include "clang/Basic/IdentifierTable.h"#include "clang/Basic/LLVM.h"#include "clang/Basic/LangOptions.h"#include "clang/Basic/LangStandard.h"#include "clang/Basic/Module.h"#include "clang/Basic/SourceLocation.h"#include "clang/Basic/SourceManager.h"#include "clang/Basic/TargetInfo.h"#include "clang/Basic/TargetOptions.h"#include "clang/Frontend/CompilerInstance.h"#include "clang/Frontend/CompilerInvocation.h"#include "clang/Frontend/FrontendAction.h"#include "clang/Frontend/FrontendActions.h"#include "clang/Frontend/FrontendOptions.h"#include "clang/Frontend/MultiplexConsumer.h"#include "clang/Frontend/PrecompiledPreamble.h"#include "clang/Frontend/StandaloneDiagnostic.h"#include "clang/Frontend/Utils.h"#include "clang/Lex/HeaderSearch.h"#include "clang/Lex/HeaderSearchOptions.h"#include "clang/Lex/Lexer.h"#include "clang/Lex/PPCallbacks.h"#include "clang/Lex/PreprocessingRecord.h"#include "clang/Lex/Preprocessor.h"#include "clang/Lex/PreprocessorOptions.h"#include "clang/Lex/Token.h"#include "clang/Sema/CodeCompleteConsumer.h"#include "clang/Sema/CodeCompleteOptions.h"#include "clang/Sema/Sema.h"#include "clang/Sema/SemaCodeCompletion.h"#include "clang/Serialization/ASTReader.h"#include "clang/Serialization/ASTWriter.h"#include "clang/Serialization/InMemoryModuleCache.h"#include "clang/Serialization/ModuleCache.h"#include "clang/Serialization/ModuleFile.h"#include "clang/Serialization/PCHContainerOperations.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/DenseMap.h"#include "llvm/ADT/IntrusiveRefCntPtr.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/ScopeExit.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/StringMap.h"#include "llvm/ADT/StringRef.h"#include "llvm/ADT/StringSet.h"#include "llvm/ADT/Twine.h"#include "llvm/ADT/iterator_range.h"#include "llvm/Bitstream/BitstreamWriter.h"#include "llvm/Support/Allocator.h"#include "llvm/Support/CrashRecoveryContext.h"#include "llvm/Support/DJB.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/ErrorOr.h"#include "llvm/Support/MemoryBuffer.h"#include "llvm/Support/SaveAndRestore.h"#include "llvm/Support/Timer.h"#include "llvm/Support/VirtualFileSystem.h"#include "llvm/Support/raw_ostream.h"#include <algorithm>#include <atomic>#include <cassert>#include <cstdint>#include <cstdio>#include <cstdlib>#include <memory>#include <mutex>#include <optional>#include <string>#include <tuple>#include <utility>#include <vector>Go to the source code of this file.
Functions | |
| template<class T> | |
| static std::unique_ptr< T > | valueOrNull (llvm::ErrorOr< std::unique_ptr< T > > Val) |
| static std::unique_ptr< llvm::MemoryBuffer > | getBufferForFileHandlingRemapping (const CompilerInvocation &Invocation, llvm::vfs::FileSystem *VFS, StringRef FilePath, bool isVolatile) |
Get a source buffer for MainFilePath, handling all file-to-file and file-to-buffer remappings inside Invocation. | |
| static uint64_t | getDeclShowContexts (const NamedDecl *ND, const LangOptions &LangOpts, bool &IsNestedNameSpecifier) |
| Determine the set of code-completion contexts in which this declaration should be shown. | |
| static bool | isInMainFile (const clang::Diagnostic &D) |
| static void | AddDefinedMacroToHash (const Token &MacroNameTok, unsigned &Hash) |
| Add the given macro to the hash of all top-level entities. | |
| static void | AddTopLevelDeclarationToHash (Decl *D, unsigned &Hash) |
| Add the given declaration to the hash of all top-level entities. | |
| static bool | isNonDriverDiag (const StoredDiagnostic &StoredDiag) |
| static void | checkAndRemoveNonDriverDiags (SmallVectorImpl< StoredDiagnostic > &StoredDiags) |
| static void | checkAndSanitizeDiags (SmallVectorImpl< StoredDiagnostic > &StoredDiagnostics, SourceManager &SM) |
| static void | CalculateHiddenNames (const CodeCompletionContext &Context, CodeCompletionResult *Results, unsigned NumResults, ASTContext &Ctx, llvm::StringSet< llvm::BumpPtrAllocator > &HiddenNames) |
| Helper function that computes which global names are hidden by the local code-completion results. | |
| static bool | serializeUnit (ASTWriter &Writer, SmallVectorImpl< char > &Buffer, Sema &S, raw_ostream &OS) |
Variables | |
| const unsigned | DefaultPreambleRebuildInterval = 5 |
| After failing to build a precompiled preamble (due to errors in the source that occurs in the preamble), the number of reparses during which we'll skip even trying to precompile the preamble. | |
| static std::atomic< unsigned > | ActiveASTUnitObjects |
| Tracks the number of ASTUnit objects that are currently active. | |
Add the given macro to the hash of all top-level entities.
Definition at line 888 of file ASTUnit.cpp.
References clang::Token::getIdentifierInfo(), and clang::IdentifierInfo::getName().
Add the given declaration to the hash of all top-level entities.
Definition at line 911 of file ASTUnit.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getLookupParent(), and clang::DeclContext::isTranslationUnit().
|
static |
Helper function that computes which global names are hidden by the local code-completion results.
Definition at line 1849 of file ASTUnit.cpp.
References clang::CodeCompletionContext::CCC_ArrowMemberAccess, clang::CodeCompletionContext::CCC_Attribute, clang::CodeCompletionContext::CCC_ClassOrStructTag, clang::CodeCompletionContext::CCC_ClassStructUnion, clang::CodeCompletionContext::CCC_DotMemberAccess, clang::CodeCompletionContext::CCC_EnumTag, clang::CodeCompletionContext::CCC_Expression, clang::CodeCompletionContext::CCC_IncludedFile, clang::CodeCompletionContext::CCC_MacroName, clang::CodeCompletionContext::CCC_MacroNameUse, clang::CodeCompletionContext::CCC_Namespace, clang::CodeCompletionContext::CCC_NaturalLanguage, clang::CodeCompletionContext::CCC_NewName, clang::CodeCompletionContext::CCC_ObjCCategoryName, clang::CodeCompletionContext::CCC_ObjCClassForwardDecl, clang::CodeCompletionContext::CCC_ObjCClassMessage, clang::CodeCompletionContext::CCC_ObjCImplementation, clang::CodeCompletionContext::CCC_ObjCInstanceMessage, clang::CodeCompletionContext::CCC_ObjCInterface, clang::CodeCompletionContext::CCC_ObjCInterfaceName, clang::CodeCompletionContext::CCC_ObjCIvarList, clang::CodeCompletionContext::CCC_ObjCMessageReceiver, clang::CodeCompletionContext::CCC_ObjCPropertyAccess, clang::CodeCompletionContext::CCC_ObjCProtocolName, clang::CodeCompletionContext::CCC_Other, clang::CodeCompletionContext::CCC_OtherWithMacros, clang::CodeCompletionContext::CCC_ParenthesizedExpression, clang::CodeCompletionContext::CCC_PreprocessorDirective, clang::CodeCompletionContext::CCC_PreprocessorExpression, clang::CodeCompletionContext::CCC_Recovery, clang::CodeCompletionContext::CCC_SelectorName, clang::CodeCompletionContext::CCC_Statement, clang::CodeCompletionContext::CCC_Symbol, clang::CodeCompletionContext::CCC_SymbolOrNewName, clang::CodeCompletionContext::CCC_TopLevel, clang::CodeCompletionContext::CCC_TopLevelOrExpression, clang::CodeCompletionContext::CCC_Type, clang::CodeCompletionContext::CCC_TypeQualifiers, clang::CodeCompletionContext::CCC_UnionTag, clang::CodeCompletionResult::Declaration, clang::DeclarationName::getAsIdentifierInfo(), clang::DeclarationName::getAsString(), clang::NamedDecl::getDeclName(), clang::Decl::getIdentifierNamespace(), clang::ASTContext::getLangOpts(), clang::NamedDecl::getUnderlyingDecl(), clang::Decl::IDNS_Member, clang::Decl::IDNS_Namespace, clang::Decl::IDNS_NonMemberOperator, clang::Decl::IDNS_Ordinary, clang::Decl::IDNS_Tag, and clang::Decl::IDNS_Type.
|
static |
Definition at line 1086 of file ASTUnit.cpp.
References isNonDriverDiag().
|
static |
Definition at line 1092 of file ASTUnit.cpp.
References SM.
|
static |
Get a source buffer for MainFilePath, handling all file-to-file and file-to-buffer remappings inside Invocation.
Definition at line 148 of file ASTUnit.cpp.
References clang::CompilerInvocation::getPreprocessorOpts(), and valueOrNull().
|
static |
Determine the set of code-completion contexts in which this declaration should be shown.
Definition at line 268 of file ASTUnit.cpp.
References clang::CodeCompletionContext::CCC_ClassOrStructTag, clang::CodeCompletionContext::CCC_ClassStructUnion, clang::CodeCompletionContext::CCC_EnumTag, clang::CodeCompletionContext::CCC_Expression, clang::CodeCompletionContext::CCC_Namespace, clang::CodeCompletionContext::CCC_ObjCCategoryName, clang::CodeCompletionContext::CCC_ObjCClassForwardDecl, clang::CodeCompletionContext::CCC_ObjCInterfaceName, clang::CodeCompletionContext::CCC_ObjCIvarList, clang::CodeCompletionContext::CCC_ObjCMessageReceiver, clang::CodeCompletionContext::CCC_ObjCProtocolName, clang::CodeCompletionContext::CCC_ParenthesizedExpression, clang::CodeCompletionContext::CCC_Statement, clang::CodeCompletionContext::CCC_TopLevel, clang::CodeCompletionContext::CCC_Type, clang::CodeCompletionContext::CCC_UnionTag, clang::NamedDecl::getUnderlyingDecl(), and clang::isa().
|
static |
Definition at line 587 of file ASTUnit.cpp.
References clang::Diagnostic::getLocation(), clang::Diagnostic::getSourceManager(), clang::Diagnostic::hasSourceManager(), clang::SourceLocation::isValid(), and clang::SourceManager::isWrittenInMainFile().
Referenced by clang::FilterAndStoreDiagnosticConsumer::HandleDiagnostic().
|
static |
Definition at line 1081 of file ASTUnit.cpp.
References clang::StoredDiagnostic::getLocation(), and clang::SourceLocation::isValid().
Referenced by checkAndRemoveNonDriverDiags().
|
static |
Definition at line 2206 of file ASTUnit.cpp.
References clang::ASTWriter::WriteAST().
Referenced by clang::ASTUnit::serialize().
|
static |
Definition at line 139 of file ASTUnit.cpp.
Referenced by getBufferForFileHandlingRemapping().
|
static |
Tracks the number of ASTUnit objects that are currently active.
Used for debugging purposes only.
Definition at line 220 of file ASTUnit.cpp.
Referenced by clang::ASTUnit::~ASTUnit().
| const unsigned DefaultPreambleRebuildInterval = 5 |
After failing to build a precompiled preamble (due to errors in the source that occurs in the preamble), the number of reparses during which we'll skip even trying to precompile the preamble.
Definition at line 215 of file ASTUnit.cpp.