Skip to content

Implicit struct _GUID on Windows crashes DeclRewriter::detectInlineStruct #448

Closed
@mattmccutchen-cci

Description

@mattmccutchen-cci

By default on Windows, Clang 11 injects an implicit struct _GUID declaration into every translation unit; this is new since Clang 9. This declaration has an invalid source location, so it causes an assertion failure in DeclRewriter::detectInlineStruct in 129 of our regression tests. We should probably just skip inline struct detection if the struct source location is invalid.

While the struct _GUID injection is enabled by default only on Windows, we can enable it on other OSes for testing purposes using the -fms-extensions compiler option. Thus, 3c ms-extensions.c -- -fms-extensions reproduces the problem if ms-extensions.c contains:

int *x;

Some options for testing:

  1. Just add the above as a regression test.
  2. Add an -fms-extensions regression test containing a manually curated wider variety of constructs.
  3. Develop a convenient way to run the entire regression test with -fms-extensions (likely easier with Refactor test RUN commands into a separate tool #355) and do that occasionally (we probably don't want to spend the time to run it on every change).
  4. Just rely on real testing on Windows to catch issues with -fms-extensions and anything else that differs on Windows.

I'm not sure which one offers the best trade-off between value and work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions