Skip to content

Add TypeSanitizer support#744

Draft
laurynas-biveinis wants to merge 1 commit intomasterfrom
type-sanitizer
Draft

Add TypeSanitizer support#744
laurynas-biveinis wants to merge 1 commit intomasterfrom
type-sanitizer

Conversation

@laurynas-biveinis
Copy link
Collaborator

@laurynas-biveinis laurynas-biveinis commented Mar 17, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced build configuration now supports a new type sanitization option that performs runtime checks for type-related issues.
    • Added support for advanced sanitization in both Release and Debug builds with compatible compilers.
  • Documentation

    • Updated development guidelines to include instructions for enabling the new type sanitization checks.

@laurynas-biveinis laurynas-biveinis self-assigned this Mar 17, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 17, 2025

Walkthrough

The changes add a new build configuration option to enable TypeSanitizer checks. A boolean parameter is introduced in the CircleCI configuration, while GitHub workflows now set a global environment variable and add new job configurations for Clang builds. The CMake configuration is updated with a new option to activate TypeSanitizer runtime checks, complete with version verification for Clang (20.0 or later) and the addition of sanitizer flags. The documentation in CONTRIBUTING.md is modified to guide developers on using the new feature.

Changes

Files Change Summary
.circleci/config.yml
.github/workflows/build.yml
Added new sanitizer parameter (typesan/DEFAULT_SANITIZE_TYPE), configured environment variables, and introduced new job configurations for Clang builds to support TypeSanitizer.
CMakeLists.txt Introduced the SANITIZE_TYPE option with conditional logic to verify Clang version and append appropriate -fsanitize=type flags when enabled.
CONTRIBUTING.md Updated documentation to include instructions for enabling TypeSanitizer via the new CMake option.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant CI as CI/CD System
    participant CMake as CMake
    participant Compiler as Compiler

    Dev->>CI: Trigger build
    CI->>CI: Load configuration parameters (typesan / DEFAULT_SANITIZE_TYPE)
    CI->>CMake: Invoke CMake with -DSANITIZE_TYPE flag
    CMake->>CMake: Check Clang version (>=20) and set sanitizer flags
    CMake->>Compiler: Build with -fsanitize=type flags
    Compiler-->>CMake: Return build result
Loading

Poem

In the realm of builds, a new flag is born,
TypeSan rises, leaving older checks forlorn.
CI scripts now sing a sharper tune,
CMake verifies Clang before hitting June.
Code marches forward—no more excuses to mourn!

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4424b70 and 95132c2.

📒 Files selected for processing (4)
  • .circleci/config.yml (3 hunks)
  • .github/workflows/build.yml (6 hunks)
  • CMakeLists.txt (1 hunks)
  • CONTRIBUTING.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (9)
CONTRIBUTING.md (1)

40-41: Clear Documentation for TypeSanitizer Option

The addition of the TypeSanitizer option in the development CMake options is clear and well-documented. The requirement that it’s only available with clang version 20 or later is concise. No changes required here.

.circleci/config.yml (3)

27-29: New Parameter for TypeSanitizer Support

The new boolean parameter typesan has been added with a default of false. The naming is consistent and clear. Just make sure that any future use aligns with the expected value (i.e. ON/true when enabled).


133-133: Extracting the TYPESAN Variable

The assignment readonly TYPESAN=<< parameters.typesan >> correctly extracts the parameter and is consistent with the surrounding variables. No issues.


155-157: Passing the TypeSanitizer Flag to CMake

Appending -DSANITIZE_TYPE=$TYPESAN in the CMake command is properly integrated into the build configuration. Everything looks solid here.

.github/workflows/build.yml (4)

14-14: Global DEFAULT_SANITIZE_TYPE Environment Variable

The new environment variable DEFAULT_SANITIZE_TYPE: OFF has been correctly added in the global configuration. Naming and default value are consistent with your other sanitizer options.


30-30: Job Environment Propagation

Setting SANITIZE_TYPE: ${{matrix.SANITIZE_TYPE}} in the job environment assures that the flag propagates correctly. Good consistency observed.


129-134: Release Job Configuration for TypeSanitizer

The new matrix entry for "clang 20 Release with TypeSan" is properly defined, ensuring that SANITIZE_TYPE is set to ON for this job. This enhances coverage of sanitizer configurations.


158-163: Debug Job Configuration for TypeSanitizer

Similarly, the "clang 20 Debug with TypeSan" job configuration correctly enables SANITIZE_TYPE. The consistency across release and debug builds is excellent.

CMakeLists.txt (1)

281-289: Robust Implementation of SANITIZE_TYPE Option

The new option SANITIZE_TYPE is implemented robustly. The conditional check to ensure that either the compiler is Clang and its version is at least 20.0 is spot on. Calling set_common_sanitizer_flags() before appending the sanitizer flags ensures consistency with other sanitizer options.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sonarqubecloud
Copy link

@laurynas-biveinis laurynas-biveinis marked this pull request as draft March 17, 2025 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant