microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.5k stars 1.55k forks source link

Intellisense not handling attributes for ext_vector_type #10037

Open lucianthorr opened 1 year ago

lucianthorr commented 1 year ago

Environment

c_cpp_properties.json settings that I've tried "intelliSenseMode": "macos-gcc-arm64", and "intelliSenseMode": "macos-clang-arm64",

Bug Summary and Steps to Reproduce

Bug Summary: Intellisense reports an error expression must have class type but it has type "vector4"C/C++(153) but it doesn't register as an error during compilation. Xcode does not report this code as problematic either.

Steps to reproduce: define a vector typedef float vector4 __attribute__((ext_vector_type(4)));

Refer to a value in the vector using (x, y, z, w) rather than indexing

vector4 V;
V.x = 1.0;

Intellisense returns expression must have class type but it has type "vector4"C/C++(153)

Expected behavior

I don't think this should be reported as an error in Intellisense.

If the error is correct then is there something obvious that I'm missing in the c_cpp_properties.json?

Code sample and Logs

{
    "configurations": [
        {
            "name": "VectorTest",
            "includePath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks",
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c89",
            "cppStandard": "c++14",
            "intelliSenseMode": "macos-clang-arm64",
            "browse": {
                "limitSymbolsToIncludedHeaders": true
            }
        }
    ],
    "version": 4
}


### Screenshots

_No response_

### Additional context

_No response_
Colengms commented 1 year ago

Hi @lucianthorr . I'm able to repro this in VS. (We share the same IntelliSense engine as VS). It looks like our IntelliSense engine does not support the V.xyzw syntax, referred to here: https://clang.llvm.org/docs/LanguageExtensions.html

I've opened an issue against our IntelliSense engine, internally. (1656306)

lucianthorr commented 4 months ago

For future me, because I found this thread from two years previous while trying to debug the very same erroneous squiggles, this the best fix I've found so far. https://github.com/microsoft/vscode-cpptools/issues/1231#issuecomment-837528890