Skip to content

internal/parser:parse unexpose type#506

Merged
MeteorsLiu merged 3 commits into
xgo-dev:mainfrom
luoliwoshang:parser/typeof
Jul 10, 2025
Merged

internal/parser:parse unexpose type#506
MeteorsLiu merged 3 commits into
xgo-dev:mainfrom
luoliwoshang:parser/typeof

Conversation

@luoliwoshang
Copy link
Copy Markdown
Contributor

@luoliwoshang luoliwoshang commented Jul 10, 2025

resolved #497

invest

the gpspi_flash_ll_clock_reg_t and spimem_flash_ll_clock_reg_t 's ast node because not support the typeof(GPSPI2.clock.val) parse,to not generate this typedef node

extern spi_dev_t GPSPI2;
extern spi_mem_dev_t SPIMEM0;

typedef typeof(GPSPI2.clock.val) gpspi_flash_ll_clock_reg_t;
typedef typeof(SPIMEM1.clock.val) spimem_flash_ll_clock_reg_t;

and at the union node , will compare the node's type 's size to choose the largest field as the field , but because the gpspi_flash_ll_clock_reg_t have not defined ,so it make a implict forward decl,and have not init,so when get the gpspi's size will cause panic: nil underlying

resolution

typedef typeof(GPSPI2_t.clock.val) gpspi_flash_ll_clock_reg_t;

with the underlying typeof(SPIMEM1.clock.val) got the Unexpose type kind in libclang,we can use the canonicalType to get the actual type.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.14%. Comparing base (7f8de48) to head (80a1c04).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #506   +/-   ##
=======================================
  Coverage   84.14%   84.14%           
=======================================
  Files          27       27           
  Lines        2738     2738           
=======================================
  Hits         2304     2304           
  Misses        391      391           
  Partials       43       43           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MeteorsLiu MeteorsLiu merged commit fd56e4b into xgo-dev:main Jul 10, 2025
15 checks passed
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.

panic: nil underlying; when use a typedef which underlying is typeof(xxx)

2 participants