[clang] 1cb3cfd - [clang-format] [NFC] build clang-format with -Wall
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 23 02:44:35 PST 2021
Author: mydeveloperday
Date: 2021-11-23T10:43:27Z
New Revision: 1cb3cfd932a0f26e5bfc5d944f63239242fa8ec3
URL: https://github.com/llvm/llvm-project/commit/1cb3cfd932a0f26e5bfc5d944f63239242fa8ec3
DIFF: https://github.com/llvm/llvm-project/commit/1cb3cfd932a0f26e5bfc5d944f63239242fa8ec3.diff
LOG: [clang-format] [NFC] build clang-format with -Wall
When building clang-format with -Wall on Visual Studio 20119 we see the following, prevent this the only -Wall error
```
..FormatTokenLexer.cpp(45) : warning C4868: compiler may not enforce left-to-right evaluation order in braced initializer list
```
Reviewed By: HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D113844
Added:
Modified:
clang/lib/Format/FormatTokenLexer.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp
index 8075756cca03..972f59ead5d8 100644
--- a/clang/lib/Format/FormatTokenLexer.cpp
+++ b/clang/lib/Format/FormatTokenLexer.cpp
@@ -37,27 +37,40 @@ FormatTokenLexer::FormatTokenLexer(
getFormattingLangOpts(Style)));
Lex->SetKeepWhitespaceMode(true);
- for (const std::string &ForEachMacro : Style.ForEachMacros)
- Macros.insert({&IdentTable.get(ForEachMacro), TT_ForEachMacro});
- for (const std::string &IfMacro : Style.IfMacros)
- Macros.insert({&IdentTable.get(IfMacro), TT_IfMacro});
- for (const std::string &AttributeMacro : Style.AttributeMacros)
- Macros.insert({&IdentTable.get(AttributeMacro), TT_AttributeMacro});
- for (const std::string &StatementMacro : Style.StatementMacros)
- Macros.insert({&IdentTable.get(StatementMacro), TT_StatementMacro});
- for (const std::string &TypenameMacro : Style.TypenameMacros)
- Macros.insert({&IdentTable.get(TypenameMacro), TT_TypenameMacro});
- for (const std::string &NamespaceMacro : Style.NamespaceMacros)
- Macros.insert({&IdentTable.get(NamespaceMacro), TT_NamespaceMacro});
+ for (const std::string &ForEachMacro : Style.ForEachMacros) {
+ auto Identifier = &IdentTable.get(ForEachMacro);
+ Macros.insert({Identifier, TT_ForEachMacro});
+ }
+ for (const std::string &IfMacro : Style.IfMacros) {
+ auto Identifier = &IdentTable.get(IfMacro);
+ Macros.insert({Identifier, TT_IfMacro});
+ }
+ for (const std::string &AttributeMacro : Style.AttributeMacros) {
+ auto Identifier = &IdentTable.get(AttributeMacro);
+ Macros.insert({Identifier, TT_AttributeMacro});
+ }
+ for (const std::string &StatementMacro : Style.StatementMacros) {
+ auto Identifier = &IdentTable.get(StatementMacro);
+ Macros.insert({Identifier, TT_StatementMacro});
+ }
+ for (const std::string &TypenameMacro : Style.TypenameMacros) {
+ auto Identifier = &IdentTable.get(TypenameMacro);
+ Macros.insert({Identifier, TT_TypenameMacro});
+ }
+ for (const std::string &NamespaceMacro : Style.NamespaceMacros) {
+ auto Identifier = &IdentTable.get(NamespaceMacro);
+ Macros.insert({Identifier, TT_NamespaceMacro});
+ }
for (const std::string &WhitespaceSensitiveMacro :
Style.WhitespaceSensitiveMacros) {
- Macros.insert(
- {&IdentTable.get(WhitespaceSensitiveMacro), TT_UntouchableMacroFunc});
+ auto Identifier = &IdentTable.get(WhitespaceSensitiveMacro);
+ Macros.insert({Identifier, TT_UntouchableMacroFunc});
}
for (const std::string &StatementAttributeLikeMacro :
- Style.StatementAttributeLikeMacros)
- Macros.insert({&IdentTable.get(StatementAttributeLikeMacro),
- TT_StatementAttributeLikeMacro});
+ Style.StatementAttributeLikeMacros) {
+ auto Identifier = &IdentTable.get(StatementAttributeLikeMacro);
+ Macros.insert({Identifier, TT_StatementAttributeLikeMacro});
+ }
}
ArrayRef<FormatToken *> FormatTokenLexer::lex() {
More information about the cfe-commits
mailing list