diff --git a/lib/Frontend/Rewrite/InclusionRewriter.cpp b/lib/Frontend/Rewrite/InclusionRewriter.cpp
index d45cbc01df8ceee5d25de9f539cf3f3497dd1725..3564cebba8a8a5f951307f7d85c3fcf34ce41bfb 100644
--- a/lib/Frontend/Rewrite/InclusionRewriter.cpp
+++ b/lib/Frontend/Rewrite/InclusionRewriter.cpp
@@ -177,7 +177,9 @@ void InclusionRewriter::FileSkipped(const FileEntry &/*SkippedFile*/,
 /// directives. It does not say whether the file has been included, but it
 /// provides more information about the directive (hash location instead
 /// of location inside the included file). It is assumed that the matching
-/// FileChanged() or FileSkipped() is called after this.
+/// FileChanged() or FileSkipped() is called after this (or neither is
+/// called if this #include results in an error or does not textually include
+/// anything).
 void InclusionRewriter::InclusionDirective(SourceLocation HashLoc,
                                            const Token &/*IncludeTok*/,
                                            StringRef /*FileName*/,
@@ -187,9 +189,6 @@ void InclusionRewriter::InclusionDirective(SourceLocation HashLoc,
                                            StringRef /*SearchPath*/,
                                            StringRef /*RelativePath*/,
                                            const Module *Imported) {
-  assert(LastInclusionLocation.isInvalid() &&
-         "Another inclusion directive was found before the previous one "
-         "was processed");
   if (Imported) {
     auto P = ModuleIncludes.insert(
         std::make_pair(HashLoc.getRawEncoding(), Imported));
diff --git a/test/Frontend/rewrite-includes-filenotfound.c b/test/Frontend/rewrite-includes-filenotfound.c
new file mode 100644
index 0000000000000000000000000000000000000000..203dbde545166ae1f6a78695bf05c229132da454
--- /dev/null
+++ b/test/Frontend/rewrite-includes-filenotfound.c
@@ -0,0 +1,6 @@
+// RUN: not %clang_cc1 -E -frewrite-includes %s -o - 2>&1 | FileCheck %s
+
+#include "this file does not exist.foo"
+#include "this file also does not exist.foo"
+
+CHECK: fatal error: {{.*}} file not found