From: Chris Lattner Date: Mon, 3 Sep 2007 18:28:41 +0000 (+0000) Subject: Eliminate some VC++ warnings, patch by Hartmut Kaiser! X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b8128140956c6f8f0ab143818775a81f4b4aa477;p=clang Eliminate some VC++ warnings, patch by Hartmut Kaiser! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41685 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Lex/Lexer.cpp b/Lex/Lexer.cpp index c45a36a9a5..f8640b3556 100644 --- a/Lex/Lexer.cpp +++ b/Lex/Lexer.cpp @@ -141,26 +141,26 @@ static void InitCharacterInfo() { /// isIdentifierBody - Return true if this is the body character of an /// identifier, which is [a-zA-Z0-9_]. static inline bool isIdentifierBody(unsigned char c) { - return CharInfo[c] & (CHAR_LETTER|CHAR_NUMBER|CHAR_UNDER); + return (CharInfo[c] & (CHAR_LETTER|CHAR_NUMBER|CHAR_UNDER)) ? true : false; } /// isHorizontalWhitespace - Return true if this character is horizontal /// whitespace: ' ', '\t', '\f', '\v'. Note that this returns false for '\0'. static inline bool isHorizontalWhitespace(unsigned char c) { - return CharInfo[c] & CHAR_HORZ_WS; + return (CharInfo[c] & CHAR_HORZ_WS) ? true : false; } /// isWhitespace - Return true if this character is horizontal or vertical /// whitespace: ' ', '\t', '\f', '\v', '\n', '\r'. Note that this returns false /// for '\0'. static inline bool isWhitespace(unsigned char c) { - return CharInfo[c] & (CHAR_HORZ_WS|CHAR_VERT_WS); + return (CharInfo[c] & (CHAR_HORZ_WS|CHAR_VERT_WS)) ? true : false; } /// isNumberBody - Return true if this is the body character of an /// preprocessing number, which is [a-zA-Z0-9_.]. static inline bool isNumberBody(unsigned char c) { - return CharInfo[c] & (CHAR_LETTER|CHAR_NUMBER|CHAR_UNDER|CHAR_PERIOD); + return (CharInfo[c] & (CHAR_LETTER|CHAR_NUMBER|CHAR_UNDER|CHAR_PERIOD)) ? true : false; } diff --git a/Lex/LiteralSupport.cpp b/Lex/LiteralSupport.cpp index 04282563ea..c2bdd8e5f5 100644 --- a/Lex/LiteralSupport.cpp +++ b/Lex/LiteralSupport.cpp @@ -88,7 +88,7 @@ static unsigned ProcessCharEscape(const char *&ThisTokBuf, for (; ThisTokBuf != ThisTokEnd; ++ThisTokBuf) { int CharVal = HexDigitValue(ThisTokBuf[0]); if (CharVal == -1) break; - Overflow |= ResultChar & 0xF0000000; // About to shift out a digit? + Overflow |= (ResultChar & 0xF0000000) ? true : false; // About to shift out a digit? ResultChar <<= 4; ResultChar |= CharVal; } diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index b58652cd0d..c61cc69d6f 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -106,13 +106,13 @@ public: } bool isConstQualified() const { - return ThePtr & Const; + return (ThePtr & Const) ? true : false; } bool isVolatileQualified() const { - return ThePtr & Volatile; + return (ThePtr & Volatile) ? true : false; } bool isRestrictQualified() const { - return ThePtr & Restrict; + return (ThePtr & Restrict) ? true : false; } /// addConst/addVolatile/addRestrict - add the specified type qual to this diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 689fbfc371..4eb6c3df3e 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -15,6 +15,7 @@ #define LLVM_CLANG_BASIC_TARGETINFO_H #include "clang/Basic/SourceLocation.h" +#include "llvm/Support/DataTypes.h" #include #include diff --git a/include/clang/Lex/IdentifierTable.h b/include/clang/Lex/IdentifierTable.h index 0320164f9a..f18924c9d0 100644 --- a/include/clang/Lex/IdentifierTable.h +++ b/include/clang/Lex/IdentifierTable.h @@ -21,7 +21,7 @@ namespace clang { class MacroInfo; - class LangOptions; + struct LangOptions; /// IdentifierInfo - One of these records is kept for each identifier that /// is lexed. This contains information about whether the token was #define'd, diff --git a/include/clang/Lex/Token.h b/include/clang/Lex/Token.h index f336370334..a0754005e8 100644 --- a/include/clang/Lex/Token.h +++ b/include/clang/Lex/Token.h @@ -96,15 +96,15 @@ public: /// isAtStartOfLine - Return true if this token is at the start of a line. /// - bool isAtStartOfLine() const { return Flags & StartOfLine; } + bool isAtStartOfLine() const { return (Flags & StartOfLine) ? true : false; } /// hasLeadingSpace - Return true if this token has whitespace before it. /// - bool hasLeadingSpace() const { return Flags & LeadingSpace; } + bool hasLeadingSpace() const { return (Flags & LeadingSpace) ? true : false; } /// isExpandDisabled - Return true if this identifier token should never /// be expanded in the future, due to C99 6.10.3.4p2. - bool isExpandDisabled() const { return Flags & DisableExpand; } + bool isExpandDisabled() const { return (Flags & DisableExpand) ? true : false; } /// isObjCAtKeyword - Return true if we have an ObjC keyword identifier. bool isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const; @@ -115,7 +115,7 @@ public: /// needsCleaning - Return true if this token has trigraphs or escaped /// newlines in it. /// - bool needsCleaning() const { return Flags & NeedsCleaning; } + bool needsCleaning() const { return (Flags & NeedsCleaning) ? true : false; } }; /// PPConditionalInfo - Information about the conditional stack (#if directives) diff --git a/include/clang/Parse/DeclSpec.h b/include/clang/Parse/DeclSpec.h index c0956dc00f..6a15290072 100644 --- a/include/clang/Parse/DeclSpec.h +++ b/include/clang/Parse/DeclSpec.h @@ -20,11 +20,11 @@ #include "llvm/ADT/SmallVector.h" namespace clang { - class LangOptions; + struct LangOptions; class IdentifierInfo; /// DeclSpec - This class captures information about "declaration specifiers", -/// which encompases storage-class-specifiers, type-specifiers, type-qualifiers, +/// which encompasses storage-class-specifiers, type-specifiers, type-qualifiers, /// and function-specifiers. class DeclSpec { public: