Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.
Nearly all of these changes are one-to-one replacements; the few that
aren't have to do with custom identifier validation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174768 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Edit/EditedSource.cpp b/lib/Edit/EditedSource.cpp
index 0027767..dd99ca9 100644
--- a/lib/Edit/EditedSource.cpp
+++ b/lib/Edit/EditedSource.cpp
@@ -8,13 +8,13 @@
//===----------------------------------------------------------------------===//
#include "clang/Edit/EditedSource.h"
+#include "clang/Basic/CharInfo.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Edit/Commit.h"
#include "clang/Edit/EditsReceiver.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
-#include <cctype>
using namespace clang;
using namespace edit;
@@ -240,16 +240,12 @@
return true;
}
-static inline bool isIdentifierChar(char c, const LangOptions &LangOpts) {
- return std::isalnum(c) || c == '_' || (c == '$' && LangOpts.DollarIdents);
-}
-
// \brief Returns true if it is ok to make the two given characters adjacent.
static bool canBeJoined(char left, char right, const LangOptions &LangOpts) {
- // FIXME: Should use the Lexer to make sure we don't allow stuff like
+ // FIXME: Should use TokenConcatenation to make sure we don't allow stuff like
// making two '<' adjacent.
- return !(isIdentifierChar(left, LangOpts) &&
- isIdentifierChar(right, LangOpts));
+ return !(Lexer::isIdentifierBodyChar(left, LangOpts) &&
+ Lexer::isIdentifierBodyChar(right, LangOpts));
}
/// \brief Returns true if it is ok to eliminate the trailing whitespace between
@@ -258,7 +254,7 @@
const LangOptions &LangOpts) {
if (!canBeJoined(left, right, LangOpts))
return false;
- if (std::isspace(left) || std::isspace(right))
+ if (isWhitespace(left) || isWhitespace(right))
return true;
if (canBeJoined(beforeWSpace, right, LangOpts))
return false; // the whitespace was intentional, keep it.