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

[clang][ExtractAPI][NFC] Remove some nullptr dereference problems (#98914) #8987

Conversation

daniel-grumberg
Copy link

A places try to get a NamedDecl's name using getName when it isn't a simple identifier, migrate these areas to getNameAsString.

rdar://125315602

…vm#98914)

A places try to get a NamedDecl's name using getName when it isn't a
simple identifier, migrate these areas to getNameAsString.

rdar://125315602
@daniel-grumberg
Copy link
Author

@swift-ci please test

@fredriss fredriss merged commit 5bbcb7b into swiftlang:swift/release/6.0 Jul 17, 2024
3 checks passed
@drodriguez
Copy link

I think this change introduces a failure in Clang :: ExtractAPI/enum.c test.

FAIL: Clang :: ExtractAPI/enum.c (16 of 57)
******************** TEST 'Clang :: ExtractAPI/enum.c' FAILED ********************
Script:
--
: 'RUN: at line 1';   rm -rf /Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/tools/clang/test/ExtractAPI/Output/enum.c.tmp
: 'RUN: at line 2';   split-file /Users/danielrodriguez/code/swift-source/llvm-project/clang/test/ExtractAPI/enum.c /Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/tools/clang/test/ExtractAPI/Output/enum.c.tmp
: 'RUN: at line 3';   sed -e "s@INPUT_DIR@/Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/tools/clang/test/ExtractAPI/Output/enum.c.tmp@g"  /Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/tools/clang/test/ExtractAPI/Output/enum.c.tmp/reference.output.json.in >> /Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/tools/clang/test/ExtractAPI/Output/enum.c.tmp/reference.output.json
: 'RUN: at line 5';   /Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/bin/clang -cc1 -internal-isystem /Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/lib/clang/17/include -nostdsysteminc -extract-api --pretty-sgf -triple arm64-apple-macosx    -x c-header /Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/tools/clang/test/ExtractAPI/Output/enum.c.tmp/input.h -o /Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/tools/clang/test/ExtractAPI/Output/enum.c.tmp/output.json -verify
: 'RUN: at line 9';   sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g"  /Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/tools/clang/test/ExtractAPI/Output/enum.c.tmp/output.json >> /Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/tools/clang/test/ExtractAPI/Output/enum.c.tmp/output-normalized.json
: 'RUN: at line 11';   diff /Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/tools/clang/test/ExtractAPI/Output/enum.c.tmp/reference.output.json /Users/danielrodriguez/code/swift-source/build/my_macos/llvm-macosx-arm64/tools/clang/test/ExtractAPI/Output/enum.c.tmp/output-normalized.json
--
Exit Code: 1

Command Output (stdout):
--
681a682,687
>           }
>         ],
>         "subHeading": [
>           {
>             "kind": "identifier",
>             "spelling": ""
775a782,787
>         "subHeading": [
>           {
>             "kind": "identifier",
>             "spelling": ""
>           }
>         ],

--

********************
********************
Failed Tests (1):
  Clang :: ExtractAPI/enum.c

The JSON around the empty subheading seems to indicate that it comes from the anonymous enums towards the end of the input header.

Since this is a cherry-pick from LLVM upstream, I went looking for something different there, and I think some work done around ExtractAPI might be missing in this repository for the test to pass. At first I thought about llvm#87772 which is part of upstream, but I don't see in swift/release/6.0. It does not cherry-pick cleanly, but after solving a conflict, it doesn't seem to solve the test. I also tried llvm#93559, first by itself, which has several conflicts and did not compile, and then on top of the previous PR. That combination seems to remove the test failure.

Can we get those two cherry-picked into this branch so the test is passing? Thanks!

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.

4 participants