Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C/C++ analysis and #include completion interprets "-iquote" as "-I" #12198

Closed
l-inc opened this issue Apr 15, 2024 · 10 comments
Closed

C/C++ analysis and #include completion interprets "-iquote" as "-I" #12198

l-inc opened this issue Apr 15, 2024 · 10 comments
Assignees
Labels
bug Feature: Auto-complete Feature: Code Analysis Related to integration with clang-tidy, cppcheck, cl.exe /analyze, etc. fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Projects
Milestone

Comments

@l-inc
Copy link

l-inc commented Apr 15, 2024

Environment

  • OS and Version: Fedora 39 (6.8.4-200.fc39.x86_64)
  • VS Code Version: 1.88.1
  • C/C++ Extension Version: 1.19.9
  • If using SSH remote, specify OS of remote machine: not an SSH remote

Bug Summary and Steps to Reproduce

Bug Summary:
We use automatically generated "compile_commands.json" to pass the exact command line arguments per translation unit (which differ for different translation units). We further use "-iquote" for the internal include directories of the project.

When issuing "C/C++ Log Diagnostics", the "Includes:" correctly lists the include directories and "compile_commands.json entry" correctly lists all command line parameters including the include directories. However, when running "C/C++ Run Code Analysis on Active File", the output log shows that all the command line parameters preceded by "-iquote" in "compile_commands.json" are preceded with "-I" instead (in contrast, "-isystem" correctly precedes the default includes of the GCC toolchain). As a result, some of the headers of the GCC toolchain (e.g., #include <assert.h>) are instead taken from our project's internal directories, leading to the incorrect analysis.

Steps to reproduce:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior:
"-iquote" is interpreted as "-iquote" (not as "-I") by the C/C++ analysis.

Configuration and Logs

C/C++ Log Diagnostics:
-------- Diagnostics - 4/15/2024, 1:46:12 PM
Version: 1.19.9
Current Configuration:
{
    "name": "Linux",
    "includePath": [],
    "defines": [],
    "cppStandard": "gnu++17",
    "forcedInclude": [],
    "compileCommands": "<build-folder-2>/../compile_commands_with_ut.json",
    "cStandard": "gnu99",
    "intelliSenseMode": "linux-gcc-arm64",
    "intelliSenseModeIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "browse": {
        "path": [
            "${workspaceFolder:core}",
            "${workspaceFolder:build}"
        ],
        "limitSymbolsToIncludedHeaders": true,
        "databaseFilename": "<project-folder>/.vscode/vc.db"
    }
}
cpptools version (native): 1.19.9.0
Translation Unit Mappings:
[ <project-folder>/unit-test-utils/unit-test-lib.c - source TU]:
Translation Unit Configurations:
[ <project-folder>/unit-test-utils/unit-test-lib.c ]:
    Process ID: 162463
    Memory Usage: 22 MB
    Compiler Path: <toolchain-folder>/gcc-linaro-aarch64-linux-gnu-5.3.1-2016.05/bin/aarch64-linux-gnu-gcc
    Includes:
        <project-folder>
        <project-folder>/include
        <project-folder>/arch
        <project-folder>/plat
        <build-folder-2>
        <build-folder-2>/release
        <unit-test-folder>/cmock/src
        <unit-test-folder>/unity/src
        <build-folder-2>/release/cmock/include
        <toolchain-folder>/gcc-linaro-aarch64-linux-gnu-5.3.1-2016.05/lib/gcc/aarch64-linux-gnu/5.3.1/include
        <toolchain-folder>/gcc-linaro-aarch64-linux-gnu-5.3.1-2016.05/lib/gcc/aarch64-linux-gnu/5.3.1/include-fixed
        <toolchain-folder>/gcc-linaro-aarch64-linux-gnu-5.3.1-2016.05/aarch64-linux-gnu/include
        <toolchain-folder>/gcc-linaro-aarch64-linux-gnu-5.3.1-2016.05/aarch64-linux-gnu/libc/usr/include
    Defines:
        CONFIG_PLAT_GICV23
        CONFIG_PLAT_GENERIC_TIMER
        UNITY_EXCLUDE_STDINT_H
        UNITY_EXCLUDE_LIMITS_H
        UNITY_EXCLUDE_FLOAT_PRINT
        SRC_FILE_IDX=87
    Standard Version: c99
    IntelliSense Mode: linux-gcc-arm64
    Other Flags:
        --gcc
        --gnu_version=50301
    compile_commands.json entry:
        directory: <project-folder>
        file: unit-test-utils/unit-test-lib.c
        arguments:
            <toolchain-folder>/gcc-linaro-aarch64-linux-gnu-5.3.1-2016.05/bin/aarch64-linux-gnu-gcc
            -c
            -o
            <build-folder-2>/release/unit-test-utils/unit-test-lib.o
            unit-test-utils/unit-test-lib.c
            -std=gnu99
            -fno-isolate-erroneous-paths-dereference
            -Wall
            -Wextra
            -Wno-main
            -Werror
            -O2
            -ggdb3
            -fstack-protector-strong
            -march=armv8-a
            -mcpu=generic
            -mabi=lp64
            -DCONFIG_PLAT_GICV23
            -DCONFIG_PLAT_GENERIC_TIMER
            -iquote
            .
            -iquote
            include
            -iquote
            arch
            -iquote
            plat
            -iquote
            <build-folder-2>
            -iquote
            <build-folder-2>/release
            -I<unit-test-folder>/cmock/src
            -I<unit-test-folder>/unity/src
            -Wcast-align
            -w
            -D
            UNITY_EXCLUDE_STDINT_H
            -D
            UNITY_EXCLUDE_LIMITS_H
            -D
            UNITY_EXCLUDE_FLOAT_PRINT
            -I<build-folder-2>/release/cmock/include
            -DSRC_FILE_IDX=87
Total Memory Usage: 22 MB

Language server log:
<project-folder>/unit-test-utils/unit-test-lib.c
--
-std=gnu99
-xc
-Wno-pragma-pack
-Wno-pragma-once-outside-header
-DCONFIG_PLAT_GICV23
-DCONFIG_PLAT_GENERIC_TIMER
-DUNITY_EXCLUDE_STDINT_H
-DUNITY_EXCLUDE_LIMITS_H
-DUNITY_EXCLUDE_FLOAT_PRINT
-DSRC_FILE_IDX=87
-D__SSP_STRONG__=3
-D__DBL_MIN_EXP__=(-1021)
-D__UINT_LEAST16_MAX__=0xffff
-D__ARM_SIZEOF_WCHAR_T=4
-D__ATOMIC_ACQUIRE=2
-D__FLT_MIN__=1.17549435082228750796873653722224568e-38F
-D__GCC_IEC_559_COMPLEX=2
-D__UINT_LEAST8_TYPE__=unsigned char
-D__INTMAX_C(c)=c ## L
-D__CHAR_BIT__=8
-D__UINT8_MAX__=0xff
-D__WINT_MAX__=0xffffffffU
-D__ORDER_LITTLE_ENDIAN__=1234
-D__SIZE_MAX__=0xffffffffffffffffUL
-D__WCHAR_MAX__=0xffffffffU
-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1=1
-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2=1
-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4=1
-D__DBL_DENORM_MIN__=((double)4.94065645841246544176568792868221372e-324L)
-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8=1
-D__GCC_ATOMIC_CHAR_LOCK_FREE=2
-D__GCC_IEC_559=2
-D__FLT_EVAL_METHOD__=0
-D__unix__=1
-D__GCC_ATOMIC_CHAR32_T_LOCK_FREE=2
-D__UINT_FAST64_MAX__=0xffffffffffffffffUL
-D__SIG_ATOMIC_TYPE__=int
-D__DBL_MIN_10_EXP__=(-307)
-D__FINITE_MATH_ONLY__=0
-D__ARM_FEATURE_UNALIGNED=1
-D__UINT_FAST8_MAX__=0xff
-D__DEC64_MAX_EXP__=385
-D__INT8_C(c)=c
-D__UINT_LEAST64_MAX__=0xffffffffffffffffUL
-D__SHRT_MAX__=0x7fff
-D__LDBL_MAX__=1.18973149535723176508575932662800702e+4932L
-D__ARM_FEATURE_IDIV=1
-D__ARM_FP=14
-D__UINT_LEAST8_MAX__=0xff
-D__GCC_ATOMIC_BOOL_LOCK_FREE=2
-D__UINTMAX_TYPE__=long unsigned int
-D__linux=1
-D__DEC32_EPSILON__=1E-6DF
-D__OPTIMIZE__=1
-D__CHAR_UNSIGNED__=1
-D__UINT32_MAX__=0xffffffffU
-D__AARCH64_CMODEL_SMALL__=1
-D__LDBL_MAX_EXP__=16384
-D__WINT_MIN__=0U
-D__linux__=1
-D__SCHAR_MAX__=0x7f
-D__WCHAR_MIN__=0U
-D__INT64_C(c)=c ## L
-D__DBL_DIG__=15
-D__GCC_ATOMIC_POINTER_LOCK_FREE=2
-D__SIZEOF_INT__=4
-D__SIZEOF_POINTER__=8
-D__USER_LABEL_PREFIX__=
-D__STDC_HOSTED__=1
-D__LDBL_HAS_INFINITY__=1
-D__ARM_ALIGN_MAX_STACK_PWR=16
-D__FLT_EPSILON__=1.19209289550781250000000000000000000e-7F
-D__LDBL_MIN__=3.36210314311209350626267781732175260e-4932L
-D__STDC_UTF_16__=1
-D__DEC32_MAX__=9.999999E96DF
-D__ARM_SIZEOF_MINIMAL_ENUM=4
-D__INT32_MAX__=0x7fffffff
-D__SIZEOF_LONG__=8
-D__STDC_IEC_559__=1
-D__STDC_ISO_10646__=201103L
-D__UINT16_C(c)=c
-D__DECIMAL_DIG__=36
-D__gnu_linux__=1
-D__LDBL_HAS_QUIET_NAN__=1
-D__FLT_HAS_DENORM__=1
-D__SIZEOF_LONG_DOUBLE__=16
-D__BIGGEST_ALIGNMENT__=16
-D__DBL_MAX__=((double)1.79769313486231570814527423731704357e+308L)
-D__INT_FAST32_MAX__=0x7fffffffffffffffL
-D__DBL_HAS_INFINITY__=1
-D__DEC32_MIN_EXP__=(-94)
-D__INT_FAST16_TYPE__=long int
-D__LDBL_HAS_DENORM__=1
-D__DEC128_MAX__=9.999999999999999999999999999999999E6144DL
-D__INT_LEAST32_MAX__=0x7fffffff
-D__DEC32_MIN__=1E-95DF
-D__DBL_MAX_EXP__=1024
-D__DEC128_EPSILON__=1E-33DL
-D__PTRDIFF_MAX__=0x7fffffffffffffffL
-D__STDC_NO_THREADS__=1
-D__LONG_LONG_MAX__=0x7fffffffffffffffLL
-D__SIZEOF_SIZE_T__=8
-D__ARM_ALIGN_MAX_PWR=28
-D__SIZEOF_WINT_T__=4
-D__GCC_HAVE_DWARF2_CFI_ASM=1
-D__ARM_FP16_FORMAT_IEEE=1
-D__GXX_ABI_VERSION=1009
-D__FLT_MIN_EXP__=(-125)
-D__INT_FAST64_TYPE__=long int
-D__FP_FAST_FMAF=1
-D__DBL_MIN__=((double)2.22507385850720138309023271733240406e-308L)
-D__LP64__=1
-D__aarch64__=1
-D__ARM_FP16_ARGS=1
-D__DEC128_MIN__=1E-6143DL
-D__REGISTER_PREFIX__=
-D__UINT16_MAX__=0xffff
-D__DBL_HAS_DENORM__=1
-D__UINT8_TYPE__=unsigned char
-D__FLT_MANT_DIG__=24
-D__UINT64_C(c)=c ## UL
-D_STDC_PREDEF_H=1
-D__ARM_FEATURE_FMA=1
-D__GCC_ATOMIC_INT_LOCK_FREE=2
-D__FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__
-D__STDC_IEC_559_COMPLEX__=1
-D__INT32_C(c)=c
-D__DEC64_EPSILON__=1E-15DD
-D__ORDER_PDP_ENDIAN__=3412
-D__DEC128_MIN_EXP__=(-6142)
-D__ARM_64BIT_STATE=1
-D__LINARO_SPIN__=0
-D__INT_FAST32_TYPE__=long int
-D__UINT_LEAST16_TYPE__=short unsigned int
-Dunix=1
-D__INT16_MAX__=0x7fff
-D__SIZE_TYPE__=long unsigned int
-D__UINT64_MAX__=0xffffffffffffffffUL
-D__INT8_TYPE__=signed char
-D__ELF__=1
-D__FLT_RADIX__=2
-D__INT_LEAST16_TYPE__=short int
-D__ARM_ARCH_PROFILE=65
-D__LDBL_EPSILON__=1.92592994438723585305597794258492732e-34L
-D__UINTMAX_C(c)=c ## UL
-D__ARM_PCS_AAPCS64=1
-D__SIG_ATOMIC_MAX__=0x7fffffff
-D__LINARO_RELEASE__=201605
-D__GCC_ATOMIC_WCHAR_T_LOCK_FREE=2
-D__SIZEOF_PTRDIFF_T__=8
-D__AARCH64EL__=1
-D__DEC32_SUBNORMAL_MIN__=0.000001E-95DF
-D__INT_FAST16_MAX__=0x7fffffffffffffffL
-D__UINT_FAST32_MAX__=0xffffffffffffffffUL
-D__UINT_LEAST64_TYPE__=long unsigned int
-D__FLT_HAS_QUIET_NAN__=1
-D__FLT_MAX_10_EXP__=38
-D__LONG_MAX__=0x7fffffffffffffffL
-D__DEC128_SUBNORMAL_MIN__=0.000000000000000000000000000000001E-6143DL
-D__FLT_HAS_INFINITY__=1
-D__unix=1
-D__UINT_FAST16_TYPE__=long unsigned int
-D__DEC64_MAX__=9.999999999999999E384DD
-D__CHAR16_TYPE__=short unsigned int
-D__PRAGMA_REDEFINE_EXTNAME=1
-D__INT_LEAST16_MAX__=0x7fff
-D__DEC64_MANT_DIG__=16
-D__INT64_MAX__=0x7fffffffffffffffL
-D__UINT_LEAST32_MAX__=0xffffffffU
-D__GCC_ATOMIC_LONG_LOCK_FREE=2
-D__INT_LEAST64_TYPE__=long int
-D__ARM_FEATURE_CLZ=1
-D__INT16_TYPE__=short int
-D__INT_LEAST8_TYPE__=signed char
-D__STDC_VERSION__=199901L
-D__DEC32_MAX_EXP__=97
-D__INT_FAST8_MAX__=0x7f
-D__ARM_ARCH=8
-D__INTPTR_MAX__=0x7fffffffffffffffL
-Dlinux=1
-D__LDBL_MANT_DIG__=113
-D__DBL_HAS_QUIET_NAN__=1
-D__SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1)
-D__INTPTR_TYPE__=long int
-D__UINT16_TYPE__=short unsigned int
-D__WCHAR_TYPE__=unsigned int
-D__SIZEOF_FLOAT__=4
-D__UINTPTR_MAX__=0xffffffffffffffffUL
-D__ARM_ARCH_8A=1
-D__DEC64_MIN_EXP__=(-382)
-D__INT_FAST64_MAX__=0x7fffffffffffffffL
-D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1
-D__FLT_DIG__=6
-D__UINT_FAST64_TYPE__=long unsigned int
-D__INT_MAX__=0x7fffffff
-D__INT64_TYPE__=long int
-D__FLT_MAX_EXP__=128
-D__ORDER_BIG_ENDIAN__=4321
-D__DBL_MANT_DIG__=53
-D__INT_LEAST64_MAX__=0x7fffffffffffffffL
-D__GCC_ATOMIC_CHAR16_T_LOCK_FREE=2
-D__DEC64_MIN__=1E-383DD
-D__WINT_TYPE__=unsigned int
-D__UINT_LEAST32_TYPE__=unsigned int
-D__SIZEOF_SHORT__=2
-D__LDBL_MIN_EXP__=(-16381)
-D__INT_LEAST8_MAX__=0x7f
-D__SIZEOF_INT128__=16
-D__LDBL_MAX_10_EXP__=4932
-D__ATOMIC_RELAXED=0
-D__DBL_EPSILON__=((double)2.22044604925031308084726333618164062e-16L)
-D_LP64=1
-D__UINT8_C(c)=c
-D__INT_LEAST32_TYPE__=int
-D__SIZEOF_WCHAR_T__=4
-D__UINT64_TYPE__=long unsigned int
-D__ARM_NEON=1
-D__INT_FAST8_TYPE__=signed char
-D__GNUC_STDC_INLINE__=1
-D__DBL_DECIMAL_DIG__=17
-D__STDC_UTF_32__=1
-D__DEC_EVAL_METHOD__=2
-D__UINT32_C(c)=c ## U
-D__INTMAX_MAX__=0x7fffffffffffffffL
-D__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__
-D__FLT_DENORM_MIN__=1.40129846432481707092372958328991613e-45F
-D__INT8_MAX__=0x7f
-D__UINT_FAST32_TYPE__=long unsigned int
-D__CHAR32_TYPE__=unsigned int
-D__FLT_MAX__=3.40282346638528859811704183484516925e+38F
-D__FP_FAST_FMA=1
-D__ARM_FEATURE_NUMERIC_MAXMIN=1
-D__INT32_TYPE__=int
-D__SIZEOF_DOUBLE__=8
-D__FLT_MIN_10_EXP__=(-37)
-D__INTMAX_TYPE__=long int
-D__DEC128_MAX_EXP__=6145
-D__ATOMIC_CONSUME=1
-D__UINTMAX_MAX__=0xffffffffffffffffUL
-D__DEC32_MANT_DIG__=7
-D__DBL_MAX_10_EXP__=308
-D__LDBL_DENORM_MIN__=6.47517511943802511092443895822764655e-4966L
-D__INT16_C(c)=c
-D__ARM_ARCH_ISA_A64=1
-D__STDC__=1
-D__PTRDIFF_TYPE__=long int
-D__ATOMIC_SEQ_CST=5
-D__UINT32_TYPE__=unsigned int
-D__UINTPTR_TYPE__=long unsigned int
-D__DEC64_SUBNORMAL_MIN__=0.000000000000001E-383DD
-D__DEC128_MANT_DIG__=34
-D__LDBL_MIN_10_EXP__=(-4931)
-D__SIZEOF_LONG_LONG__=8
-D__GCC_ATOMIC_LLONG_LOCK_FREE=2
-D__LDBL_DIG__=33
-D__FLT_DECIMAL_DIG__=9
-D__UINT_FAST16_MAX__=0xffffffffffffffffUL
-D__GCC_ATOMIC_SHORT_LOCK_FREE=2
-D__UINT_FAST8_TYPE__=unsigned char
-D__ATOMIC_ACQ_REL=4
-D__ATOMIC_RELEASE=3
-I<project-folder>
-I<project-folder>/include
-I<project-folder>/arch
-I<project-folder>/plat
-I<build-folder-2>
-I<build-folder-2>/release
-I<unit-test-folder>/cmock/src
-I<unit-test-folder>/unity/src
-I<build-folder-2>/release/cmock/include
-isystem<toolchain-folder>/gcc-linaro-aarch64-linux-gnu-5.3.1-2016.05/lib/gcc/aarch64-linux-gnu/5.3.1/include
-isystem<toolchain-folder>/gcc-linaro-aarch64-linux-gnu-5.3.1-2016.05/lib/gcc/aarch64-linux-gnu/5.3.1/include-fixed
-isystem<toolchain-folder>/gcc-linaro-aarch64-linux-gnu-5.3.1-2016.05/aarch64-linux-gnu/include
-isystem<toolchain-folder>/gcc-linaro-aarch64-linux-gnu-5.3.1-2016.05/aarch64-linux-gnu/libc/usr/include
Error while processing <project-folder>/unit-test-utils/unit-test-lib.c.
warning: redefining builtin macro [clang-diagnostic-builtin-macro-redefined]
<project-folder>/unit-test-utils/unit-test-lib.c:144:9: error: call to undeclared function 'assert'; ISO C99 and later do not support implicit function declarations [clang-diagnostic-implicit-function-declaration]
  144 |         assert(backup_data != NULL && "Failed to allocate dynamic memory for backup data");
      |         ^
