本文整理汇总了C++中OwningPtr::importedPCH方法的典型用法代码示例。如果您正苦于以下问题:C++ OwningPtr::importedPCH方法的具体用法?C++ OwningPtr::importedPCH怎么用?C++ OwningPtr::importedPCH使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OwningPtr
的用法示例。
在下文中一共展示了OwningPtr::importedPCH方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clang_indexTranslationUnit_Impl
static void clang_indexTranslationUnit_Impl(void *UserData) {
IndexTranslationUnitInfo *ITUI =
static_cast<IndexTranslationUnitInfo*>(UserData);
CXTranslationUnit TU = ITUI->TU;
CXClientData client_data = ITUI->client_data;
IndexerCallbacks *client_index_callbacks = ITUI->index_callbacks;
unsigned index_callbacks_size = ITUI->index_callbacks_size;
unsigned index_options = ITUI->index_options;
ITUI->result = 1; // init as error.
if (!TU)
return;
if (!client_index_callbacks || index_callbacks_size == 0)
return;
CIndexer *CXXIdx = TU->CIdx;
if (CXXIdx->isOptEnabled(CXGlobalOpt_ThreadBackgroundPriorityForIndexing))
setThreadBackgroundPriority();
IndexerCallbacks CB;
memset(&CB, 0, sizeof(CB));
unsigned ClientCBSize = index_callbacks_size < sizeof(CB)
? index_callbacks_size : sizeof(CB);
memcpy(&CB, client_index_callbacks, ClientCBSize);
OwningPtr<IndexingContext> IndexCtx;
IndexCtx.reset(new IndexingContext(client_data, CB, index_options, TU));
// Recover resources if we crash before exiting this method.
llvm::CrashRecoveryContextCleanupRegistrar<IndexingContext>
IndexCtxCleanup(IndexCtx.get());
OwningPtr<IndexingConsumer> IndexConsumer;
IndexConsumer.reset(new IndexingConsumer(*IndexCtx, 0));
// Recover resources if we crash before exiting this method.
llvm::CrashRecoveryContextCleanupRegistrar<IndexingConsumer>
IndexConsumerCleanup(IndexConsumer.get());
ASTUnit *Unit = cxtu::getASTUnit(TU);
if (!Unit)
return;
ASTUnit::ConcurrencyCheck Check(*Unit);
if (const FileEntry *PCHFile = Unit->getPCHFile())
IndexCtx->importedPCH(PCHFile);
FileManager &FileMgr = Unit->getFileManager();
if (Unit->getOriginalSourceFileName().empty())
IndexCtx->enteredMainFile(0);
else
IndexCtx->enteredMainFile(FileMgr.getFile(Unit->getOriginalSourceFileName()));
IndexConsumer->Initialize(Unit->getASTContext());
indexPreprocessingRecord(*Unit, *IndexCtx);
indexTranslationUnit(*Unit, *IndexCtx);
indexDiagnostics(TU, *IndexCtx);
ITUI->result = 0;
}