Sitelet https://github.com/microsoft/DirectXShaderCompiler/pull/8993
Skip to content

[Linux] Fix GetSkippedRanges crash for virtual unsaved files - #8993

Open
Keith Stockdale (KStocky) wants to merge 2 commits into
microsoft:mainfrom
KStocky:FixGetSkippedRangesCrash
Open

Keith Stockdale (KStocky) wants to merge 2 commits into
microsoft:mainfrom
KStocky:FixGetSkippedRangesCrash

Conversation

@KStocky

Copy link
Copy Markdown
Contributor

Fix a Linux crash in IDxcTranslationUnit::GetSkippedRanges when it is called for a virtual unsaved file that was not used while parsing the translation unit.

This is caused by not having a valid ::llvm::sys::fs::MSFileSystem live when calling certain functions that rely on one existing prior to them being called such as llvm::sys::fs::status. There are a couple of other sites that could produce a similar crash such as:

  • DxcTranslationUnit::GetLocation
  • DxcTranslationUnit::GetLocationForOffset
  • DxcCursor::FindReferencesInFile

However, I have not reproduced crashes with these functions. So I have just left this PR focussed on IDxcTranslationUnit::GetSkippedRanges

Copilot AI balanced review requested due to automatic review settings September 30, 2026 20:37
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new filesystem installation error must be handled before invoking Clang.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Fixes a Linux IntelliSense crash when querying skipped ranges for unused virtual files.

Changes:

  • Installs a disk filesystem during GetSkippedRanges.
  • Adds Linux regression coverage.
  • Documents the fix.
File Description
tools/​clang/​tools/​libclang/​dxcisenseimpl.cpp Sets up filesystem context for skipped-range queries.
tools/​clang/​unittests/​HLSL/​DXIsenseTest.cpp Adds Linux regression coverage.
docs/​ReleaseNotes.md Adds the bug-fix release note.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tools/clang/tools/libclang/dxcisenseimpl.cpp Outdated
Handle error code from AutoPerThreadSystem initialization

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 20:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The targeted fix correctly addresses the missing filesystem context and includes focused regression coverage.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@llvm-beanz

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

3 participants