<toolchain-folder>/gcc-linaro-aarch64-linux-gnu-5.3.1-2016.05/aarch64-linux-gnu/libc/usr/include/bits/mathcalls.h:109:33: error: too few arguments provided to function-like macro invocation [clang-diagnostic-error]
  109 | __MATHCALL (log,, (_Mdouble_ __x));
      |                                 ^
<project-folder>/include/log-if.h:109:9: note: macro 'logf' defined here
  109 | #define logf(level, prefix, fmt, ...)                                                              \
      |         ^

Other Extensions

No response

Additional context

No response

@sean-mcmanus sean-mcmanus added bug Language Service Feature: Code Analysis Related to integration with clang-tidy, cppcheck, cl.exe /analyze, etc. labels Apr 15, 2024
@sean-mcmanus
Copy link
Collaborator

@l-inc Can you try setting C_Cpp.codeAnalysis.clangTidy.useBuildPath to true as a workaround or does that hit other issues for you?

@l-inc
Copy link
Author

l-inc commented Apr 15, 2024

@sean-mcmanus, from what I can see, it completely breaks the analysis: all diagnostic warnings disappear. The equivalent language server log is then as large as this:

<project-folder>/unit-test-utils/unit-test-lib.c
-p=<build-folder-2>/../
Error while processing <project-folder>/unit-test-utils/unit-test-lib.c.
error: unknown argument: '-fno-isolate-erroneous-paths-dereference' [clang-diagnostic-error]
error: unknown target ABI 'lp64' [clang-diagnostic-error]

