-
Notifications
You must be signed in to change notification settings - Fork 68
feat: Support running Clang Tools in-process via getActionType #36
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
base: main
Are you sure you want to change the base?
Changes from all commits
99d76f6
cd93299
aac5d7e
4be2642
fca3809
f38ce35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
// RUN: clang -cc1 -verify -load %shlibdir/libCodeStyleChecker%shlibext -plugin CSC %s 2>&1 | ||
// RUN: clang -cc1 -verify -load %shlibdir/libCodeStyleChecker%shlibext -add-plugin CSC %s 2>&1 | ||
|
||
// RUN: clang -Xclang -load -Xclang %shlibdir/libCodeStyleChecker%shlibext -Xclang -add-plugin -Xclang CSC -c %s -o %t.o | ||
// RUN: test -f %t.o | ||
// RUN: rm %t.o | ||
|
||
// RUN: clang -fplugin=%shlibdir/libCodeStyleChecker%shlibext -c %s -o %t.o | ||
// RUN: test -f %t.o | ||
// RUN: rm %t.o | ||
|
||
Comment on lines
+3
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need these additional test lines? This question applies to all test files that you have updated :) |
||
// 1. Verify that anonymous unions are not flagged as invalid (no name -> | ||
// nothing to check). However, the member variables _are_ verified. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
// RUN: clang -cc1 -verify -load %shlibdir/libCodeStyleChecker%shlibext -plugin CSC %s 2>&1 | ||
// RUN: clang -cc1 -verify -load %shlibdir/libCodeStyleChecker%shlibext -add-plugin CSC %s 2>&1 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we keep |
||
// Verify that conversion operators are not checked | ||
// RUN: clang -Xclang -load -Xclang %shlibdir/libCodeStyleChecker%shlibext -Xclang -add-plugin -Xclang CSC -c %s -o %t.o | ||
// RUN: test -f %t.o | ||
// RUN: rm %t.o | ||
|
||
// expected-no-diagnostics | ||
class SomeClass { | ||
public: | ||
operator bool(); | ||
operator int(); | ||
operator char(); | ||
// RUN: clang -fplugin=%shlibdir/libCodeStyleChecker%shlibext -c %s -o %t.o | ||
Comment on lines
-5
to
-10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets keep these tests :) |
||
// RUN: test -f %t.o | ||
// RUN: rm %t.o | ||
|
||
// Verify that function names starting with upper case are reported as invalid | ||
|
||
// expected-warning@+1 {{Function names should start with lower-case letter}} | ||
void ClangTutorFuncBad(); | ||
|
||
void clangTutorFuncOK(); | ||
|
||
struct ClangTutorStruct { | ||
// expected-warning@+1 {{Function names should start with lower-case letter}} | ||
void ClangTutorMemberMethodBad(); | ||
void clangTutorMemberMethodOK(); | ||
}; | ||
Comment on lines
+13
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this duplicating tests from CodeStyleCheckerFunction.cpp? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,9 @@ foreach( tool ${CLANG_TUTOR_TOOLS} ) | |
${tool} | ||
"clangTooling" | ||
) | ||
|
||
# ct action type should be CmdlineAfterMainAction | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to expand this comment with some explanation that will say why |
||
if(${tool} STREQUAL "ct-code-style-checker") | ||
target_compile_definitions(${tool} PRIVATE TARGET_CLANG_TOOL=1) | ||
endif() | ||
endforeach() |
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.
TARGET_CLANG_TOOL
->CT_CSC_AS_TOOL
(for consistency with the other CMake vars in clang-tutor)Also, could you document this method? A link to Clang docs would be helpful. Also, what is the difference between
AddBeforeMainAction
andCmdlineAfterMainAction
? Is it possible to test the difference? As in, to write a test that we demonstrate the difference between the two?