forked from OSchip/llvm-project
Fix some Clang-tidy readability-simplify-boolean-expr and Include What You Use warnings.
Differential revision: http://reviews.llvm.org/D19947 llvm-svn: 268674
This commit is contained in:
parent
60061c21cb
commit
17d2e87e9f
|
@ -14,12 +14,10 @@
|
|||
#ifndef LLVM_CLANG_LEX_TOKEN_H
|
||||
#define LLVM_CLANG_LEX_TOKEN_H
|
||||
|
||||
#include "clang/Basic/OperatorKinds.h"
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/Basic/TemplateKinds.h"
|
||||
#include "clang/Basic/TokenKinds.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
namespace clang {
|
||||
|
||||
|
@ -69,8 +67,8 @@ class Token {
|
|||
|
||||
/// Flags - Bits we track about this token, members of the TokenFlags enum.
|
||||
unsigned short Flags;
|
||||
public:
|
||||
|
||||
public:
|
||||
// Various flags set per token:
|
||||
enum TokenFlags {
|
||||
StartOfLine = 0x01, // At start of line or only after whitespace
|
||||
|
@ -236,6 +234,11 @@ public:
|
|||
Flags |= Flag;
|
||||
}
|
||||
|
||||
/// \brief Get the specified flag.
|
||||
bool getFlag(TokenFlags Flag) const {
|
||||
return (Flags & Flag) != 0;
|
||||
}
|
||||
|
||||
/// \brief Unset the specified flag.
|
||||
void clearFlag(TokenFlags Flag) {
|
||||
Flags &= ~Flag;
|
||||
|
@ -259,17 +262,15 @@ public:
|
|||
|
||||
/// isAtStartOfLine - Return true if this token is at the start of a line.
|
||||
///
|
||||
bool isAtStartOfLine() const { return (Flags & StartOfLine) ? true : false; }
|
||||
bool isAtStartOfLine() const { return getFlag(StartOfLine); }
|
||||
|
||||
/// \brief Return true if this token has whitespace before it.
|
||||
///
|
||||
bool hasLeadingSpace() const { return (Flags & LeadingSpace) ? true : false; }
|
||||
bool hasLeadingSpace() const { return getFlag(LeadingSpace); }
|
||||
|
||||
/// \brief 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) ? true : false;
|
||||
}
|
||||
bool isExpandDisabled() const { return getFlag(DisableExpand); }
|
||||
|
||||
/// \brief Return true if we have an ObjC keyword identifier.
|
||||
bool isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const;
|
||||
|
@ -278,31 +279,25 @@ public:
|
|||
tok::ObjCKeywordKind getObjCKeywordID() const;
|
||||
|
||||
/// \brief Return true if this token has trigraphs or escaped newlines in it.
|
||||
bool needsCleaning() const { return (Flags & NeedsCleaning) ? true : false; }
|
||||
bool needsCleaning() const { return getFlag(NeedsCleaning); }
|
||||
|
||||
/// \brief Return true if this token has an empty macro before it.
|
||||
///
|
||||
bool hasLeadingEmptyMacro() const {
|
||||
return (Flags & LeadingEmptyMacro) ? true : false;
|
||||
}
|
||||
bool hasLeadingEmptyMacro() const { return getFlag(LeadingEmptyMacro); }
|
||||
|
||||
/// \brief Return true if this token is a string or character literal which
|
||||
/// has a ud-suffix.
|
||||
bool hasUDSuffix() const { return (Flags & HasUDSuffix) ? true : false; }
|
||||
bool hasUDSuffix() const { return getFlag(HasUDSuffix); }
|
||||
|
||||
/// Returns true if this token contains a universal character name.
|
||||
bool hasUCN() const { return (Flags & HasUCN) ? true : false; }
|
||||
bool hasUCN() const { return getFlag(HasUCN); }
|
||||
|
||||
/// Returns true if this token is formed by macro by stringizing or charizing
|
||||
/// operator.
|
||||
bool stringifiedInMacro() const {
|
||||
return (Flags & StringifiedInMacro) ? true : false;
|
||||
}
|
||||
bool stringifiedInMacro() const { return getFlag(StringifiedInMacro); }
|
||||
|
||||
/// Returns true if the comma after this token was elided.
|
||||
bool commaAfterElided() const {
|
||||
return (Flags & CommaAfterElided) ? true : false;
|
||||
}
|
||||
bool commaAfterElided() const { return getFlag(CommaAfterElided); }
|
||||
};
|
||||
|
||||
/// \brief Information about the conditional stack (\#if directives)
|
||||
|
@ -324,11 +319,11 @@ struct PPConditionalInfo {
|
|||
bool FoundElse;
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
} // end namespace clang
|
||||
|
||||
namespace llvm {
|
||||
template <>
|
||||
struct isPodLike<clang::Token> { static const bool value = true; };
|
||||
} // end namespace llvm
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_CLANG_LEX_TOKEN_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- ParsedTemplate.h - Template Parsing Data Types -------------------===//
|
||||
//===--- ParsedTemplate.h - Template Parsing Data Types ---------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -11,12 +11,19 @@
|
|||
// templates.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_SEMA_PARSEDTEMPLATE_H
|
||||
#define LLVM_CLANG_SEMA_PARSEDTEMPLATE_H
|
||||
|
||||
#include "clang/Basic/OperatorKinds.h"
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/Basic/TemplateKinds.h"
|
||||
#include "clang/Sema/DeclSpec.h"
|
||||
#include "clang/Sema/Ownership.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
|
||||
namespace clang {
|
||||
/// \brief Represents the parsed form of a C++ template argument.
|
||||
|
@ -209,6 +216,6 @@ namespace clang {
|
|||
/// Retrieves the range of the given template parameter lists.
|
||||
SourceRange getTemplateParamsRange(TemplateParameterList const *const *Params,
|
||||
unsigned NumParams);
|
||||
}
|
||||
} // end namespace clang
|
||||
|
||||
#endif
|
||||
#endif // LLVM_CLANG_SEMA_PARSEDTEMPLATE_H
|
||||
|
|
Loading…
Reference in New Issue