Fix the build on win32.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64556 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/ASTConsumers.h b/Driver/ASTConsumers.h
index 0093a70..2032a2d 100644
--- a/Driver/ASTConsumers.h
+++ b/Driver/ASTConsumers.h
@@ -30,7 +30,7 @@
 class Preprocessor;
 class PreprocessorFactory;
 struct CompileOptions;
-struct LangOptions;
+class LangOptions;
 
 ASTConsumer *CreateASTPrinter(llvm::raw_ostream* OS = NULL);
 
diff --git a/Driver/CacheTokens.cpp b/Driver/CacheTokens.cpp
index 02e9f6c..d2921f0 100644
--- a/Driver/CacheTokens.cpp
+++ b/Driver/CacheTokens.cpp
@@ -26,6 +26,11 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Streams.h"
 
+// FIXME: put this somewhere else?
+#ifndef S_ISDIR
+#define S_ISDIR(x) (((x)&_S_IFDIR)!=0)
+#endif
+
 using namespace clang;
 
 typedef uint32_t Offset;
diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h
index 5a1aaaa..6aa8862 100644
--- a/include/clang/Basic/FileManager.h
+++ b/include/clang/Basic/FileManager.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/Bitcode/SerializationFwd.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/Config/config.h" // for mode_t
 #include <map>
 #include <set>
 #include <string>
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h
index 27697df..c4022b6 100644
--- a/include/clang/Basic/IdentifierTable.h
+++ b/include/clang/Basic/IdentifierTable.h
@@ -29,7 +29,7 @@
 }
 
 namespace clang {
-  struct LangOptions;
+  class LangOptions;
   class IdentifierInfo;
   class IdentifierTable;
   class SourceLocation;
diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h
index b85a74b..96c79aa 100644
--- a/include/clang/Basic/LangOptions.h
+++ b/include/clang/Basic/LangOptions.h
@@ -20,8 +20,8 @@
 
 /// LangOptions - This class keeps track of the various options that can be
 /// enabled, which controls the dialect of C that is accepted.
-struct LangOptions {
-  
+class LangOptions {
+public:
   unsigned Trigraphs         : 1;  // Trigraphs in source files.
   unsigned BCPLComment       : 1;  // BCPL-style '//' comments.
   unsigned DollarIdents      : 1;  // '$' allowed in identifiers.
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index 565cb0e..77ad2b2 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -571,7 +571,7 @@
                                           FileManager &FMgr);
   
 private:
-  friend struct SrcMgr::ContentCache; // Used for deserialization.
+  friend class SrcMgr::ContentCache; // Used for deserialization.
   
   /// isOffsetInFileID - Return true if the specified FileID contains the
   /// specified SourceLocation offset.  This is a very hot method.
diff --git a/lib/AST/Builtins.cpp b/lib/AST/Builtins.cpp
index e345898..92b0597 100644
--- a/lib/AST/Builtins.cpp
+++ b/lib/AST/Builtins.cpp
@@ -50,7 +50,7 @@
 }
 
 std::string Builtin::Context::getHeaderName(unsigned ID) const {
-  char *Name = strchr(GetRecord(ID).Attributes, 'f');
+  const char *Name = strchr(GetRecord(ID).Attributes, 'f');
   if (!Name)
     return 0;
   ++Name;
@@ -59,7 +59,7 @@
     return 0;
 
   ++Name;
-  char *NameEnd = strchr(Name, ':');
+  const char *NameEnd = strchr(Name, ':');
   assert(NameEnd && "Missing ':' after header name");
   return std::string(Name, NameEnd);
 }
@@ -67,7 +67,7 @@
 bool 
 Builtin::Context::isPrintfLike(unsigned ID, unsigned &FormatIdx, 
                                bool &HasVAListArg) {
-  char *Printf = strpbrk(GetRecord(ID).Attributes, "pP");
+  const char *Printf = strpbrk(GetRecord(ID).Attributes, "pP");
   if (!Printf)
     return false;
 
@@ -77,7 +77,7 @@
   assert(*Printf == ':' && "p or P specifier must have be followed by a ':'");
   ++Printf;
 
-  char *PrintfEnd = strchr(Printf, ':');
+  const char *PrintfEnd = strchr(Printf, ':');
   assert(PrintfEnd && "printf specifier must end with a ':'");
 
   FormatIdx = strtol(Printf, 0, 10);
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index cc75b87..e023a91 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -94,6 +94,12 @@
   }
 };
 
+// needed for FindNearestLineEntry (upper_bound of LineEntry)
+inline bool operator<(const LineEntry &lhs, const LineEntry &rhs) {
+  // FIXME: should check the other field?
+  return lhs.FileOffset < rhs.FileOffset;
+}
+
 inline bool operator<(const LineEntry &E, unsigned Offset) {
   return E.FileOffset < Offset;
 }