From ea684e699ea84e61711e279f5fa7a1b9f3d46bc2 Mon Sep 17 00:00:00 2001 From: Cedric Venet Date: Sat, 14 Feb 2009 16:15:20 +0000 Subject: [PATCH] Fix the build on win32. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64556 91177308-0d34-0410-b5e6-96231b3b80d8 --- Driver/ASTConsumers.h | 2 +- Driver/CacheTokens.cpp | 5 +++++ include/clang/Basic/FileManager.h | 1 + include/clang/Basic/IdentifierTable.h | 2 +- include/clang/Basic/LangOptions.h | 4 ++-- include/clang/Basic/SourceManager.h | 2 +- lib/AST/Builtins.cpp | 8 ++++---- lib/Basic/SourceManager.cpp | 6 ++++++ 8 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Driver/ASTConsumers.h b/Driver/ASTConsumers.h index 0093a7046a..2032a2d598 100644 --- a/Driver/ASTConsumers.h +++ b/Driver/ASTConsumers.h @@ -30,7 +30,7 @@ class FileManager; 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 02e9f6cff0..d2921f0152 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 5a1aaaa9f1..6aa88629ce 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 #include #include diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 27697df76c..c4022b6496 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -29,7 +29,7 @@ namespace llvm { } 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 b85a74bc4a..96c79aa8aa 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -20,8 +20,8 @@ namespace clang { /// 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 565cb0e17e..77ad2b2086 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -571,7 +571,7 @@ public: 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 e345898b79..92b05975f5 100644 --- a/lib/AST/Builtins.cpp +++ b/lib/AST/Builtins.cpp @@ -50,7 +50,7 @@ void Builtin::Context::InitializeBuiltins(IdentifierTable &Table, } 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 @@ std::string Builtin::Context::getHeaderName(unsigned ID) const { 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 @@ std::string Builtin::Context::getHeaderName(unsigned ID) const { 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 @@ Builtin::Context::isPrintfLike(unsigned ID, unsigned &FormatIdx, 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 cc75b87c46..e023a91f2f 100644 --- a/lib/Basic/SourceManager.cpp +++ b/lib/Basic/SourceManager.cpp @@ -94,6 +94,12 @@ struct LineEntry { } }; +// 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; } -- 2.40.0