-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Address issue of suppressing diagnostic #162
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
clangSilent(clang::DiagnosticsEngine& diag) : fDiagEngine(diag) { | ||
auto& I = getInterp(); | ||
DiagnosticsEngine& parentDiagnostics = I.getSema().getDiagnostics(); | ||
clang::IgnoringDiagConsumer* ignoringDiagConsumer = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: initializing non-owner 'clang::IgnoringDiagConsumer *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
clang::IgnoringDiagConsumer* ignoringDiagConsumer =
^
clangSilent(clang::DiagnosticsEngine& diag) : fDiagEngine(diag) { | ||
auto& I = getInterp(); | ||
DiagnosticsEngine& parentDiagnostics = I.getSema().getDiagnostics(); | ||
clang::IgnoringDiagConsumer* ignoringDiagConsumer = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
clang::IgnoringDiagConsumer* ignoringDiagConsumer = | |
auto* ignoringDiagConsumer = |
~clangSilent() { | ||
auto& I = getInterp(); | ||
DiagnosticsEngine& parentDiagnostics = I.getSema().getDiagnostics(); | ||
clang::IgnoringDiagConsumer* ignoringDiagConsumer = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: initializing non-owner 'clang::IgnoringDiagConsumer *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
clang::IgnoringDiagConsumer* ignoringDiagConsumer =
^
~clangSilent() { | ||
auto& I = getInterp(); | ||
DiagnosticsEngine& parentDiagnostics = I.getSema().getDiagnostics(); | ||
clang::IgnoringDiagConsumer* ignoringDiagConsumer = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
clang::IgnoringDiagConsumer* ignoringDiagConsumer = | |
auto* ignoringDiagConsumer = |
Codecov Report
@@ Coverage Diff @@
## main #162 +/- ##
==========================================
+ Coverage 72.75% 73.10% +0.35%
==========================================
Files 8 8
Lines 2885 2893 +8
==========================================
+ Hits 2099 2115 +16
+ Misses 786 778 -8
... and 1 file with indirect coverage changes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the clang-tidy reports.
|
||
TEST(InterpreterTest, Declare) { | ||
EXPECT_EQ(Cpp::Declare("int i;", true), 0); | ||
EXPECT_EQ(Cpp::Declare("int i;", true), 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should check the output streams if a diagnostic was provided or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no diagnostic provided when we try to use the above case, However there is a slight observation for the below scenario:
[cling]$ InterOp::Declare("integer i;", true)
(unsigned long) 1
For the current upstream,
When we take this test case with the backend as cling, we get 1 as the output.
But on a similar basis when we use clang-repl as our backend for this test case, the expected output comes as 0 which is contrary to the former case.
When I use this patch where IgnoreDiagConsumer() is being used to swap the current diagnostics of CI with ignoring diagnostics from the diagnostic engine. But this deviates from the current output.
@Smit1603 can you please implement the latest changes we discussed.
EXPECT_EQ(Cpp::Declare("int i;", true), 0); | ||
EXPECT_EQ(Cpp::Declare("int i;", true), 1); | ||
EXPECT_EQ(Cpp::Declare("integer i;", true), 1); | ||
EXPECT_EQ(Cpp::Declare("int i1;", true), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXPECT_EQ(Cpp::Declare("int i;", true), 0); | |
EXPECT_EQ(Cpp::Declare("int i;", true), 1); | |
EXPECT_EQ(Cpp::Declare("integer i;", true), 1); | |
EXPECT_EQ(Cpp::Declare("int i1;", true), 0); | |
EXPECT_EQ(Cpp::Declare("int i;", /*silent=*/true), 0); | |
EXPECT_EQ(Cpp::Declare("int i;", /*silent=*/true), 1); | |
EXPECT_EQ(Cpp::Declare("integer i;", /*silent=*/true), 1); | |
EXPECT_EQ(Cpp::Declare("int i1;", /*silent=*/true), 0); |
Issue : #96
coauthor : @Krishna-13-cyber
cc: @sudo-panda @vgvassilev