Besides, I don't think that the problem is limited to clang-tidy. The auto-completion doesn't work for the symbols from the affected headers either.

P.S. -p= also seems to make clang-tidy use a hard-coded file name for the clang compilation database (that is, compile_commands.json). If I use the one we actually need in the project (which we need to be a non-default one), then it fails as follows:

<project-folder>/unit-test-utils/unit-test-lib.c
-p=<build-folder-2>/../
Error while trying to load a compilation database:
Could not auto-detect compilation database from directory "<build-folder-2>/../"
No compilation database found in <build-folder-2>/../ or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
Error while processing <project-folder>/unit-test-utils/unit-test-lib.c.
<project-folder>/unit-test-utils/unit-test-lib.c:9:10: error: 'stdarg.h' file not found [clang-diagnostic-error]
    9 | #include <stdarg.h>
      |          ^~~~~~~~~~

@sean-mcmanus sean-mcmanus self-assigned this Apr 15, 2024
@sean-mcmanus sean-mcmanus added this to the 1.20.2 milestone Apr 15, 2024
@sean-mcmanus sean-mcmanus added this to Triage in 1.21 via automation Apr 15, 2024
@sean-mcmanus sean-mcmanus moved this from Triage to Pull Request in 1.21 Apr 16, 2024
@sean-mcmanus sean-mcmanus moved this from Pull Request to Done in 1.21 Apr 16, 2024
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Apr 16, 2024
@sean-mcmanus
Copy link
Collaborator

