From befc935d638b53d222f18ef4db6cb7777e7ab3d9 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 27 Oct 2017 20:40:45 +0000 Subject: CharInfo.h: Modularize/fix ODR violations by making inline functions in header not static git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316792 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/CharInfo.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/clang/Basic/CharInfo.h b/include/clang/Basic/CharInfo.h index dd9c55431e..cc27bbb48e 100644 --- a/include/clang/Basic/CharInfo.h +++ b/include/clang/Basic/CharInfo.h @@ -40,14 +40,14 @@ namespace charinfo { } // end namespace charinfo /// Returns true if this is an ASCII character. -LLVM_READNONE static inline bool isASCII(char c) { +LLVM_READNONE inline bool isASCII(char c) { return static_cast(c) <= 127; } /// Returns true if this is a valid first character of a C identifier, /// which is [a-zA-Z_]. -LLVM_READONLY static inline bool isIdentifierHead(unsigned char c, - bool AllowDollar = false) { +LLVM_READONLY inline bool isIdentifierHead(unsigned char c, + bool AllowDollar = false) { using namespace charinfo; if (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER|CHAR_UNDER)) return true; @@ -56,8 +56,8 @@ LLVM_READONLY static inline bool isIdentifierHead(unsigned char c, /// Returns true if this is a body character of a C identifier, /// which is [a-zA-Z0-9_]. -LLVM_READONLY static inline bool isIdentifierBody(unsigned char c, - bool AllowDollar = false) { +LLVM_READONLY inline bool isIdentifierBody(unsigned char c, + bool AllowDollar = false) { using namespace charinfo; if (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER|CHAR_DIGIT|CHAR_UNDER)) return true; @@ -68,7 +68,7 @@ LLVM_READONLY static inline bool isIdentifierBody(unsigned char c, /// ' ', '\\t', '\\f', '\\v'. /// /// Note that this returns false for '\\0'. -LLVM_READONLY static inline bool isHorizontalWhitespace(unsigned char c) { +LLVM_READONLY inline bool isHorizontalWhitespace(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_HORZ_WS|CHAR_SPACE)) != 0; } @@ -76,7 +76,7 @@ LLVM_READONLY static inline bool isHorizontalWhitespace(unsigned char c) { /// Returns true if this character is vertical ASCII whitespace: '\\n', '\\r'. /// /// Note that this returns false for '\\0'. -LLVM_READONLY static inline bool isVerticalWhitespace(unsigned char c) { +LLVM_READONLY inline bool isVerticalWhitespace(unsigned char c) { using namespace charinfo; return (InfoTable[c] & CHAR_VERT_WS) != 0; } @@ -85,43 +85,43 @@ LLVM_READONLY static inline bool isVerticalWhitespace(unsigned char c) { /// ' ', '\\t', '\\f', '\\v', '\\n', '\\r'. /// /// Note that this returns false for '\\0'. -LLVM_READONLY static inline bool isWhitespace(unsigned char c) { +LLVM_READONLY inline bool isWhitespace(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_HORZ_WS|CHAR_VERT_WS|CHAR_SPACE)) != 0; } /// Return true if this character is an ASCII digit: [0-9] -LLVM_READONLY static inline bool isDigit(unsigned char c) { +LLVM_READONLY inline bool isDigit(unsigned char c) { using namespace charinfo; return (InfoTable[c] & CHAR_DIGIT) != 0; } /// Return true if this character is a lowercase ASCII letter: [a-z] -LLVM_READONLY static inline bool isLowercase(unsigned char c) { +LLVM_READONLY inline bool isLowercase(unsigned char c) { using namespace charinfo; return (InfoTable[c] & CHAR_LOWER) != 0; } /// Return true if this character is an uppercase ASCII letter: [A-Z] -LLVM_READONLY static inline bool isUppercase(unsigned char c) { +LLVM_READONLY inline bool isUppercase(unsigned char c) { using namespace charinfo; return (InfoTable[c] & CHAR_UPPER) != 0; } /// Return true if this character is an ASCII letter: [a-zA-Z] -LLVM_READONLY static inline bool isLetter(unsigned char c) { +LLVM_READONLY inline bool isLetter(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER)) != 0; } /// Return true if this character is an ASCII letter or digit: [a-zA-Z0-9] -LLVM_READONLY static inline bool isAlphanumeric(unsigned char c) { +LLVM_READONLY inline bool isAlphanumeric(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_DIGIT|CHAR_UPPER|CHAR_LOWER)) != 0; } /// Return true if this character is an ASCII hex digit: [0-9a-fA-F] -LLVM_READONLY static inline bool isHexDigit(unsigned char c) { +LLVM_READONLY inline bool isHexDigit(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_DIGIT|CHAR_XLETTER)) != 0; } @@ -129,7 +129,7 @@ LLVM_READONLY static inline bool isHexDigit(unsigned char c) { /// Return true if this character is an ASCII punctuation character. /// /// Note that '_' is both a punctuation character and an identifier character! -LLVM_READONLY static inline bool isPunctuation(unsigned char c) { +LLVM_READONLY inline bool isPunctuation(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_UNDER|CHAR_PERIOD|CHAR_RAWDEL|CHAR_PUNCT)) != 0; } @@ -137,7 +137,7 @@ LLVM_READONLY static inline bool isPunctuation(unsigned char c) { /// Return true if this character is an ASCII printable character; that is, a /// character that should take exactly one column to print in a fixed-width /// terminal. -LLVM_READONLY static inline bool isPrintable(unsigned char c) { +LLVM_READONLY inline bool isPrintable(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER|CHAR_PERIOD|CHAR_PUNCT| CHAR_DIGIT|CHAR_UNDER|CHAR_RAWDEL|CHAR_SPACE)) != 0; @@ -145,14 +145,14 @@ LLVM_READONLY static inline bool isPrintable(unsigned char c) { /// Return true if this is the body character of a C preprocessing number, /// which is [a-zA-Z0-9_.]. -LLVM_READONLY static inline bool isPreprocessingNumberBody(unsigned char c) { +LLVM_READONLY inline bool isPreprocessingNumberBody(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER|CHAR_DIGIT|CHAR_UNDER|CHAR_PERIOD)) != 0; } /// Return true if this is the body character of a C++ raw string delimiter. -LLVM_READONLY static inline bool isRawStringDelimBody(unsigned char c) { +LLVM_READONLY inline bool isRawStringDelimBody(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER|CHAR_PERIOD| CHAR_DIGIT|CHAR_UNDER|CHAR_RAWDEL)) != 0; @@ -162,7 +162,7 @@ LLVM_READONLY static inline bool isRawStringDelimBody(unsigned char c) { /// Converts the given ASCII character to its lowercase equivalent. /// /// If the character is not an uppercase character, it is returned as is. -LLVM_READONLY static inline char toLowercase(char c) { +LLVM_READONLY inline char toLowercase(char c) { if (isUppercase(c)) return c + 'a' - 'A'; return c; @@ -171,7 +171,7 @@ LLVM_READONLY static inline char toLowercase(char c) { /// Converts the given ASCII character to its uppercase equivalent. /// /// If the character is not a lowercase character, it is returned as is. -LLVM_READONLY static inline char toUppercase(char c) { +LLVM_READONLY inline char toUppercase(char c) { if (isLowercase(c)) return c + 'A' - 'a'; return c; @@ -182,7 +182,7 @@ LLVM_READONLY static inline char toUppercase(char c) { /// /// Note that this is a very simple check; it does not accept '$' or UCNs as /// valid identifier characters. -LLVM_READONLY static inline bool isValidIdentifier(StringRef S) { +LLVM_READONLY inline bool isValidIdentifier(StringRef S) { if (S.empty() || !isIdentifierHead(S[0])) return false; -- cgit v1.2.1