зеркало из https://github.com/microsoft/clang-1.git
libclang: type safety for CXTranslationUnitImpl::FormatContext
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173589 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
e42e578ad8
Коммит
337ee24785
|
@ -2823,7 +2823,7 @@ void clang_disposeTranslationUnit(CXTranslationUnit CTUnit) {
|
|||
disposeCXStringPool(CTUnit->StringPool);
|
||||
delete static_cast<CXDiagnosticSetImpl *>(CTUnit->Diagnostics);
|
||||
disposeOverridenCXCursorsPool(CTUnit->OverridenCursorsPool);
|
||||
delete static_cast<SimpleFormatContext*>(CTUnit->FormatContext);
|
||||
delete CTUnit->FormatContext;
|
||||
delete CTUnit;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1368,23 +1368,20 @@ CXString clang_FullComment_getAsXML(CXComment CXC) {
|
|||
ASTContext &Context = FC->getDeclInfo()->CurrentDecl->getASTContext();
|
||||
CXTranslationUnit TU = CXC.TranslationUnit;
|
||||
SourceManager &SM = cxtu::getASTUnit(TU)->getSourceManager();
|
||||
|
||||
SimpleFormatContext *SFC =
|
||||
static_cast<SimpleFormatContext*>(TU->FormatContext);
|
||||
if (!SFC) {
|
||||
SFC = new SimpleFormatContext(Context.getLangOpts());
|
||||
TU->FormatContext = SFC;
|
||||
|
||||
if (!TU->FormatContext) {
|
||||
TU->FormatContext = new SimpleFormatContext(Context.getLangOpts());
|
||||
} else if ((TU->FormatInMemoryUniqueId % 1000) == 0) {
|
||||
// Delete after some number of iterators, so the buffers don't grow
|
||||
// too large.
|
||||
delete SFC;
|
||||
SFC = new SimpleFormatContext(Context.getLangOpts());
|
||||
TU->FormatContext = SFC;
|
||||
delete TU->FormatContext;
|
||||
TU->FormatContext = new SimpleFormatContext(Context.getLangOpts());
|
||||
}
|
||||
|
||||
SmallString<1024> XML;
|
||||
CommentASTToXMLConverter Converter(FC, XML, getCommandTraits(CXC), SM,
|
||||
*SFC, TU->FormatInMemoryUniqueId++);
|
||||
*TU->FormatContext,
|
||||
TU->FormatInMemoryUniqueId++);
|
||||
Converter.visit(FC);
|
||||
return createCXString(XML.str(), /* DupString = */ true);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
namespace clang {
|
||||
class ASTUnit;
|
||||
class CIndexer;
|
||||
class SimpleFormatContext;
|
||||
} // namespace clang
|
||||
|
||||
struct CXTranslationUnitImpl {
|
||||
|
@ -27,14 +28,11 @@ struct CXTranslationUnitImpl {
|
|||
void *StringPool;
|
||||
void *Diagnostics;
|
||||
void *OverridenCursorsPool;
|
||||
void *FormatContext;
|
||||
clang::SimpleFormatContext *FormatContext;
|
||||
unsigned FormatInMemoryUniqueId;
|
||||
};
|
||||
|
||||
namespace clang {
|
||||
class ASTUnit;
|
||||
class CIndexer;
|
||||
|
||||
namespace cxtu {
|
||||
|
||||
CXTranslationUnitImpl *MakeCXTranslationUnit(CIndexer *CIdx, ASTUnit *AU);
|
||||
|
|
Загрузка…
Ссылка в новой задаче