@l-inc Okay, yeah, you should keep C_Cpp.codeAnalysis.clangTidy.useBuildPath at false -- our next release should have a fix (the -I should be changed to -iquote when passed to clang-tidy).

@l-inc
Copy link
Author

l-inc commented Apr 16, 2024

@sean-mcmanus, thanks a lot. That's quite fast.

P.S. Does the fix also cover the same problem with auto-completion?

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Apr 16, 2024

@l-inc The code was already setup to handle -isystem from the fix for #9366 (so -iquote handling was trivial to add).

I wasn't initially understanding what you meant by "auto-completion", but I figured out you're referring to the #include autocompletion -- yeah, that should be fixed too (the completions from the -iquote directory won't appear in <> includes).

@sean-mcmanus sean-mcmanus changed the title C/C++ analysis interprets "-iquote" as "-I" C/C++ analysis and #include completion interprets "-iquote" as "-I" Apr 16, 2024
@l-inc
Copy link
Author

l-inc commented Apr 16, 2024

@sean-mcmanus, I meant the auto-completion of symbols in the headers. E.g., if the function/macro "assert()" is available in assert.h provided with the toolchain (reachable via the paths supplied with "-isystem") but not available in assert.h available in the project (reachable via the paths supplied with "-iquote"), then #include <assert.h> should allow for the auto-completion of the function/macro "assert()".

