Code Monkey home page Code Monkey logo

ifc's Introduction

IFC SDK

The IFC SDK provides datatypes and code supporting the read and write of IFC files. This is an experimental project aiming at advancing implementation and uses of C++ Modules at large. The SDK contains C++ datatypes that can be memory-mapped directly onto the on-disk format. See the IFC Specification for more details.

If you want to participate in the development of the IFC SDK, you are welcome! You can report issues, comment on pull requests, and learn about what we are working on. You can also submit pull requests to fix bugs or add features reflecting the Specification: see CONTRIBUTING.md for more information.

Building and Running

This project uses CMake for defining projects, and the code has been tested to work on Windows and Linux. It can be built and run under WSL (Windows Subsystem for Linux) as well.

The JavaScript IFC viewer can be run by loading the index.html file in a browser.

IFC files to experiment with can be generated by using a current Microsoft C++ compiler. There are a couple of IFC files checked into the repo for basic testing purposes. Longer term, we want to be able to generate IFC files using the SDK itself. To generate an IFC file, you can use a current Visual C++ compiler. The following will generate an IFC containing almost everything in the test.cpp translation unit. Currently, non-inline functions or methods will not be generated into the IFC.

cl /std:c++20 /exportHeader test.cpp

This will create an IFC file named test.cpp.ifc. This can be dumped with ifc-printer like this.

ifc-printer.exe --color test.cpp.ifc

See BUILDING.md for more information.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to grant us the right to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR (Pull Request) appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

See CONTRIBUTING.md for more information.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct.

Resources:

License

Copyright (c) Microsoft Corporation.

SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

ifc's People

Contributors

andreyg avatar aytey avatar cdacamar avatar friendlyanon avatar gabrieldosreis avatar microsoft-github-operations[bot] avatar stephantlavavej avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ifc's Issues

How to build on Linux?

Doc states "the code has been tested to work on Windows and Linux". I guess the Linux part means in Windows under WSL, correct?

A quick attempt to build on Linux (no WSL) is giving me this error:

CMake Error at CMakeLists.txt:19 (find_package):
  By not providing "FindMicrosoft.GSL.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Microsoft.GSL", but CMake did not find one.

  Could not find a package configuration file provided by "Microsoft.GSL"
  with any of the following names:

    Microsoft.GSLConfig.cmake
    microsoft.gsl-config.cmake

  Add the installation prefix of "Microsoft.GSL" to CMAKE_PREFIX_PATH or set
  "Microsoft.GSL_DIR" to a directory containing one of the above files.  If
  "Microsoft.GSL" provides a separate development package or SDK, be sure it
  has been installed.


-- Configuring incomplete, errors occurred!

Don't throw exception of built-in types

During the review of #30 , @menuet correctly observed there is existing code that violated Core Guidelines E.14. That should have been caught before it was checked in. Upon further logic inspection, it looks like that the Reader constructor was detecting too late an erroneous condition. Move that detection earlier, at the very minimum, at the site of the Reader object construction.

About IFC's Automatic LOD

Hello developer, I would like to ask if there is a tool that can automatically classify IFC into LOD levels, or if you have a good idea about classifying IFC into LOD levels. Thank you

assertion failure: `byte_offset < contents.size()` when parsing header units for standard headers

Issue

I am trying to print (using ifc-printer) the "header unit" IFCs for some standard headers (e.g., vector). These have been generated as follows:

cl.exe /std:c++latest /exportHeader /headerName:angle /EHsc /MD vector

If I then try to parse vector.ifc with ifc-printer, I get:

~/clones/ifc/build/ifc-printer vector.ifc
assertion failure: ``byte_offset < contents.size()'' in file ``/home/avj/clones/ifc/include/ifc/reader.hxx'' at line 32

Inside of gdb, here's what those expressions look like:

