-
Notifications
You must be signed in to change notification settings - Fork 64
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
Make CodeStyleChecker to be used in a real compilation process. #34
base: main
Are you sure you want to change the base?
Conversation
…cally load plugins during the compilation process.
Nice, I forgot about this! Could you add some more docs, in particular a reference to https://clang.llvm.org/docs/ClangPlugins.html#using-the-clang-command-line? Both in README and in the code? Importantly, how can we test this? |
I have added some documents and passed all test cases of |
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.
Thank you so much for working on this and for sharing, this is brilliant!
Now, instead of modifying existing tests, could you add a new test? In particular, it would be good to add a test that does this:
$ rm file.o
$ ls file.o
ls: cannot access 'file.o': No such file or directory
$Clang_DIR/bin/clang -fplugin=libCodeStyleChecker.dylib -o file.o -c file.cpp
$ ls file.o
file.o
Here's an example how to use bash commands in a LIT test https://github.com/llvm/llvm-project/blob/e090bac638e56ff9db87e622cdf925f2b99dfc30/clang/test/Modules/check-for-sanitizer-feature.cpp#L1-L8
Thank you for working on this 🙏🏻
} | ||
``` | ||
|
||
The **CodeStyleChecker** plugin could be automatically load and be used during the normal compilation |
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.
The **CodeStyleChecker** plugin could be automatically load and be used during the normal compilation | |
The **CodeStyleChecker** plugin could be automatically loaded and used during the normal compilation |
$Clang_DIR/bin/clang -fplugin=libCodeStyleChecker.dylib -o file.o -c file.cpp | ||
file.cpp:2:7: warning: Type and variable names should start with upper-case letter | ||
class clangTutor_BadName; | ||
^~~~~~~~~~~~~~~~~~~ | ||
ClangTutor_BadName | ||
file.cpp:2:17: warning: `_` in names is not allowed | ||
class clangTutor_BadName; | ||
~~~~~~~~~~^~~~~~~~~ | ||
clangTutorBadName | ||
2 warnings generated. |
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.
Add ls file.o
(together without output) before and after invoking clang
to demonstrate that the file was indeed created.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
What does ct
stand for?
Ping @tylzh97 :) |
Adding the getActionType method to allow the clang plugin to automatically load plugins during the compilation process.