I asked because I assumed that clang-tidy was an independent piece of infrastructure, whereas the auto-completion was featured by a separate parser, such as EDG. However, if you say that the auto-completion of the header names will work, then my question is anyway answered. Thank you.

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Apr 16, 2024

@l-inc I've filed bug #12207 -- our EDG parser supports handling it, but we're not sending it the correct arguments (I'm not sure of an ETA for that fix...it's currently in the next milestone, but that could change), so the IntelliSense-based features aren't fixed, just clang-tidy and #include completion which are systems that aren't implemented in the cpptools-srv (IntelliSense parser).

@sean-mcmanus
Copy link
Collaborator

@l-inc Code analysis and #include completion are fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.20.2, but IntelliSense-based features will still not use the correct include search paths for -iquote or -isystem includes. #12207 .

@l-inc
Copy link
Author

l-inc commented Apr 22, 2024

@sean-mcmanus, thank you. clang-tidy is already a significant fix. And I've noticed that you moved the IntelliSense part to "In progress" as well. This is faster than I could hope for.

@sean-mcmanus sean-mcmanus removed this from Done in 1.21 Apr 30, 2024
@sean-mcmanus sean-mcmanus added this to Triage in 1.20 via automation Apr 30, 2024
@bobbrow bobbrow moved this from Triage to Done in 1.20 May 6, 2024
@sean-mcmanus
Copy link
Collaborator

@l-inc We fixed the IntelliSense handling of -iquote/isystem with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.21.0, so let us know you're still seeing any issues with that scenario.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Feature: Auto-complete Feature: Code Analysis Related to integration with clang-tidy, cppcheck, cl.exe /analyze, etc. fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Projects
No open projects
1.20
Done
Development

No branches or pull requests

2 participants