Breakpoint 1.12, ifc::Reader::view_entry_at<ifc::symbolic::AliasDecl> (this=0x7fffffffbcd0, offset=(unknown: 0x9e024)) at /home/avj/clones/ifc/include/ifc/reader.hxx:32
32                  IFCASSERT(byte_offset < contents.size());
Missing separate debuginfos, use: zypper install libgcc_s1-debuginfo-14.0.1+git8957-1.2.x86_64 liblzma5-x86-64-v3-debuginfo-5.4.6-1.2.x86_64 libstdc++6-debuginfo-14.0.1+git8957-1.2.x86_64 libtcmalloc4-debuginfo-2.15-1.2.x86_64
(gdb) p byte_offset
$1 = 647204
(gdb) p contents.size()
$2 = 5933456

The following files:

algorithm.ifc
any.ifc
array.ifc
atomic.ifc
bit.ifc
bitset.ifc
codecvt.ifc
deque.ifc
execution.ifc
format.ifc
forward_list.ifc
future.ifc
iosfwd.ifc
list.ifc
locale.ifc
map.ifc
mdspan.ifc
memory_resource.ifc
mutex.ifc
new.ifc
optional.ifc
queue.ifc
ranges.ifc
scoped_allocator.ifc
shared_mutex.ifc
string.ifc
string_view.ifc
syncstream.ifc
thread.ifc
tuple.ifc
typeindex.ifc
variant.ifc
vector.ifc
xmemory.ifc
xutility.ifc

All crash with the same message.

Some specifics

MSVC version

Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33521 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

Compiler Passes:
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\cl.exe:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1.dll:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll:      Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c2.dll:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll:      Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\link.exe:      Version 14.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\mspdb140.dll:  Version 14.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\1033\clui.dll: Version 19.40.33521.0

cl : Command line error D8003 : missing source filename

ifc version

git rev-parse --short HEAD
610da21

Host machine

avj@pika ~/clones/ifc$ uname -a
Linux pika 6.7.7-1-default #1 SMP PREEMPT_DYNAMIC Fri Mar  1 13:51:21 UTC 2024 (1ff84c5) x86_64 x86_64 x86_64 GNU/Linux

avj@pika ~/clones/ifc$ lsb-release -a
LSB Version:    n/a
Distributor ID: openSUSE
Description:    openSUSE Tumbleweed
Release:        20240302
Codename:       n/a

avj@pika ~/clones/ifc$ ldd --version
ldd (GNU libc) 2.39
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

avj@pika ~/clones/ifc$ gcc --version
gcc (SUSE Linux) 10.4.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Issue

Some specifics

MSVC version

Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33521 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

Compiler Passes:
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\cl.exe:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1.dll:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll:      Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c2.dll:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll:      Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\link.exe:      Version 14.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\mspdb140.dll:  Version 14.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\1033\clui.dll: Version 19.40.33521.0

cl : Command line error D8003 : missing source filename

ifc version

git rev-parse --short HEAD
610da21

Host machine

avj@pika ~/clones/ifc$ uname -a
Linux pika 6.7.7-1-default #1 SMP PREEMPT_DYNAMIC Fri Mar  1 13:51:21 UTC 2024 (1ff84c5) x86_64 x86_64 x86_64 GNU/Linux

avj@pika ~/clones/ifc$ lsb-release -a
LSB Version:    n/a
Distributor ID: openSUSE
Description:    openSUSE Tumbleweed
Release:        20240302
Codename:       n/a

avj@pika ~/clones/ifc$ ldd --version
ldd (GNU libc) 2.39
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

avj@pika ~/clones/ifc$ gcc --version
gcc (SUSE Linux) 10.4.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Unit tests

Hi,
While trying to contribute #52, I was wondering how I could add a unit test accordingly (add a sample ifc file provoking InvalidPartitionName and catching the exception, for instance).
But I don't see any unit tests in the project.
What is the currently recommended testing process?

assertion failure: `ifc::to_underlying(s) < std::size(table)` when parsing header units for standard headers

Issue

I am trying to print (using ifc-printer) the "header unit" IFCs for some standard headers (e.g., filesystem). These have been generated as follows:

