r316792 - CharInfo.h: Modularize/fix ODR violations by making inline functions in header not static

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 13:40:45 PDT 2017


Author: dblaikie
Date: Fri Oct 27 13:40:45 2017
New Revision: 316792

URL: http://llvm.org/viewvc/llvm-project?rev=316792&view=rev
Log:
CharInfo.h: Modularize/fix ODR violations by making inline functions in header not static

Modified:
    cfe/trunk/include/clang/Basic/CharInfo.h

Modified: cfe/trunk/include/clang/Basic/CharInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/CharInfo.h?rev=316792&r1=316791&r2=316792&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/CharInfo.h (original)
+++ cfe/trunk/include/clang/Basic/CharInfo.h Fri Oct 27 13:40:45 2017
@@ -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<unsigned char>(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 isIdent
 
 /// 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 isIdent
 /// ' ', '\\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 isHoriz
 /// 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 isVerti
 /// ' ', '\\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 isHexDi
 /// 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 isPunct
 /// 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 isPrint
 
 /// 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 isRawSt
 /// 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 toLower
 /// 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 toUpper
 ///
 /// 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;
 




More information about the cfe-commits mailing list