The ASTReader created by -chain-include used the generated PCH buffers in the wrong order. The effect was that all but the first chain-include files was ignored for subsequent compilations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129513 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 1b0f8c5..8e8a1bd 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -2463,8 +2463,8 @@
   }
 
   if (!ASTBuffers.empty()) {
-    F.Buffer.reset(ASTBuffers.front());
-    ASTBuffers.pop_front();
+    F.Buffer.reset(ASTBuffers.back());
+    ASTBuffers.pop_back();
     assert(F.Buffer && "Passed null buffer");
   } else {
     // Open the AST file.