cl.exe /std:c++latest /exportHeader /headerName:angle /EHsc /MD filesystem

If I then try to parse filesystem.ifc with ifc-printer, I get:

~/clones/ifc/build/ifc-printer filesystem.ifc
assertion failure: ``ifc::to_underlying(s) < std::size(table)'' in file ``/home/avj/clones/ifc/src/sgraph.cxx'' at line 625

Inside of gdb, here's what the stack looks like (I cant print ifc::to_underlying(s)):

#0  ifc::(anonymous namespace)::retrieve_name<ifc::(anonymous namespace)::declsort_table, ifc::DeclSort> (s=ifc::DeclSort::Alias) at /home/avj/clones/ifc/src/sgraph.cxx:625
#1  0x000055555559cb54 in ifc::sort_name (s=ifc::DeclSort::Alias) at /home/avj/clones/ifc/src/sgraph.cxx:632
#2  0x000055555557a072 in ifc::util::to_string<ifc::DeclIndex> (index=...) at /home/avj/clones/ifc/include/ifc/util.hxx:48
#3  0x0000555555571ad5 in ifc::util::load (ctx=..., node=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:399
#4  0x0000555555563f7a in ifc::util::Loader::get<ifc::DeclIndex> (this=0x7fffffffbc50, abstract_index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#5  0x0000555555571602 in ifc::util::load (ctx=..., node=..., index=(unknown: 0x1)) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:17
#6  0x000055555556291a in ifc::util::Loader::get<ifc::ScopeIndex> (this=0x7fffffffbc50, abstract_index=(unknown: 0x1)) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#7  0x000055555555edf1 in process_ifc (name="filesystem.ifc", options=ifc::util::PrintOptions::None) at /home/avj/clones/ifc/src/ifc-printer/main.cxx:118
#8  0x000055555555efd4 in main (argc=2, argv=0x7fffffffd638) at /home/avj/clones/ifc/src/ifc-printer/main.cxx:143

The following files:

exception.ifc
expected.ifc
filesystem.ifc
fstream.ifc
latch.ifc
numeric.ifc
set.ifc
span.ifc
stack.ifc
stacktrace.ifc
stdexcept.ifc
typeinfo.ifc
xstring.ifc

All crash with the same message.

Some specifics

MSVC version

Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33521 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

Compiler Passes:
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\cl.exe:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1.dll:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll:      Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c2.dll:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll:      Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\link.exe:      Version 14.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\mspdb140.dll:  Version 14.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\1033\clui.dll: Version 19.40.33521.0

cl : Command line error D8003 : missing source filename

ifc version

git rev-parse --short HEAD
610da21

Host machine

avj@pika ~/clones/ifc$ uname -a
Linux pika 6.7.7-1-default #1 SMP PREEMPT_DYNAMIC Fri Mar  1 13:51:21 UTC 2024 (1ff84c5) x86_64 x86_64 x86_64 GNU/Linux

avj@pika ~/clones/ifc$ lsb-release -a
LSB Version:    n/a
Distributor ID: openSUSE
Description:    openSUSE Tumbleweed
Release:        20240302
Codename:       n/a

avj@pika ~/clones/ifc$ ldd --version
ldd (GNU libc) 2.39
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

avj@pika ~/clones/ifc$ gcc --version
gcc (SUSE Linux) 10.4.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Issue

Some specifics

MSVC version

Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33521 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

Compiler Passes:
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\cl.exe:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1.dll:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll:      Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c2.dll:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll:      Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\link.exe:      Version 14.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\mspdb140.dll:  Version 14.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\1033\clui.dll: Version 19.40.33521.0

cl : Command line error D8003 : missing source filename

ifc version

git rev-parse --short HEAD
610da21

Host machine

avj@pika ~/clones/ifc$ uname -a
Linux pika 6.7.7-1-default #1 SMP PREEMPT_DYNAMIC Fri Mar  1 13:51:21 UTC 2024 (1ff84c5) x86_64 x86_64 x86_64 GNU/Linux

