diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-02-08 22:30:41 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-02-08 22:30:41 +0000 |
commit | 3f6f51e28231f65de9c2dd150a2d757b2162cfa3 (patch) | |
tree | 1e341c81fec0bf620086a1afa40f4f847dc5bdc4 /lib/Frontend/LayoutOverrideSource.cpp | |
parent | 4a04d445af4d29440371800409babc98708d98aa (diff) |
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
Diffstat (limited to 'lib/Frontend/LayoutOverrideSource.cpp')
-rw-r--r-- | lib/Frontend/LayoutOverrideSource.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Frontend/LayoutOverrideSource.cpp b/lib/Frontend/LayoutOverrideSource.cpp index 9309661972..924a64068f 100644 --- a/lib/Frontend/LayoutOverrideSource.cpp +++ b/lib/Frontend/LayoutOverrideSource.cpp @@ -8,8 +8,8 @@ //===----------------------------------------------------------------------===// #include "clang/Frontend/LayoutOverrideSource.h" #include "clang/AST/Decl.h" +#include "clang/Basic/CharInfo.h" #include "llvm/Support/raw_ostream.h" -#include <cctype> #include <fstream> #include <string> @@ -17,10 +17,11 @@ using namespace clang; /// \brief Parse a simple identifier. static std::string parseName(StringRef S) { - unsigned Offset = 0; - while (Offset < S.size() && - (isalpha(S[Offset]) || S[Offset] == '_' || - (Offset > 0 && isdigit(S[Offset])))) + if (S.empty() || !isIdentifierHead(S[0])) + return ""; + + unsigned Offset = 1; + while (Offset < S.size() && isIdentifierBody(S[Offset])) ++Offset; return S.substr(0, Offset).str(); @@ -128,10 +129,10 @@ LayoutOverrideSource::LayoutOverrideSource(StringRef Filename) { continue; LineStr = LineStr.substr(Pos + strlen("FieldOffsets: [")); - while (!LineStr.empty() && isdigit(LineStr[0])) { + while (!LineStr.empty() && isDigit(LineStr[0])) { // Parse this offset. unsigned Idx = 1; - while (Idx < LineStr.size() && isdigit(LineStr[Idx])) + while (Idx < LineStr.size() && isDigit(LineStr[Idx])) ++Idx; unsigned long long Offset = 0; @@ -141,7 +142,7 @@ LayoutOverrideSource::LayoutOverrideSource(StringRef Filename) { // Skip over this offset, the following comma, and any spaces. LineStr = LineStr.substr(Idx + 1); - while (!LineStr.empty() && isspace(LineStr[0])) + while (!LineStr.empty() && isWhitespace(LineStr[0])) LineStr = LineStr.substr(1); } } |