]> granicus.if.org Git - clang/commitdiff
[libclang] When parsing with CXTranslationUnit_ForSerialization, make sure to install...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 10 May 2013 01:28:51 +0000 (01:28 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 10 May 2013 01:28:51 +0000 (01:28 +0000)
Fixes rdar://13833268

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181575 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Frontend/ASTUnit.h
lib/Frontend/ASTUnit.cpp
test/Index/pch-with-module.m [new file with mode: 0644]

index 02c57d7472a5c980ac1596c2552f2f2584eaca94..9bd0ef31e09b6b763bd45dbc72b8ea99c4166b57 100644 (file)
@@ -471,6 +471,7 @@ public:
     return OriginalSourceFile;
   }
 
+  ASTMutationListener *getASTMutationListener();
   ASTDeserializationListener *getDeserializationListener();
 
   /// \brief Add a temporary file that the ASTUnit depends on.
index f05d7225465c17aaa4d7dbd040893db5014123ad..7850dc697be498a944fcab9ce45423b59fba1766 100644 (file)
@@ -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();
   }
diff --git a/test/Index/pch-with-module.m b/test/Index/pch-with-module.m
new file mode 100644 (file)
index 0000000..e839c81
--- /dev/null
@@ -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