Revert r275481, r275490. This broke modules bootstrap.

llvm-svn: 275624
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index 8a54d9e..23d1854 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -2126,7 +2126,7 @@
   // ImportDecl is used by codegen to determine the set of imported modules to
   // search for inputs for automatic linking; include it if it has a semantic
   // effect.
-  if (isa<ImportDecl>(D))
+  if (isa<ImportDecl>(D) && !WritingModule)
     return true;
 
   return Context.DeclMustBeEmitted(D);