[clang] [clang-format][NFC] Delete duplicates in CSharpExtraKeywords (PR #139199)
via cfe-commits
cfe-commits at lists.llvm.org
Thu May 8 20:02:22 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-format
Author: Owen Pan (owenca)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/139199.diff
1 Files Affected:
- (modified) clang/lib/Format/FormatToken.h (+13-19)
``````````diff
diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h
index b570171d032ac..83b3f6db03e6d 100644
--- a/clang/lib/Format/FormatToken.h
+++ b/clang/lib/Format/FormatToken.h
@@ -1262,7 +1262,7 @@ struct AdditionalKeywords {
kw_verilogHashHash = &IdentTable.get("##");
kw_apostrophe = &IdentTable.get("\'");
- // TableGen keywords
+ // TableGen keywords.
kw_bit = &IdentTable.get("bit");
kw_bits = &IdentTable.get("bits");
kw_code = &IdentTable.get("code");
@@ -1277,8 +1277,7 @@ struct AdditionalKeywords {
kw_multiclass = &IdentTable.get("multiclass");
kw_then = &IdentTable.get("then");
- // Keep this at the end of the constructor to make sure everything here
- // is
+ // Keep this at the end of the constructor to make sure everything here is
// already initialized.
JsExtraKeywords = std::unordered_set<IdentifierInfo *>(
{kw_as, kw_async, kw_await, kw_declare, kw_finally, kw_from,
@@ -1287,19 +1286,14 @@ struct AdditionalKeywords {
// Keywords from the Java section.
kw_abstract, kw_extends, kw_implements, kw_instanceof, kw_interface});
- CSharpExtraKeywords = std::unordered_set<IdentifierInfo *>(
- {kw_base, kw_byte, kw_checked, kw_decimal, kw_delegate, kw_event,
- kw_fixed, kw_foreach, kw_implicit, kw_in, kw_init, kw_interface,
- kw_internal, kw_is, kw_lock, kw_null, kw_object, kw_out, kw_override,
- kw_params, kw_readonly, kw_ref, kw_string, kw_stackalloc, kw_sbyte,
- kw_sealed, kw_uint, kw_ulong, kw_unchecked, kw_unsafe, kw_ushort,
- kw_when, kw_where,
- // Keywords from the JavaScript section.
- kw_as, kw_async, kw_await, kw_declare, kw_finally, kw_from,
- kw_function, kw_get, kw_import, kw_is, kw_let, kw_module, kw_readonly,
- kw_set, kw_type, kw_typeof, kw_var, kw_yield,
- // Keywords from the Java section.
- kw_abstract, kw_extends, kw_implements, kw_instanceof, kw_interface});
+ CSharpExtraKeywords = JsExtraKeywords;
+ CSharpExtraKeywords.insert(
+ {kw_base, kw_byte, kw_checked, kw_decimal, kw_delegate,
+ kw_event, kw_fixed, kw_foreach, kw_implicit, kw_in,
+ kw_init, kw_internal, kw_lock, kw_null, kw_object,
+ kw_out, kw_params, kw_ref, kw_string, kw_stackalloc,
+ kw_sbyte, kw_sealed, kw_uint, kw_ulong, kw_unchecked,
+ kw_unsafe, kw_ushort, kw_when, kw_where});
// Some keywords are not included here because they don't need special
// treatment like `showcancelled` or they should be treated as identifiers
@@ -1706,8 +1700,8 @@ struct AdditionalKeywords {
}
}
- /// Returns \c true if \p Tok is a C# keyword, returns
- /// \c false if it is a anything else.
+ /// Returns \c true if \p Tok is a C# keyword, returns \c false if it is
+ /// anything else.
bool isCSharpKeyword(const FormatToken &Tok) const {
if (Tok.isAccessSpecifierKeyword())
return true;
@@ -1933,7 +1927,7 @@ struct AdditionalKeywords {
/// The JavaScript keywords beyond the C++ keyword set.
std::unordered_set<IdentifierInfo *> JsExtraKeywords;
- /// The C# keywords beyond the C++ keyword set
+ /// The C# keywords beyond the C++ keyword set.
std::unordered_set<IdentifierInfo *> CSharpExtraKeywords;
/// The Verilog keywords beyond the C++ keyword set.
``````````
</details>
https://github.com/llvm/llvm-project/pull/139199
More information about the cfe-commits
mailing list