-
Notifications
You must be signed in to change notification settings - Fork 135
Add new clang build setting EMIT_SARIF_DIAGNOSTICS_FILE #938
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -835,6 +835,7 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible | |||||
| "-fmessage-length=", | ||||||
| "-fmacro-backtrace-limit=", | ||||||
| "-fbuild-session-timestamp=", | ||||||
| "-fdiagnostics-add-output=" | ||||||
| ]) | ||||||
|
|
||||||
| static let outputAgnosticCompilerArgumentsWithValues = Set<ByteString>([ | ||||||
|
|
@@ -1219,7 +1220,7 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible | |||||
| dependencyData = nil | ||||||
| } | ||||||
|
|
||||||
| let extraOutputs: [any PlannedNode] | ||||||
| var extraOutputs: [any PlannedNode] | ||||||
| let moduleDependenciesContext = cbc.producer.moduleDependenciesContext | ||||||
| let headerDependenciesContext = cbc.producer.headerDependenciesContext | ||||||
| let dependencyValidationOutputPath: Path? | ||||||
|
|
@@ -1336,6 +1337,8 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| commandLine += addCompilerMetadataFlags(cbc, outputFileDir.join(outputNode.path.str + ".source-metadata.json"), delegate, &extraOutputs) | ||||||
|
||||||
| commandLine += addCompilerMetadataFlags(cbc, outputFileDir.join(outputNode.path.str + ".source-metadata.json"), delegate, &extraOutputs) | |
| commandLine += addCompilerSarifFlags(cbc, outputFileDir.join(outputNode.path.str + ".compiled.sarif"), delegate, &extraOutputs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to add quoting and/or escaping here, since the path has to be part of the same option? Or does the fact the result is an array mean that the build system will property quote each array element?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latter.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1720,4 +1720,11 @@ | |||||
| CanSetIncludeInIndex = YES; | ||||||
| UTI = "public.protobuf-source"; | ||||||
| }, | ||||||
| { | ||||||
| Identifier = text.json.compiler-metadata.source; | ||||||
|
||||||
| Identifier = text.json.compiler-metadata.source; | |
| Identifier = text.sarif; |
Unless the hierarchy means something, in which case text.json.sarif is fine.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Name = "Source metadata emitted from compiler"; | |
| Name = "Diagnostics log in SARIF format."; |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| UTI = "com.apple.compiler-metadata.source"; | |
| UTI = "com.apple.sarif"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested name:
CLANG_EMIT_SARIF_DIAGNOSTICS_FILE. Unless this macro is reused by the Swift compiler, in which case you should probably drop theCLANG_prefix.