Implement soft reset of the diagnostics engine. This patch implements soft reset and adds tests for soft reset success of the diagnostics engine. This patch adds unittest for soft reset success using #define public private. Multiple options were used before arriving on using #define public private as discussed in https://github.com/vgvassilev/clang/pull/1. 1. Enable getter for private variables distinguishing soft reset. 2. Using any existing locs 3. gtest:friend_test https://google.github.io/googletest/reference/testing.html#FRIEND_TEST 4. using #define public private accomapnied with #undef private before and after the inclusion of `.h` file to access a few private members of enclosing class in the test function. Finally, a test helper friend function is added to test soft reset success. This patch also adds a clang-repl test and adapts clang:tools:clang-repl to report unsuccess when running with -verify. Screenshots of testing this patch can be found on the mentioned pull request. Co-authored-by: Vassil Vassilev <vvasilev@cern.ch>
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
I don't think we can live with the #define private public approach, not least because this violates the ODR and might lead to compile failures using modules as a result. As an alternative, how about:
- Adding a friend void DiagnosticTestHelper(); declaration to DiagnosticsEngine
- Defining that function in DiagnosticTest.cpp and calling it to do your checks of the diagnostics engine's state.
Comment Actions
Fixes: https://buildkite.com/llvm-project/premerge-checks/builds/95001#01810b0b-6313-400f-aaf0-35855916ec93
I pasted the wrong diff. sorry!
(have multiple build repository in local)
This comment was removed by tapaswenipathak.
clang/lib/Interpreter/IncrementalParser.cpp | ||
---|---|---|
200 ↗ | (On Diff #433362) | We should remove this fixme, too. |
Comment Actions
FYI, this change caused warnings when built with GCC:
[1/1] Building CXX object tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/DiagnosticTest.cpp.o ../tools/clang/unittests/Basic/DiagnosticTest.cpp:17:6: warning: ‘void clang::DiagnosticsTestHelper(clang::DiagnosticsEngine&)’ has not been declared within ‘clang’ 17 | void clang::DiagnosticsTestHelper(DiagnosticsEngine &diag) { | ^~~~~ In file included from ../tools/clang/unittests/Basic/DiagnosticTest.cpp:9: ../tools/clang/include/clang/Basic/Diagnostic.h:548:15: note: only here as a ‘friend’ 548 | friend void DiagnosticsTestHelper(DiagnosticsEngine &); | ^~~~~~~~~~~~~~~~~~~~~