cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

removed original filenames from `TokenList` and `ErrorMessage::FileLocation` / added missing `ErrorMessage::FileLocation::mFile` normalization / some cleanups

Open firewave opened this issue 1 year ago • 2 comments

The way ErrorMessage::FileLocation was created there was no case where the names were differed. That could only happen when those came from the TokenList.

The TokenList one could have only differed when TokenList::clangSetOrigFiles() was called. That copied the names over. It was only done in the Clang Import but the names were not touched afterwards so they never differed and this was completely unnecessary.

Also the way ErrorMessage::FileLocation was used in several cases the original name was never set at all.

The name was also not normalized in ErrorMessage::FileLocation when set via the constructor.

firewave avatar Mar 24 '24 18:03 firewave

I went a bit overboard with the cleanups. I will pull out the unrelated changes into a separate PR.

I also think I miss a testcase of the empty original filename case.

firewave avatar Mar 24 '24 18:03 firewave

The original filename is actually different in TokenList when using -rp.

firewave avatar Apr 08 '24 16:04 firewave