C++: Expose more information in FormattingFunction and make subclasses private.#4754
Merged
MathiasVP merged 10 commits intogithub:mainfrom Dec 2, 2020
Merged
C++: Expose more information in FormattingFunction and make subclasses private.#4754MathiasVP merged 10 commits intogithub:mainfrom
MathiasVP merged 10 commits intogithub:mainfrom
Conversation
…hat subclasses don't need to be accessed for this information, and can be private.
…ngFunction as well.
MathiasVP
reviewed
Nov 30, 2020
jbj
previously approved these changes
Dec 1, 2020
Contributor
|
Tests failed: |
Contributor
Author
|
Created https://github.com/github/semmle-code/pull/38334 (internal link) to fix the failing test. Both PRs should be merged at about the same time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up from #4634
FormattingFunctionPrintf,Fprintfetc to use the new predicates insteadPrintf,Fprintfetc privateThe tricky part was getting
UserDefinedFormattingFunctionright (i.e. handling user wrappers to formatting functions). It was already implemented with mutually recursive predicatesprimitiveVariadicFormatteretc underneath, I believe I've managed to upgrade them and simplify the interface to them without adding much bulk to the implementation.In the case of
AttributeFormattingFunction, we simply do not know what is done with the formatted string, so the new predicates are not implemented.The test is for a special case, where a user wraps
vsprintforvfprintfin such a way as it doesn't use an output parameter from the caller, and is thus behaving likevprintf. My first attempt to implement theUserDefinedFormattingFunctionchanges was confused by this case.