github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp --
clang/unittests/Serialization/NamespaceLookupTest.cpp
clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp
--diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/unittests/Serialization/NamespaceLookupTest.cpp
b/clang/unittests/Serialization/NamespaceLookupTest.cpp
index f3e56645a..eefa4be9f 100644
--- a/clang/unittests/Serialization/NamespaceLookupTest.cpp
+++ b/clang/unittests/Serialization/NamespaceLookupTest.cpp
@@ -47,7 +47,8 @@ public:
OS << Contents;
}
- std::string GenerateModuleInterface(StringRef ModuleName, StringRef
Contents) {
+ std::string GenerateModuleInterface(StringRef ModuleName,
+ StringRef Contents) {
std::string FileName = llvm::Twine(ModuleName + ".cppm").str();
addFile(FileName, Contents);
@@ -99,17 +100,18 @@ struct NamespaceLookupResult {
class NamespaceLookupConsumer : public ASTConsumer {
NamespaceLookupResult &Result;
-public:
+public:
explicit NamespaceLookupConsumer(NamespaceLookupResult &Result)
- : Result(Result) {}
+ : Result(Result) {}
void HandleTranslationUnit(ASTContext &Context) override {
TranslationUnitDecl *TU = Context.getTranslationUnitDecl();
ASSERT_TRUE(TU);
ASTReader *Chain =
dyn_cast_or_null<ASTReader>(Context.getExternalSource());
ASSERT_TRUE(Chain);
- for (const Decl *D :
TU->lookup(DeclarationName(&Context.Idents.get("N")))) {
+ for (const Decl *D :
+ TU->lookup(DeclarationName(&Context.Idents.get("N")))) {
if (!isa<NamespaceDecl>(D))
continue;
if (!D->isFromASTFile()) {
@@ -124,9 +126,10 @@ public:
class NamespaceLookupAction : public ASTFrontendAction {
NamespaceLookupResult &Result;
+
public:
explicit NamespaceLookupAction(NamespaceLookupResult &Result)
- : Result(Result) {}
+ : Result(Result) {}
std::unique_ptr<ASTConsumer>
CreateASTConsumer(CompilerInstance &CI, StringRef /*Unused*/) override {
@@ -154,16 +157,15 @@ import M3;
)cpp";
std::string DepArg = "-fprebuilt-module-path=" + TestDir.str().str();
NamespaceLookupResult Result;
- EXPECT_TRUE(
- runToolOnCodeWithArgs(std::make_unique<NamespaceLookupAction>(Result),
- test_file_contents,
- {
- "-std=c++20",
- DepArg.c_str(),
- "-I",
- TestDir.c_str(),
- },
- "main.cpp"));
+ EXPECT_TRUE(runToolOnCodeWithArgs(
+ std::make_unique<NamespaceLookupAction>(Result), test_file_contents,
+ {
+ "-std=c++20",
+ DepArg.c_str(),
+ "-I",
+ TestDir.c_str(),
+ },
+ "main.cpp"));
EXPECT_EQ(0, Result.NumLocalNamespaces);
EXPECT_EQ(1, Result.NumExternalNamespaces);
@@ -191,16 +193,15 @@ namespace N {}
)cpp";
std::string DepArg = "-fprebuilt-module-path=" + TestDir.str().str();
NamespaceLookupResult Result;
- EXPECT_TRUE(
- runToolOnCodeWithArgs(std::make_unique<NamespaceLookupAction>(Result),
- test_file_contents,
- {
- "-std=c++20",
- DepArg.c_str(),
- "-I",
- TestDir.c_str(),
- },
- "main.cpp"));
+ EXPECT_TRUE(runToolOnCodeWithArgs(
+ std::make_unique<NamespaceLookupAction>(Result), test_file_contents,
+ {
+ "-std=c++20",
+ DepArg.c_str(),
+ "-I",
+ TestDir.c_str(),
+ },
+ "main.cpp"));
EXPECT_EQ(1, Result.NumLocalNamespaces);
EXPECT_EQ(0, Result.NumExternalNamespaces);
@@ -229,16 +230,15 @@ import M3;
)cpp";
std::string DepArg = "-fprebuilt-module-path=" + TestDir.str().str();
NamespaceLookupResult Result;
- EXPECT_TRUE(
- runToolOnCodeWithArgs(std::make_unique<NamespaceLookupAction>(Result),
- test_file_contents,
- {
- "-std=c++20",
- DepArg.c_str(),
- "-I",
- TestDir.c_str(),
- },
- "main.cpp"));
+ EXPECT_TRUE(runToolOnCodeWithArgs(
+ std::make_unique<NamespaceLookupAction>(Result), test_file_contents,
+ {
+ "-std=c++20",
+ DepArg.c_str(),
+ "-I",
+ TestDir.c_str(),
+ },
+ "main.cpp"));
EXPECT_EQ(1, Result.NumLocalNamespaces);
EXPECT_EQ(1, Result.NumExternalNamespaces);
``````````
</details>
https://github.com/llvm/llvm-project/pull/171769
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits