Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 417
    • Issues 417
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 17
    • Merge requests 17
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Merge requests
  • !633

Draft: FIX & FEAT: Keep column info throughout typecheck phase & add end column for improved error messaging

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Luuk Kablan requested to merge LuckyLuuk/sac2c:luukk/error-end-column into develop Mar 27, 2026
  • Overview 0
  • Commits 7
  • Changes 36

This merge requests fixes the issue that column info was lost in basically all code during the typecheck phase, it mostly swapped LINE_TO_LOC with NODE_LOCATION where possible. A size_t end_col was also added to the struct location to include the end of token when possible for improved error messaging, some error printing functions also have been changed to show it like <file>:<line>:<col>-<end_col>:<severity> <message> when possible with carets (^) under the code from col to end_col.

I also wrote code to properly compute function-call end_col in ct_fun.c#269, this line would cause compiler crashes if NODE_LOCATION(fundef) was used and using it on assign would show incorrect column range which was the most important location for most common errors to include the col and end_col data.

I basically did a ctrl+shift+f to search throughout the repository where column info was being set/used and tried to do similar things for end_col, I am not quite sure if I missed some spots or added things that were unnecessary, I did manually build and run the compiler to test the VSCode extension I am working on and it all still seemed to work...

Note that there are quite some changes that have nothing to do with token location at all, apparently much code wasn't formatted and when I saved the files I worked in VSCode would automatically format according to the .clang-format provided in the root of the repository.

Edited Mar 27, 2026 by Luuk Kablan
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: luukk/error-end-column