class Preprocessor;
class PreprocessorFactory;
struct CompileOptions;
-struct LangOptions;
+class LangOptions;
ASTConsumer *CreateASTPrinter(llvm::raw_ostream* OS = NULL);
#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;
#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>
}
namespace clang {
- struct LangOptions;
+ class LangOptions;
class IdentifierInfo;
class IdentifierTable;
class SourceLocation;
/// 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.
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.
}
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;
return 0;
++Name;
- char *NameEnd = strchr(Name, ':');
+ const char *NameEnd = strchr(Name, ':');
assert(NameEnd && "Missing ':' after header name");
return std::string(Name, NameEnd);
}
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;
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);
}
};
+// 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;
}