aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/FormatToken.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2024-03-19 18:02:09 -0700
committerOwen Pan <owenpiano@gmail.com>2024-03-19 18:06:59 -0700
commit6f31cf51dfdc2c317ba8149d57d2ffb583403833 (patch)
treec8e573cc76f641371b41c4301577a9bbaba6770d /clang/lib/Format/FormatToken.cpp
parenta289f66efd638c2af14cdb88968e4eaeea0c0605 (diff)
downloadllvm-6f31cf51dfdc2c317ba8149d57d2ffb583403833.zip
llvm-6f31cf51dfdc2c317ba8149d57d2ffb583403833.tar.gz
llvm-6f31cf51dfdc2c317ba8149d57d2ffb583403833.tar.bz2
Revert "[clang-format][NFC] Eliminate the IsCpp parameter in all functions (#84599)"
This reverts c3a1eb6207d8 (and the related commit f3c5278efa3b) which makes cleanupAroundReplacements() no longer thread-safe.
Diffstat (limited to 'clang/lib/Format/FormatToken.cpp')
-rw-r--r--clang/lib/Format/FormatToken.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/Format/FormatToken.cpp b/clang/lib/Format/FormatToken.cpp
index cd94a9d..99405fb 100644
--- a/clang/lib/Format/FormatToken.cpp
+++ b/clang/lib/Format/FormatToken.cpp
@@ -18,8 +18,6 @@
namespace clang {
namespace format {
-bool IsCpp = false;
-
const char *getTokenTypeName(TokenType Type) {
static const char *const TokNames[] = {
#define TYPE(X) #X,
@@ -77,15 +75,15 @@ static SmallVector<StringRef> CppNonKeywordTypes = {
"uint32_t", "uint64_t", "uint8_t", "uintptr_t",
};
-bool FormatToken::isTypeName() const {
+bool FormatToken::isTypeName(bool IsCpp) const {
return is(TT_TypeName) || isSimpleTypeSpecifier() ||
(IsCpp && is(tok::identifier) &&
std::binary_search(CppNonKeywordTypes.begin(),
CppNonKeywordTypes.end(), TokenText));
}
-bool FormatToken::isTypeOrIdentifier() const {
- return isTypeName() || isOneOf(tok::kw_auto, tok::identifier);
+bool FormatToken::isTypeOrIdentifier(bool IsCpp) const {
+ return isTypeName(IsCpp) || isOneOf(tok::kw_auto, tok::identifier);
}
bool FormatToken::isBlockIndentedInitRBrace(const FormatStyle &Style) const {