r181575 - [libclang] When parsing with CXTranslationUnit_ForSerialization, make sure to install the ASTWriter that we create as an ASTMutationListener.
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu May 9 18:28:52 PDT 2013
Author: akirtzidis
Date: Thu May 9 20:28:51 2013
New Revision: 181575
URL: http://llvm.org/viewvc/llvm-project?rev=181575&view=rev
Log:
[libclang] When parsing with CXTranslationUnit_ForSerialization, make sure to install the ASTWriter that we create as an ASTMutationListener.
Fixes rdar://13833268
Added:
cfe/trunk/test/Index/pch-with-module.m
Modified:
cfe/trunk/include/clang/Frontend/ASTUnit.h
cfe/trunk/lib/Frontend/ASTUnit.cpp
Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=181575&r1=181574&r2=181575&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTUnit.h Thu May 9 20:28:51 2013
@@ -471,6 +471,7 @@ public:
return OriginalSourceFile;
}
+ ASTMutationListener *getASTMutationListener();
ASTDeserializationListener *getDeserializationListener();
/// \brief Add a temporary file that the ASTUnit depends on.
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=181575&r1=181574&r2=181575&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Thu May 9 20:28:51 2013
@@ -638,6 +638,12 @@ void StoredDiagnosticConsumer::HandleDia
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();
}
Added: cfe/trunk/test/Index/pch-with-module.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/pch-with-module.m?rev=181575&view=auto
==============================================================================
--- cfe/trunk/test/Index/pch-with-module.m (added)
+++ cfe/trunk/test/Index/pch-with-module.m Thu May 9 20:28:51 2013
@@ -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>
+
+ at interface Module(PCHCat)
+-(id)PCH_meth;
+ at end
+
+#else
+
+void foo(Module *m) {
+ [m PCH_meth];
+}
+
+#endif
More information about the cfe-commits
mailing list