本文整理汇总了C++中ASTUnit::Reparse方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTUnit::Reparse方法的具体用法?C++ ASTUnit::Reparse怎么用?C++ ASTUnit::Reparse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASTUnit
的用法示例。
在下文中一共展示了ASTUnit::Reparse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReparseProjectFile
ASTUnit* TranslationUnitManager::ReparseProjectFile(ProjectFile* file)
{
{ //if the file is already being parsed return immediately.
std::lock_guard<std::mutex> lock(m_FilesBeingParsedMutex);
auto it = std::find(m_FilesBeingParsed.begin(), m_FilesBeingParsed.end(), file);
if (it != m_FilesBeingParsed.end())
return nullptr;
m_FilesBeingParsed.push_back(file);
}
wxString fileName = file->file.GetFullPath();
ccEvent startEvent(ccEVT_REPARSE_START, fileName, nullptr, file);
AddPendingEvent(startEvent);
#ifdef CLANGCC_TIMING
wxStopWatch watch;
#endif // CLANGCC_TIMING
cbStyledTextCtrl* control = Manager::Get()->GetEditorManager()->GetBuiltinEditor(fileName)->GetControl();
SmallVector<ASTUnit::RemappedFile,1> remappedFiles;
if (control->GetModify())
{
unsigned length = control->GetLength();
llvm::MemoryBuffer* membuf = llvm::MemoryBuffer::getNewUninitMemBuffer(length+1,wx2std(fileName)).release();
control->SendMsg(SCI_GETTEXT, length+1, (wxUIntPtr)membuf->getBufferStart());
ASTUnit::RemappedFile remap = std::make_pair(wx2std(fileName),membuf);
remappedFiles.push_back(remap);
}
ASTUnit* tu = GetASTUnitForProjectFile(file);
if (!tu)
tu = ParseProjectFile(file);
if (!tu || tu->Reparse(m_PCHContainerOps, remappedFiles))
LoggerAccess::Get()->Log("\t Reparsing Failed : "+ file->file.GetFullName());
#ifdef CLANGCC_TIMING
LoggerAccess::Get()->Log(wxString::Format("Reparsing completed in %ldms", watch.Time()), Logger::info);
#endif // CLANGCC_TIMING
{ //File is free again
std::lock_guard<std::mutex> lock(m_FilesBeingParsedMutex);
m_FilesBeingParsed.erase(std::remove(m_FilesBeingParsed.begin(), m_FilesBeingParsed.end(), file),m_FilesBeingParsed.end());
}
ccEvent endEvent(ccEVT_REPARSE_END, fileName, tu, file);
AddPendingEvent(endEvent);
return tu;
}