Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/Basic/Diagnostic.h | ||
---|---|---|
1341 | Should this be disabled on functions that pass format args to the diagnostic so it will only optionally add things FixIts, Notes, Ranges...? |
Mainly syntactic sugar, If you have a function that maybe returns a FixItHint or SourceRange you can pass it directly to the DiagnosticBuilder.
This comes up with a fair amount of regularity, even just for things like printing a simple integer (consider optional attribute arguments, etc). However, it seems like we might want to express this via the format string so that we don't run into a situation where an unavailable optional argument changes the indexing in the case where it's not additional information like a source range or fixit.
I can see it being useful for fix-its and source ranges, however I have a concern about it accidentally eating arguments that were supposed to go into a format string. For that, I second Aaron's suggestion to implement an extension for format strings. If you don't want to do that far, I think adding specific overloads for optional fix-its and optional source ranges would work, and won't trigger in unexpected situations.
Is there any code we can cleanup as a result of adding these overloads? I would have expected to see some code changes justifying each additional overload, which would also give us test coverage for the changes.
clang/include/clang/Basic/Diagnostic.h | ||
---|---|---|
1298 | s/;// (and in functions below as well) |
s/;// (and in functions below as well)