microsoft / microsoft/vscode-cpptools
IntelliSense under clang-x64 doesn't support Microsoft integer suffixes
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Environment
- OS and Version: Windows 10 Enterprise LTSC 21H2 (10.0.19044.3570)
- VS Code Version: 1.83.1
- C/C++ Extension Version: 1.17.5
- LLVM Version: 17.0.2
Bug Summary and Steps to Reproduce
Bug Summary:
When using IntelliSense mode clang-x64, IntelliSense doesn't recognize Microsoft integer suffixes (which are used in the Windows SDK), however it works when using IntelliSense mode msvc-x64. Despite that, these suffixes compile on Clang.
Steps to reproduce:
- Create a main.c file containing:
int main(void) { return 0i32; }
or
// the Clang header has '#include_next <limits.h>' which includes limits.h
// from the Windows SDK, in turn using these integer suffixes
#include <limits.h>
int main(void) { return _I32_MAX; }
- Set IntelliSense mode to clang-x64 in c_cpp_properties.json
- Hover over integer constant
- See error squiggle "extra text after expected end of number"
- Compile using this command line:
clang main.c -Weverything -o main.exe - No warnings or errors generated
Expected behavior:
Shouldn't display any error, or perhaps an error about compiler portability that explicitly states it's a Microsoft extension.
Configuration and Logs
c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"compilerPath": "C:/Program Files/LLVM/bin/clang.exe",
"intelliSenseMode": "clang-x64",
"configurationProvider": "ms-vscode.cpptools"
}
],
"version": 4
}
Logs:
-------- Diagnostics - 10/25/2023, 3:26:01 PM
Version: 1.17.5
Current Configuration:
{
"name": "Win32",
"compilerPath": "C:/Program Files/LLVM/bin/clang.exe",
"intelliSenseMode": "clang-x64",
"configurationProvider": "ms-vscode.cpptools",
"compilerPathIsExplicit": true,
"cStandardIsExplicit": false,
"cppStandardIsExplicit": false,
"intelliSenseModeIsExplicit": true,
"compilerPathInCppPropertiesJson": "C:/Program Files/LLVM/bin/clang.exe",
"configurationProviderInCppPropertiesJson": "ms-vscode.cpptools",
"mergeConfigurations": false,
"browse": {
"path": [
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
cpptools version (native): 1.17.5.0
Translation Unit Mappings:
[ E:\vscode-cpptools bug\main.c ]:
E:\vscode-cpptools bug\main.c
Translation Unit Configurations:
[ E:\vscode-cpptools bug\main.c ]:
Process ID: 1268
Memory Usage: 54 MB
Compiler Path: C:\Program Files\LLVM\bin\clang.exe
Includes:
C:\Program Files\LLVM\lib\clang\17\include
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.37.32820\include
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.37.32820\atlmfc\include
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt
Standard Version: c17
IntelliSense Mode: windows-clang-x64
Other Flags:
--clang
--clang_version=170002
--ms_compatibility
Total Memory Usage: 54 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5486
Other Extensions
Same behavior when the only enabled extension is C/C++.
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the diagnostic with the issue's main.c example and the clang-x64 settings in c_cpp_properties.json, then trace the IntelliSense parsing path for integer literals under Microsoft compatibility. Done means Microsoft integer suffixes produce no erroneous squiggle in clang-x64 while the provided clang command continues to compile cleanly; add or update a regression test if the relevant test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, typescript, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100