avj@pika ~/clones/ifc$ lsb-release -a
LSB Version:    n/a
Distributor ID: openSUSE
Description:    openSUSE Tumbleweed
Release:        20240302
Codename:       n/a

avj@pika ~/clones/ifc$ ldd --version
ldd (GNU libc) 2.39
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

avj@pika ~/clones/ifc$ gcc --version
gcc (SUSE Linux) 10.4.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Apparent stack overflow when parsing simple example

Issue

I have the following example:

export module hello;

import std.core;

export namespace hello {
  void say_hello(uint32_t count);
}

which I compile as follows:

cl.exe /W4 /WX /experimental:module /interface /sourceDependencies . /std:c++latest /EHsc /MD /c hello.cpp

If I then try to parse hello.ifc with ifc-printer, I get:

scope-1
\-decl.scope-0 'namespace' hello reachable(initializer)
  \-scope-2
    \-decl.function-0 'void(decl-type(decl.reference-0))' say_hello home-scope(decl.scope-0) public external
      \-chart.unilevel
        \-decl.parameter-0 'decl-type(decl.reference-0)'
decl.reference-0 std.core decl.alias-22
[5]    27025 segmentation fault (core dumped)  ~/clones/ifc/build/ifc-printer hello.ifc

Inside of gdb, here's what the backtrace looks like:

#0  0x000055555557ad24 in index_like::null<ifc::TypeIndex> (t=<error reading variable: Cannot access memory at address 0x7fffff7feffc>)
    at /home/avj/clones/ifc/include/ifc/index-utils.hxx:65
#1  0x00005555555742b8 in ifc::util::Loader::ref<ifc::TypeIndex> (this=0x7fffffffbc40, index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:220
#2  0x0000555555598d51 in ifc::util::(anonymous namespace)::TypeTranslator::operator() (this=0x7fffff7ff1a8, type=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:139
#3  0x0000555555599371 in ifc::Reader::visit<ifc::util::(anonymous namespace)::TypeTranslator> (this=0x7fffffffbcb0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:187
#4  0x0000555555599468 in ifc::util::get_string_if_possible[abi:cxx11](ifc::util::Loader&, ifc::TypeIndex) (ctx=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:163
#5  0x0000555555574317 in ifc::util::Loader::ref<ifc::TypeIndex> (this=0x7fffffffbc40, index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:223
#6  0x0000555555598d51 in ifc::util::(anonymous namespace)::TypeTranslator::operator() (this=0x7fffff7ff358, type=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:139
#7  0x0000555555599371 in ifc::Reader::visit<ifc::util::(anonymous namespace)::TypeTranslator> (this=0x7fffffffbcb0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:187
#8  0x0000555555599468 in ifc::util::get_string_if_possible[abi:cxx11](ifc::util::Loader&, ifc::TypeIndex) (ctx=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:163
#9  0x0000555555574317 in ifc::util::Loader::ref<ifc::TypeIndex> (this=0x7fffffffbc40, index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:223
#10 0x0000555555598d51 in ifc::util::(anonymous namespace)::TypeTranslator::operator() (this=0x7fffff7ff508, type=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:139
#11 0x0000555555599371 in ifc::Reader::visit<ifc::util::(anonymous namespace)::TypeTranslator> (this=0x7fffffffbcb0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:187
#12 0x0000555555599468 in ifc::util::get_string_if_possible[abi:cxx11](ifc::util::Loader&, ifc::TypeIndex) (ctx=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:163
#13 0x0000555555574317 in ifc::util::Loader::ref<ifc::TypeIndex> (this=0x7fffffffbc40, index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:223
#14 0x0000555555598d51 in ifc::util::(anonymous namespace)::TypeTranslator::operator() (this=0x7fffff7ff6b8, type=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:139
#15 0x0000555555599371 in ifc::Reader::visit<ifc::util::(anonymous namespace)::TypeTranslator> (this=0x7fffffffbcb0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:187
#16 0x0000555555599468 in ifc::util::get_string_if_possible[abi:cxx11](ifc::util::Loader&, ifc::TypeIndex) (ctx=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:163
#17 0x0000555555574317 in ifc::util::Loader::ref<ifc::TypeIndex> (this=0x7fffffffbc40, index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:223
<snip snip ... goes on forever>

