Fix ASTReader handling of ImportDecls, from Meador Inge!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156923 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp
index 512b070..5870fba 100644
--- a/lib/Serialization/ASTReaderDecl.cpp
+++ b/lib/Serialization/ASTReaderDecl.cpp
@@ -1249,7 +1249,6 @@
   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
index 0000000..9741d6c
--- /dev/null
+++ b/test/Modules/Inputs/import-decl.h
@@ -0,0 +1 @@
+struct T {};
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index e8d1f2c..79056cb 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -84,3 +84,6 @@
 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
index 0000000..7696693
--- /dev/null
+++ b/test/Modules/import-decl.cpp
@@ -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;
+}