Lines Matching defs:AST

14 #include "clang/AST/ASTConsumer.h"
15 #include "clang/AST/ASTContext.h"
16 #include "clang/AST/CommentCommandTraits.h"
17 #include "clang/AST/Decl.h"
18 #include "clang/AST/DeclBase.h"
19 #include "clang/AST/DeclCXX.h"
20 #include "clang/AST/DeclGroup.h"
21 #include "clang/AST/DeclObjC.h"
22 #include "clang/AST/DeclTemplate.h"
23 #include "clang/AST/DeclarationName.h"
24 #include "clang/AST/ExternalASTSource.h"
25 #include "clang/AST/PrettyPrinter.h"
26 #include "clang/AST/Type.h"
27 #include "clang/AST/TypeOrdering.h"
251 // If we loaded from an AST file, balance out the BeginSourceFile call.
791 ASTUnit &AST,
796 &AST.StoredDiagnostics, nullptr,
808 std::unique_ptr<ASTUnit> AST(new ASTUnit(true));
812 ASTUnitCleanup(AST.get());
817 ConfigureDiags(Diags, *AST, CaptureDiagnostics);
819 AST->LangOpts = LangOpts ? LangOpts : std::make_shared<LangOptions>();
820 AST->OnlyLocalDecls = OnlyLocalDecls;
821 AST->CaptureDiagnostics = CaptureDiagnostics;
822 AST->Diagnostics = Diags;
823 AST->FileMgr = new FileManager(FileSystemOpts, VFS);
824 AST->UserFilesAreVolatile = UserFilesAreVolatile;
825 AST->SourceMgr = new SourceManager(AST->getDiagnostics(),
826 AST->getFileManager(),
828 AST->ModuleCache = new InMemoryModuleCache;
829 AST->HSOpts = HSOpts ? HSOpts : std::make_shared<HeaderSearchOptions>();
830 AST->HSOpts->ModuleFormat = std::string(PCHContainerRdr.getFormats().front());
831 AST->HeaderInfo.reset(new HeaderSearch(AST->HSOpts,
832 AST->getSourceManager(),
833 AST->getDiagnostics(),
834 AST->getLangOpts(),
836 AST->PPOpts = std::make_shared<PreprocessorOptions>();
840 HeaderSearch &HeaderInfo = *AST->HeaderInfo;
842 AST->PP = std::make_shared<Preprocessor>(
843 AST->PPOpts, AST->getDiagnostics(), *AST->LangOpts,
844 AST->getSourceManager(), HeaderInfo, AST->ModuleLoader,
847 Preprocessor &PP = *AST->PP;
850 AST->Ctx = new ASTContext(*AST->LangOpts, AST->getSourceManager(),
853 AST->getTranslationUnitKind());
859 AST->Reader = new ASTReader(
860 PP, *AST->ModuleCache, AST->Ctx.get(), PCHContainerRdr, {},
865 AST->Reader->setListener(std::make_unique<ASTInfoCollector>(
866 *AST->PP, AST->Ctx.get(), *AST->HSOpts, *AST->PPOpts, *AST->LangOpts,
867 AST->TargetOpts, AST->Target, Counter));
869 // Attach the AST reader to the AST context as an external AST
871 // AST file as needed.
872 // We need the external source to be set up before we read the AST, because
874 if (AST->Ctx)
875 AST->Ctx->setExternalSource(AST->Reader);
877 switch (AST->Reader->ReadAST(Filename, serialization::MK_MainFile,
888 AST->getDiagnostics().Report(diag::err_fe_unable_to_load_pch);
892 AST->OriginalSourceFile = std::string(AST->Reader->getOriginalSourceFile());
896 Module *M = HeaderInfo.lookupModule(AST->getLangOpts().CurrentModule);
897 if (M && AST->getLangOpts().isCompilingModule() && M->isNamedModule())
898 AST->Ctx->setCurrentNamedModule(M);
900 // Create an AST consumer, even though it isn't used.
902 AST->Consumer.reset(new ASTConsumer);
904 // Create a semantic analysis object and tell the AST reader about it.
906 AST->TheSema.reset(new Sema(PP, *AST->Ctx, *AST->Consumer));
907 AST->TheSema->Initialize();
908 AST->Reader->InitializeSema(*AST->TheSema);
912 AST->getDiagnostics().getClient()->BeginSourceFile(PP.getLangOpts(), &PP);
914 return AST;
1161 // Create the compiler instance to use for building the AST.
1206 "FIXME: AST inputs not yet supported here!");
1534 std::unique_ptr<ASTUnit> AST(new ASTUnit(false));
1535 ConfigureDiags(Diags, *AST, CaptureDiagnostics);
1538 AST->Diagnostics = Diags;
1539 AST->FileSystemOpts = CI->getFileSystemOpts();
1540 AST->Invocation = std::move(CI);
1541 AST->FileMgr = new FileManager(AST->FileSystemOpts, VFS);
1542 AST->UserFilesAreVolatile = UserFilesAreVolatile;
1543 AST->SourceMgr = new SourceManager(AST->getDiagnostics(), *AST->FileMgr,
1545 AST->ModuleCache = new InMemoryModuleCache;
1547 return AST;
1561 ASTUnit *AST = Unit;
1562 if (!AST) {
1563 // Create the AST unit.
1565 AST = OwnAST.get();
1566 if (!AST)
1574 AST->OnlyLocalDecls = OnlyLocalDecls;
1575 AST->CaptureDiagnostics = CaptureDiagnostics;
1577 AST->PreambleRebuildCountdown = PrecompilePreambleAfterNParses;
1578 AST->TUKind = Action ? Action->getTranslationUnitKind() : TU_Complete;
1579 AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
1580 AST->IncludeBriefCommentsInCodeCompletion = false;
1592 ProcessWarningOptions(AST->getDiagnostics(), CI->getDiagnosticOpts());
1594 // Create the compiler instance to use for building the AST.
1603 AST->OriginalSourceFile =
1608 Clang->setDiagnostics(&AST->getDiagnostics());
1618 "FIXME: AST inputs not yet supported here!");
1624 AST->TheSema.reset();
1625 AST->Ctx = nullptr;
1626 AST->PP = nullptr;
1627 AST->Reader = nullptr;
1630 Clang->setFileManager(&AST->getFileManager());
1633 Clang->setSourceManager(&AST->getSourceManager());
1639 TrackerAct.reset(new TopLevelDeclTrackerAction(*AST));
1648 AST->transferASTDataFromCompilerInstance(*Clang);
1658 AST->getCurrentTopLevelHashValue()));
1663 *AST, AST->getCurrentTopLevelHashValue()));
1669 AST->transferASTDataFromCompilerInstance(*Clang);
1677 AST->transferASTDataFromCompilerInstance(*Clang);
1684 return AST;
1729 // Create the AST unit.
1730 std::unique_ptr<ASTUnit> AST(new ASTUnit(false));
1731 ConfigureDiags(Diags, *AST, CaptureDiagnostics);
1732 AST->Diagnostics = Diags;
1733 AST->OnlyLocalDecls = OnlyLocalDecls;
1734 AST->CaptureDiagnostics = CaptureDiagnostics;
1735 AST->TUKind = TUKind;
1736 AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
1737 AST->IncludeBriefCommentsInCodeCompletion
1739 AST->Invocation = std::move(CI);
1740 AST->FileSystemOpts = FileMgr->getFileSystemOpts();
1741 AST->FileMgr = FileMgr;
1742 AST->UserFilesAreVolatile = UserFilesAreVolatile;
1746 ASTUnitCleanup(AST.get());
1751 if (AST->LoadFromCompilerInvocation(std::move(PCHContainerOps),
1753 &AST->FileMgr->getVirtualFileSystem()))
1755 return AST;
1817 // Create the AST unit.
1818 std::unique_ptr<ASTUnit> AST;
1819 AST.reset(new ASTUnit(false));
1820 AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size();
1821 AST->StoredDiagnostics.swap(StoredDiagnostics);
1822 ConfigureDiags(Diags, *AST, CaptureDiagnostics);
1823 AST->Diagnostics = Diags;
1824 AST->FileSystemOpts = CI->getFileSystemOpts();
1826 AST->FileMgr = new FileManager(AST->FileSystemOpts, VFS);
1827 AST->StorePreamblesInMemory = StorePreamblesInMemory;
1828 AST->PreambleStoragePath = PreambleStoragePath;
1829 AST->ModuleCache = new InMemoryModuleCache;
1830 AST->OnlyLocalDecls = OnlyLocalDecls;
1831 AST->CaptureDiagnostics = CaptureDiagnostics;
1832 AST->TUKind = TUKind;
1833 AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
1834 AST->IncludeBriefCommentsInCodeCompletion
1836 AST->UserFilesAreVolatile = UserFilesAreVolatile;
1837 AST->Invocation = CI;
1838 AST->SkipFunctionBodies = SkipFunctionBodies;
1840 AST->WriterData.reset(new ASTWriterData(*AST->ModuleCache));
1847 ASTUnitCleanup(AST.get());
1849 if (AST->LoadFromCompilerInvocation(std::move(PCHContainerOps),
1855 AST->StoredDiagnostics.swap(AST->FailedParseDiagnostics);
1856 ErrAST->swap(AST);
1861 return AST;
1946 ASTUnit &AST;
1950 AugmentedCodeCompleteConsumer(ASTUnit &AST, CodeCompleteConsumer &Next,
1952 : CodeCompleteConsumer(CodeCompleteOpts), AST(AST), Next(Next) {
1970 if (AST.getASTContext().getLangOpts().CPlusPlus)
2103 C = AST.cached_completion_begin(),
2104 CEnd = AST.cached_completion_end();
2141 = AST.getCachedCompletionTypes();
2252 "FIXME: AST inputs not yet supported here!");