-
Notifications
You must be signed in to change notification settings - Fork 62
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
[IDEA] const-qualify tool #22
Comments
haha, I knew!
The devil with these things is often in the details. Once you start testing the corner cases :) But if you ignore C++ ... it sounds doable!
Yeah, you could try re-implementing it? It would be a great example for |
Sure happy to give it a go. I'm using CC0 to be compliant with your project, even though (Apache-2.0 OR MIT) is my goto. Yeah C++ is full of weird edge cases and extended syntax and semantics that I'd like to ignore. Not to say this tool shouldn't run on C++ codebases, but just that if I could ignore its fancier features and do the bare minimum to get it working on C++ then I'd be happy. Will go over that video with a fine-toothed comb, maybe even contacting the speaker, and port it to LLVM 13 in a monorepo… focussing on just the features I care about (but maybe doing his const ref stuff if he just shares the code along). I think I'll do #23 first since that's heavy on my mind and will allow me to give a large LoC PR to a few open-source projects I have my eye on. Watch this space! |
I want to work on a
const
qualify tool… concentrating on C with C++ as an afterthought (so don't want to get caught up on theconstexpr
,const
ref, andconst
method conditions).Whenever I go to a new codebase I'm [usually] annoyed at the lack of care taken to differentiate changing (var) names and unchanging (val/binding-only) names. Probably all those functional languages rubbing off on me!
I'd expect this to aid in compiler optimisations also…
So what I'm thinking is to use libclang and/or libtooling to modify code automatically from:
To:
…and get it to work nicely on
enum
s,struct
s, objects (instantiations ofclass
es andstruct
s), functions, globals, and{
scoped bodies (e.g., function bodies).On the surface I'm not thinking this would be particularly difficult… at least for the majority of cases.
What do you think? - I don't have much experience here so happy to write it myself but could use some oversight 😅
(happy to release under CC0 to be compliant with your philosophy)
Thanks for your consideration
EDIT: Oh and I was watching this CppCon talk from a guy who made some progress in this direction: https://www.youtube.com/watch?v=tUBUqJSGr54
The text was updated successfully, but these errors were encountered: