diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/Builtins.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/AST/Builtins.cpp b/clang/lib/AST/Builtins.cpp index e345898b79c..92b05975f55 100644 --- a/clang/lib/AST/Builtins.cpp +++ b/clang/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/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index cc75b87c467..e023a91f2f1 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/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; } |