Some specifics

MSVC version

Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33521 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

Compiler Passes:
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\cl.exe:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1.dll:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll:      Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c2.dll:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll:      Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\link.exe:      Version 14.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\mspdb140.dll:  Version 14.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\1033\clui.dll: Version 19.40.33521.0

cl : Command line error D8003 : missing source filename

ifc version

git rev-parse --short HEAD
610da21

Host machine

avj@pika ~/clones/ifc$ uname -a
Linux pika 6.7.7-1-default #1 SMP PREEMPT_DYNAMIC Fri Mar  1 13:51:21 UTC 2024 (1ff84c5) x86_64 x86_64 x86_64 GNU/Linux

avj@pika ~/clones/ifc$ lsb-release -a
LSB Version:    n/a
Distributor ID: openSUSE
Description:    openSUSE Tumbleweed
Release:        20240302
Codename:       n/a

avj@pika ~/clones/ifc$ ldd --version
ldd (GNU libc) 2.39
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

avj@pika ~/clones/ifc$ gcc --version
gcc (SUSE Linux) 10.4.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Static analysis in CI

The contributing document suggests that contributors ought to format the code before submission, however there is no enforcement in CI. I would like to add it to the CI, however it's not stated which version of clang-format should be used. Different versions of clang-format may format some code differently, so it's important to specify the version.

On the same note, I'd like to also know your opinions on other forms of static analysis, such as spell checking. I have been using codespell personally. If you find it satisfactory, I'd also like to add that in the same PR.

To make efficient use of CI resources, I would like to structure CI as a single file with such job and matrix configuration:

