You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Output [SARIF](https://sarifweb.azurewebsites.net/) diagnostics to the specified file. For more information, see [Structured SARIF Diagnostics](sarif-output.md).
10
+
Output [SARIF](https://sarifweb.azurewebsites.net/) diagnostics to the specified file or directory. For more information, see [Structured SARIF Diagnostics](sarif-output.md).
11
11
12
12
## Syntax
13
13
14
-
> **`/experimental:log`***filename*
14
+
> **`/experimental:log`***filename*\
15
+
> **`/experimental:log`***directoryname\\*
15
16
16
17
## Arguments
17
18
18
19
*filename*
19
20
20
-
Where to output SARIF diagnostics. The `.sarif` suffix is added to *filename* to produce the final filename at which to store the resulting SARIF diagnostics. The space between `/experimental:log` and *filename* is optional. Paths that include spaces must be enclosed in double quotes. *filename* may name a relative or absolute path.
21
+
The output file for SARIF diagnostics. The compiler automatically adds the `.sarif` extension to *filename*. The space between `/experimental:log` and *filename* is optional. Use double quotes around paths containing spaces. Both relative and absolute paths are supported.
22
+
23
+
*directoryname\\*
24
+
25
+
The output directory for SARIF diagnostics (for example, `/experimental:log sarif_output\`). Remember to add the trailing backslash (`\`) to indicate it's a directory. Each source file name forms the base name for each SARIF file saved in the directory. The compiler automatically adds the `.sarif` extension to each file name. The space between `/experimental:log` and *directoryname\\* is optional. Use double quotes around paths containing spaces. Both relative and absolute paths are supported.
21
26
22
27
## Remarks
23
28
@@ -28,19 +33,28 @@ Diagnostics are also output as text to the console as usual.
28
33
### To set this compiler option in the Visual Studio development environment
29
34
30
35
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
31
-
32
36
1. Select the specific project **Configuration** and **Platform** for which you want to change the property. You can also choose **"All Configurations"** and **"All Platforms"**.
1. Modify the **Additional Options** property, and then choose **OK**.
37
39
38
-
## Example
40
+
## Examples
41
+
42
+
The following command produces SARIF information for the compilation of `main.cpp` and saves it in the file `main.sarif`:
43
+
44
+
```cmd
45
+
cl /experimental:log main.cpp
46
+
```
47
+
48
+
The following command produces SARIF information for the compilation of `main.cpp` and saves it in the file `mySarifInfo.sarif`:
49
+
50
+
```cmd
51
+
cl /experimental:log mySarifInfo main.cpp
52
+
```
39
53
40
-
The following command produces SARIF information for the entire compilation in the `diags.sarif` file in the current directory:
54
+
The following command produces SARIF information for the entire compilation and saves it in the `sarif_output` directory in the files `main.sarif` and `other.sarif`:
0 commit comments