forked from OSchip/llvm-project
[libclang] When parsing with CXTranslationUnit_ForSerialization, make sure to install the ASTWriter that we create as an ASTMutationListener.
Fixes rdar://13833268 llvm-svn: 181575
This commit is contained in:
parent
ea2d5f818b
commit
1c7455f42f
|
@ -471,6 +471,7 @@ public:
|
|||
return OriginalSourceFile;
|
||||
}
|
||||
|
||||
ASTMutationListener *getASTMutationListener();
|
||||
ASTDeserializationListener *getDeserializationListener();
|
||||
|
||||
/// \brief Add a temporary file that the ASTUnit depends on.
|
||||
|
|
|
@ -638,6 +638,12 @@ void StoredDiagnosticConsumer::HandleDiagnostic(DiagnosticsEngine::Level Level,
|
|||
StoredDiags.push_back(StoredDiagnostic(Level, Info));
|
||||
}
|
||||
|
||||
ASTMutationListener *ASTUnit::getASTMutationListener() {
|
||||
if (WriterData)
|
||||
return &WriterData->Writer;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ASTDeserializationListener *ASTUnit::getDeserializationListener() {
|
||||
if (WriterData)
|
||||
return &WriterData->Writer;
|
||||
|
@ -929,6 +935,10 @@ public:
|
|||
handleTopLevelDecl(*it);
|
||||
}
|
||||
|
||||
virtual ASTMutationListener *GetASTMutationListener() {
|
||||
return Unit.getASTMutationListener();
|
||||
}
|
||||
|
||||
virtual ASTDeserializationListener *GetASTDeserializationListener() {
|
||||
return Unit.getDeserializationListener();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
// RUN: rm -rf %t.cache
|
||||
// RUN: c-index-test -write-pch %t.h.pch %s -target x86_64-apple-macosx10.7 -fobjc-arc -fmodules-cache-path=%t.cache -fmodules -F %S/../Modules/Inputs -Xclang -fdisable-module-hash
|
||||
// RUN: %clang -fsyntax-only %s -target x86_64-apple-macosx10.7 -include %t.h -fobjc-arc -fmodules-cache-path=%t.cache -fmodules -F %S/../Modules/Inputs \
|
||||
// RUN: -Xclang -fdisable-module-hash -Xclang -detailed-preprocessing-record -Xclang -verify
|
||||
|
||||
// expected-no-diagnostics
|
||||
|
||||
#ifndef PCH_HEADER
|
||||
#define PCH_HEADER
|
||||
|
||||
#include <Module/Module.h>
|
||||
|
||||
@interface Module(PCHCat)
|
||||
-(id)PCH_meth;
|
||||
@end
|
||||
|
||||
#else
|
||||
|
||||
void foo(Module *m) {
|
||||
[m PCH_meth];
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue