implement the microsoft/gnu "__COUNTER__" macro: rdar://4329310


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68933 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index 6faf37f..2cf932c 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -567,6 +567,13 @@
   
   RecordData Record;
 
+  // If the preprocessor __COUNTER__ value has been bumped, remember it.
+  if (PP.getCounterValue() != 0) {
+    Record.push_back(PP.getCounterValue());
+    S.EmitRecord(pch::PP_COUNTER_VALUE, Record);
+    Record.clear();
+  }  
+  
   // Loop over all the macro definitions that are live at the end of the file,
   // emitting each to the PP section.
   // FIXME: Eventually we want to emit an index so that we can lazily load
@@ -627,9 +634,6 @@
     
   }
   
-  // TODO: someday when PP supports __COUNTER__, emit a record for its value if
-  // non-zero.
-  
   S.ExitBlock();
 }