qiongsiwu wrote:

The `PrerequisiteModulesTests.ModuleWithDepTest`s this PR added seem to produce 
errors when scanning model dependencies, and warns that `-c` is not used during 
compilation, when the tests are run on macOS. 

```
$ ./tools/clang/tools/extra/clangd/unittests/ClangdTests 
--gtest_filter="PrerequisiteModulesTests.*"
...
[ RUN      ] PrerequisiteModulesTests.ModuleWithDepTest
Scanning modules dependencies for foo.h failed: error: invalid argument 
'-std=c++20' not allowed with 'C'

Scanning modules dependencies for foo.h failed: error: invalid argument 
'-std=c++20' not allowed with 'C'

Ignored diagnostic. argument unused during compilation: '-c'
``` 

The following tests seem to have the invalid argument error and the argument 
unused warning:
```
PrerequisiteModulesTests.ModuleWithDepTest
PrerequisiteModulesTests.ReusabilityTest
```

And a few other tests suffer only the warning.

The following diff seem to fix the problem:
```
diff --git a/clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp 
b/clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp
index 1bb8e19cce23..3263ff8cfa0e 100644
--- a/clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp
+++ b/clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp
@@ -32,8 +32,9 @@ public:
       : MockCompilationDatabase(TestDir),
         MockedCDBPtr(std::make_shared<MockClangCompilationDatabase>(*this)),
         TFS(TFS) {
+    this->ExtraClangFlags.push_back("-xc++");
     this->ExtraClangFlags.push_back("-std=c++20");
-    this->ExtraClangFlags.push_back("-c");
+    //this->ExtraClangFlags.push_back("-c");
   }
```

The errors and warnings do not seem to impact the behavior of the test. 

Are the errors expected? 

https://github.com/llvm/llvm-project/pull/66462
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to