]> granicus.if.org Git - clang/commitdiff
Fix ASTReader handling of ImportDecls, from Meador Inge!
authorDouglas Gregor <dgregor@apple.com>
Wed, 16 May 2012 16:31:58 +0000 (16:31 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 16 May 2012 16:31:58 +0000 (16:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156923 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTReaderDecl.cpp
test/Modules/Inputs/import-decl.h [new file with mode: 0644]
test/Modules/Inputs/module.map
test/Modules/import-decl.cpp [new file with mode: 0644]

index 512b070620ac632f7da0ff3345e111d072d7f4fc..5870fba36c2896e4e2f25d70ded0ef48721dd2c9 100644 (file)
@@ -1249,7 +1249,6 @@ void ASTDeclReader::VisitImportDecl(ImportDecl *D) {
   SourceLocation *StoredLocs = reinterpret_cast<SourceLocation *>(D + 1);
   for (unsigned I = 0, N = Record.back(); I != N; ++I)
     StoredLocs[I] = ReadSourceLocation(Record, Idx);
-  ++Idx;
 }
 
 void ASTDeclReader::VisitAccessSpecDecl(AccessSpecDecl *D) {
diff --git a/test/Modules/Inputs/import-decl.h b/test/Modules/Inputs/import-decl.h
new file mode 100644 (file)
index 0000000..9741d6c
--- /dev/null
@@ -0,0 +1 @@
+struct T {};
index e8d1f2c666fc6775071f7d515c1b3cb2efd401bb..79056cb51800f4a39f0ad3e7cb77d7bfdacbd687 100644 (file)
@@ -84,3 +84,6 @@ module MethodPoolA {
 module MethodPoolB {
   header "MethodPoolB.h"
 }
+module import_decl {
+  header "import-decl.h"
+}
diff --git a/test/Modules/import-decl.cpp b/test/Modules/import-decl.cpp
new file mode 100644 (file)
index 0000000..7696693
--- /dev/null
@@ -0,0 +1,10 @@
+// RUN: rm -rf %t
+// RUN: %clang -fmodule-cache-path %t -fmodules -x objective-c -I %S/Inputs -emit-ast -o %t.ast %s
+// RUN: %clang -cc1 -ast-print -x ast - < %t.ast | FileCheck %s
+
+@__experimental_modules_import import_decl;
+// CHECK: struct T
+
+int main() {
+  return 0;
+}