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

[Sema] Check FunctionDecl has identifier before getName. #6439

Merged
merged 3 commits into from
Mar 21, 2024

Conversation

python3kgae
Copy link
Contributor

Use identifier name without check the identifier exists will cause crash.

Fixes #6426

…ifier.

Use identifier name without check the identifier exists will cause crash.

Fixes microsoft#6426
@bob80905
Copy link
Collaborator

For your test case, I would think only one function declaration is needed. Is it possible to get rid of the rest of them?

Copy link
Contributor

github-actions bot commented Mar 21, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 6f4f758e9b3be1991956f99600982755596e29dc 176e467ed36741b9d9f2c13ea6bb9666ab66af5c -- tools/clang/lib/Sema/SemaHLSL.cpp
View the diff from clang-format here.
diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp
index 3646e35d8..4f3caee35 100644
--- a/tools/clang/lib/Sema/SemaHLSL.cpp
+++ b/tools/clang/lib/Sema/SemaHLSL.cpp
@@ -15690,7 +15690,8 @@ void TryAddShaderAttrFromTargetProfile(Sema &S, FunctionDecl *FD,
 
   // if this FD isn't the entry point, then we shouldn't add
   // a shader attribute to this decl, so just return
-  if (!FD->getIdentifier() || EntryPointName != FD->getIdentifier()->getName()) {
+  if (!FD->getIdentifier() ||
+      EntryPointName != FD->getIdentifier()->getName()) {
     return;
   }
 
  • Check this box to apply formatting changes to this branch.

Copy link
Contributor

@tex3d tex3d left a comment

Choose a reason for hiding this comment

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

LGTM.

@python3kgae python3kgae merged commit 7581ff4 into microsoft:main Mar 21, 2024
10 checks passed
python3kgae added a commit that referenced this pull request Mar 26, 2024
Use identifier name without check the identifier exists will cause
crash.

Fixes #6426

---------

Co-authored-by: Tex Riddell <[email protected]>
Co-authored-by: github-actions[bot]
<github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 7581ff4)
pow2clk pushed a commit to pow2clk/DirectXShaderCompiler that referenced this pull request Jul 15, 2024
) (microsoft#6457)

Use identifier name without check the identifier exists will cause
crash.

Fixes microsoft#6426

---------

Co-authored-by: Tex Riddell <[email protected]>
Co-authored-by: github-actions[bot]
<github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 7581ff4)
(cherry picked from commit 11e1318)
pow2clk added a commit that referenced this pull request Jul 16, 2024
Merges the following changes into mesh nodes to fix a known bug that
required a point release in the march release branch and also some build
fixes for new visual studio diagnostics.

9ca52f4 Add duplicate pragma (#6732)
7809c0b Remove Windows C++ redist hack (#6692)
33277a1 Workaround broken GitHub runner images (#6683)
1b9a796 [Sema] Check FunctionDecl has identifier before getName.
(#6439) (#6457)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Regression, SIGSEGV instead of diagnostics when encountering bool operator==(const T&, const T&)
4 participants