flowchart
    A["clang-format
    codespell"]
    B["CMake (Windows)
    CMake (Ubuntu)"]
    C["CodeQL (Windows)
    CodeQL (Ubuntu)"]
    A --> B
    A --> C

You can see this example, where nothing else is done until the lint job is done.

Making this chart also makes me question whether the separate CMake jobs are necessary with CodeQL jobs being a thing.

Packaging (vcpkg, etc)

Once there is a 0.43.1 tag, I think it'd be time to prepare a vcpkg port for the project for easy consumption.

Since the package name for the CMake package followed the GSL pattern, should this project also be packaged as ms-ifc? Maybe even ms-ifc-sdk?

Invalid string construction in `ifc::util::(anonymous namespace)::ExprLoader::operator()`

Issue

I am trying to print (using ifc-printer) the "header unit" IFCs for some standard headers (e.g., vector). These have been generated as follows:

cl.exe /std:c++latest /exportHeader /headerName:angle /EHsc /MD ${NAME}

For the following files:

chrono.ifc
compare.ifc
concepts.ifc
coroutine.ifc
cstddef.ifc
initializer_list.ifc
iterator.ifc
numbers.ifc
random.ifc
ratio.ifc
type_traits.ifc
xlocinfo.ifc

They all crash with the following stack trace:

#0  0x00007ffff756f5ed in __strlen_avx2 () from /lib64/libc.so.6
#1  0x000055555555f201 in std::char_traits<char>::length (__s=0x5556440f0740 <error: Cannot access memory at address 0x5556440f0740>) at /usr/include/c++/13/bits/char_traits.h:399
#2  0x0000555555560e92 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> > (this=0x55555649a820, __s=0x5556440f0740 <error: Cannot access memory at address 0x5556440f0740>, __a=...) at /usr/include/c++/13/bits/basic_string.h:648
#3  0x0000555555592ca7 in std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::pair<char const (&) [7], char const*> (this=0x55555649a800, __x=..., __y=@0x7fffffffafc8: 0x5556440f0740 <error: Cannot access memory at address 0x5556440f0740>) at /usr/include/c++/13/bits/stl_pair.h:317
#4  0x0000555555592850 in std::construct_at<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char const (&) [7], char const*> (__location=0x55555649a800) at /usr/include/c++/13/bits/stl_construct.h:97
#5  0x00005555555922c5 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::construct<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char const (&) [7], char const*> (__p=0x55555649a800, __a=...) at /usr/include/c++/13/bits/alloc_traits.h:540
#6  std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >,
std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>
> > > >::_M_construct_node<char const (&) [7], char const*> (this=0x555556499810, __node=0x55555649a7e0) at /usr/include/c++/13/bits/stl_tree.h:597
#7  0x0000555555591bea in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_create_node<char const (&) [7], char const*> (this=0x555556499810) at /usr/include/c++/13/bits/stl_tree.h:614
#8  0x00005555555917cc in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_Auto_node::_Auto_node<char const (&) [7], char const*> (this=0x7fffffffaea0, __t=...) at /usr/include/c++/13/bits/stl_tree.h:1637
#9  0x000055555558ebdc in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_emplace_unique<char const (&) [7], char const*> (this=0x555556499810) at /usr/include/c++/13/bits/stl_tree.h:2434
#10 0x000055555558c6f5 in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::emplace<char const (&) [7], char const*> (this=0x555556499810) at /usr/include/c++/13/bits/stl_map.h:608
#11 0x000055555558881b in ifc::util::(anonymous namespace)::ExprLoader::operator() (this=0x7fffffffb0c0, expr=...) at /home/avj/clones/ifc/src/ifc-dom/exprs.cxx:200
#12 0x00005555555899ea in ifc::Reader::visit<ifc::util::(anonymous namespace)::ExprLoader> (this=0x7fffffffbcd0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:330
#13 0x0000555555589f5e in ifc::util::load (ctx=..., node=..., expr=...) at /home/avj/clones/ifc/src/ifc-dom/exprs.cxx:355
#14 0x0000555555589fb4 in ifc::util::load (ctx=..., node=..., index=2275) at /home/avj/clones/ifc/src/ifc-dom/exprs.cxx:360
#15 0x000055555558157c in ifc::util::Loader::get<ifc::symbolic::DefaultIndex> (this=0x7fffffffbc60, abstract_index=2275) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#16 0x000055555557c5d2 in ifc::util::load_initializer<ifc::symbolic::DefaultIndex> (ctx=..., n=..., index=2275) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:47
#17 0x0000555555576239 in ifc::util::load_common_props<ifc::symbolic::ParameterDecl> (ctx=..., n=..., val=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:134
#18 0x00005555555725c4 in ifc::util::DeclLoader::operator() (this=0x7fffffffb340, param=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:210
#19 0x0000555555573953 in ifc::Reader::visit_with_index<ifc::util::DeclLoader&> (this=0x7fffffffbcd0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:255
#20 0x0000555555571b20 in ifc::util::load (ctx=..., node=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:401
#21 0x0000555555563f7a in ifc::util::Loader::get<ifc::DeclIndex> (this=0x7fffffffbc60, abstract_index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#22 0x000055555556fe94 in ifc::util::Loader::get<ifc::symbolic::ParameterDecl> (this=0x7fffffffbc60, decl=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:255
#23 0x000055555556f522 in ifc::util::load (ctx=..., node=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/charts.cxx:27
#24 0x000055555556f3fb in ifc::util::Loader::try_get (this=0x7fffffffbc60, index=...) at /home/avj/clones/ifc/src/ifc-dom/charts.cxx:15
#25 0x00005555555729c7 in ifc::util::DeclLoader::operator() (this=0x7fffffffb640, decl_index=..., decl=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:278
#26 0x0000555555573ac6 in ifc::Reader::visit_with_index<ifc::util::DeclLoader&> (this=0x7fffffffbcd0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:262
#27 0x0000555555571b20 in ifc::util::load (ctx=..., node=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:401
#28 0x0000555555563f7a in ifc::util::Loader::get<ifc::DeclIndex> (this=0x7fffffffbc60, abstract_index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#29 0x0000555555571602 in ifc::util::load (ctx=..., node=..., index=(unknown: 0x2)) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:17
#30 0x000055555556291a in ifc::util::Loader::get<ifc::ScopeIndex> (this=0x7fffffffbc60, abstract_index=(unknown: 0x2)) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#31 0x000055555557c32e in ifc::util::load_initializer<ifc::ScopeIndex> (ctx=..., n=..., index=(unknown: 0x2)) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:47
#32 0x000055555557576f in ifc::util::load_common_props<ifc::symbolic::ScopeDecl> (ctx=..., n=..., val=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:134
#33 0x0000555555572505 in ifc::util::DeclLoader::operator() (this=0x7fffffffba90, decl_index=..., udt=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:193
#34 0x00005555555739f2 in ifc::Reader::visit_with_index<ifc::util::DeclLoader&> (this=0x7fffffffbcd0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:258
#35 0x0000555555571b20 in ifc::util::load (ctx=..., node=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:401
#36 0x0000555555563f7a in ifc::util::Loader::get<ifc::DeclIndex> (this=0x7fffffffbc60, abstract_index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#37 0x0000555555571602 in ifc::util::load (ctx=..., node=..., index=(unknown: 0x1)) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:17
#38 0x000055555556291a in ifc::util::Loader::get<ifc::ScopeIndex> (this=0x7fffffffbc60, abstract_index=(unknown: 0x1)) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#39 0x000055555555edf1 in process_ifc (name="xlocinfo.ifc", options=ifc::util::PrintOptions::None) at /home/avj/clones/ifc/src/ifc-printer/main.cxx:118
#40 0x000055555555efd4 in main (argc=2, argv=0x7fffffffd648) at /home/avj/clones/ifc/src/ifc-printer/main.cxx:143

Some specifics

MSVC version

Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33521 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

Compiler Passes:
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\cl.exe:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1.dll:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll:      Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c2.dll:        Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll:      Version 19.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\link.exe:      Version 14.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\mspdb140.dll:  Version 14.40.33521.0
 Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\1033\clui.dll: Version 19.40.33521.0

cl : Command line error D8003 : missing source filename

ifc version

git rev-parse --short HEAD
610da21

Host machine

avj@pika ~/clones/ifc$ uname -a
Linux pika 6.7.7-1-default #1 SMP PREEMPT_DYNAMIC Fri Mar  1 13:51:21 UTC 2024 (1ff84c5) x86_64 x86_64 x86_64 GNU/Linux

avj@pika ~/clones/ifc$ lsb-release -a
LSB Version:    n/a
Distributor ID: openSUSE
Description:    openSUSE Tumbleweed
Release:        20240302
Codename:       n/a

avj@pika ~/clones/ifc$ ldd --version
ldd (GNU libc) 2.39
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

avj@pika ~/clones/ifc$ gcc --version
gcc (SUSE Linux) 10.4.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Determine package interface

The current CMake files do not support reuse by clients due to the missing install rules and missing CMake package. I would like to know what would be the way for people to consume this SDK.

Being careful not to cause potential name conflicts with packages dealing with CAD applications' Industry Foundation Classes (.ifc), I think this would be one way for a consumer to use this SDK:

# the package name is MicrosoftIFC, found in e.g. <prefix>/lib/cmake/MicrosoftIFC
find_package(MicrosoftIFC REQUIRED)

# the SDK target is an interface target that link both ifc-dom and ifc-reader, as a convenient all in one target
target_link_libraries(AwesomeIFCConsumer PRIVATE MicrosoftIFC::SDK)

I would like to work on this once the requirements are known.

Raise minimum required CMake version to 3.27

That allows requesting build of main branch with C++23, and conformance mode for MSVC and reducing /Zc flags soup. Furthermore, that allows modular experiments with close to main baseline.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.