Skip to content

IntelliSense under clang-x64 doesn't support Microsoft integer suffixes #11585

Closed

Description

@whypet

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:

  1. 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; }
  1. Set IntelliSense mode to clang-x64 in c_cpp_properties.json
  2. Hover over integer constant
  3. See error squiggle "extra text after expected end of number"
  4. Compile using this command line: clang main.c -Weverything -o main.exe
  5. 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

image
image
image

Activity

  1. Colengms commented on Oct 25, 2023

    @Colengms
    Contributor

    Hi whypet . Thanks for reporting this. I've opened an internal bug against VS, as this issue also occurs in VS and is in IntelliSense code that is shared with VS. (ID 1908009).

  2. Colengms commented on Oct 25, 2023

    @Colengms
    Contributor

    whypet Also, FYI, this line in your configuration appears to be invalid:

    "configurationProvider": "ms-vscode.cpptools"
    

    This field is for specifying the ID of a custom configuration provider, such as CMake Tools and Makefile Tools. I don't think having an incorrect value here is going to hurt, but I'd suggest removing it, just in case.

  3. whypet commented on Oct 25, 2023

    @whypet
    Author

    Hey, thanks for the heads-up, I'll remove that line from my configurations. I remember thinking it was needed because I was using CMake Tools and ended up having issues with it not giving IntelliSense some information like include directories, so I tried to do it manually.

  4. bobbrow commented on Oct 26, 2023

    @bobbrow
    Contributor

    CMake Tools will only provide information for headers if you list the headers in your add_executable/add_library invocations. Otherwise, you can get the information transitively by opening a source file that includes that header.

  5. whypet commented on Oct 27, 2023

    @whypet
    Author

    I see, thanks. Maybe I was facing these issues because I use target_sources to list all source and header files instead but I'm not sure, I'm a bit new to CMake as a whole.

  6. nlov commented on Nov 16, 2024

    @nlov

    Thanks whypet for filing this bug originally - can confirm it's still happening on my end too after an install of VS 17.12.0 with restart. Windows 11 Pro build 22631, VSCode 1.95.3, C/C++ extension version 1.22.11, LLVM version 19.1.3. IntelliSense Mode clang-x64.

    Thank you in the meantime for this overall wonderful software.

    From the helpful C/C++ Log command, I've got similar includes as whypet:

    System Includes:
        C:\Program Files\LLVM\lib\clang\19\include
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\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
    

    (The variants of macros are written below just for completeness; only the macros without the leading underscores would be used normally of course. The bug still lies with the integer suffixes not being recognized when IntelliSense Mode clang-x64 is used.)

    Image

  7. ChrisIdema commented on Jan 30, 2026

    @ChrisIdema

    I have the same issue. Integer constants like INT64_MAX produce errors in problems pane, because IntelliSense is using MSVC headers instead of clang headers. But building and running works.

    I get:

    extra text after expected end of number
    

    It uses header:
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\stdint.h

    instead of:
    C:\LLVM_19.1.3\lib\clang\19\include\stdint.h

    my c_cpp_properties.json:

    {
        "configurations": [
            {
                "name": "pc",
                "compilerPath": "C:\\LLVM_19.1.3\\bin\\clang.exe",
                // "intelliSenseMode": "windows-clang-x64", 
                // "configurationProvider": "ms-vscode.cmake-tools", 
                "compileCommands": "${workspaceFolder}/build/compile_commands.json"
            }
        ],
        "version": 4
    }
    

    I tried setting up my c_cpp_properties.json in various ways, but nothing worked. Resetting IntelliSense database or restarting VS Code did not work.

    This makes IntelliSense unusable for me. I have to use clangd instead.

    My system:

    • VS Code 1.108.2
    • Windows 11
    • Clang 19.1.3 compiler
    • C/C++ extension
    • CMake extension
  8. Colengms commented on Oct 20, 2026

    @Colengms
    Contributor

    I believe the original issue may have been addressed some time ago. I no longer get warnings in clang mode for code such as:

    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 main2(void) { return _I32_MAX; }

    Closing this issue as fixed.

    Chris Idema (@ChrisIdema) Your issue appears to be unrelated to this thread. If you're still seeing that, let us know. The C/C++ Extension invokes clang or gcc directly to query what system include paths it is using (based on the compiler args, as that can influence that) - which is generally reliable. Include paths used by IntelliSense should match what was configured for that source file in compile_commands.json (or simply the include paths returned from clang.exe by default, if the repro'ing file does not correspond to one of your compile_commands.json entries). If you're still seeing an issue, the specific compile_commands.json command line involved would be useful information for investigating further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions