In core Cppcheck I am not 100% sure if ValueType::originalName should be non-empty in this situation. But Token::originalName should have the information as far as I know.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would be interested to look at Cppcheck code please feel free to do that. I am not sure but off the top of my head the Token::originalName should be set during the Tokenizer::simplifyTypedef. If it is not then it can be set imho.. the Token::originalName for the "char" tokens should say "uint8_t" imho.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi @danielmarjamaki i added a Draft Pull Request. https://github.com/danmar/cppcheck/pull/5968
And actually the valueType-originalTypeName flag was set automatically after the origninalName of the type token is set. But i am not 100% sure why it works because for now i didn't get behind what is exactly happening with tok2 and tok3 in the TypedefSimplifier::replace method. As they both have the same str output for my simple example.
Maybe you can give input in the Pull Request if you have time. I don't want to brake other code with this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey i was using the dump file feature of cppcheck to write some addons.
i wanted to access the valueType-originalTypeName as i noticed that the type itself in the token list is the deducted type, in my example below char.
Then i noticed that this information is missing in the dump file.
Windows Version 2.12.0 and 2.13.0 tested.
Or do i miss some parameters to get the full Output?
Example Program
Based on this https://cppcheck.sourceforge.io/devinfo/doxyoutput/classValueType.html and this https://github.com/danmar/cppcheck/blob/ab4e4624fc6d7cae0750e446becaa222f1074d9d/lib/symboldatabase.cpp#L7914C10-L7918 and this https://github.com/danmar/cppcheck/blob/main/addons/cppcheckdata.py#L162-L174, i would expect that uint8_t is the originalTypeName in the dump file
Last edit: Sven Wienand 2024-02-08
I can reproduce.. I think we should add it..
Just a quick answer now..
In core Cppcheck I am not 100% sure if ValueType::originalName should be non-empty in this situation. But Token::originalName should have the information as far as I know.
At least for me the originalName is also None. If i am correct based on this line https://github.com/danmar/cppcheck/blob/6ee2c86dc331cdec0dcf4195ac45503a39fba57c/addons/cppcheckdata.py#L428 the dump file would need to have a originalName tag for the element which is not present.
Added my dump file for comparison
Last edit: Sven Wienand 2024-02-08
If you would be interested to look at Cppcheck code please feel free to do that. I am not sure but off the top of my head the Token::originalName should be set during the Tokenizer::simplifyTypedef. If it is not then it can be set imho.. the Token::originalName for the "char" tokens should say "uint8_t" imho.
Hi @danielmarjamaki i added a Draft Pull Request.
https://github.com/danmar/cppcheck/pull/5968
And actually the valueType-originalTypeName flag was set automatically after the origninalName of the type token is set. But i am not 100% sure why it works because for now i didn't get behind what is exactly happening with tok2 and tok3 in the TypedefSimplifier::replace method. As they both have the same str output for my simple example.
Maybe you can give input in the Pull Request if you have time. I don't want to brake other code with this.