Skip to content
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

Use subprocess SL mode for the .vcxproj #2661

Closed
AbbasNS opened this issue Sep 23, 2021 · 0 comments · Fixed by #2872
Closed

Use subprocess SL mode for the .vcxproj #2661

AbbasNS opened this issue Sep 23, 2021 · 0 comments · Fixed by #2872
Labels
Milestone

Comments

@AbbasNS
Copy link
Contributor

AbbasNS commented Sep 23, 2021

Why

  • Reduce the maintenance cost of.vcxproj projects.
  • Propagate new CFamily compiler-related features automatically to.vcxproj projects.

Details:
We introduced a new subprocess SL mode. This mode moves most of the CFamily compilers/driver’s details to the CFamily side. This mode is used for CMake projects.
For .vcxproj we still use the old subprocess mode. This means:

  • A duplicate version of the driver is maintained on the SonarLint side: MsvcDriver.cs
  • The scanner protocol data is needlessly maintained on the SonarLint side: Protocol.cs. The data sent in this protocol, unlike with the subprocess SL mode, need to be continuously updated with fields irrelevant to SL.
  • Maintaining mapping of the compilation options to the command line equivalence: CFamilyHelper_Capture.cs
  • Supporting a new compiler or a compiler feature requires duplicating the work on the SonarLint side.

What
Use the subprocess SL mode for the .vcxproj.
Drop the no longer needed duplicated and hard-to-maintain CFamily specific code.
How

  1. Load all the information required by the subprocess SL mode from the .vcxproj project(pretty straightforward):

    • Compilation Database:

      • File: absolute path of the file to be analyzed
      • Directory: VS project Directory
      • Command:
        vcFileSettings.GetEvaluatedPropertyValue("ClCompilerPath")
        +
        "All Options" field found here:
        image
        +
        Additional options (already loaded - no change)
        +
        File full Path
    • Include env variables: vcFileSettings.GetEvaluatedPropertyValue("AdditionalIncludeDirectories"),

    • Preamble/Reproducer/Header file identification/Header language detection remain the same.

  2. Use the Procol of the subprocess SL mode.

  3. Drop the PortedFromJava Directory.

  4. Drop most of the file config loading. Since we no longer have to load each option separately we just load "All Options": FileConfig.cs

  5. Drop the mapping from VS option to command line: CFamilyHelper_Capture.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants