Commit Graph

180 Commits

Author SHA1 Message Date
Thierry Treyer
f4a1bd3d99 Remove Primitive::Kind::Incomplete 2023-10-04 11:23:28 -06:00
Thierry Treyer
3065dd14e9 Maintain type/name of Incomplete type 2023-10-04 11:23:28 -06:00
Jake Hillion
37991140da support 0 to many config files (#371)
Summary:
Previously OID/OIL required exactly one configuration file. This change makes it so you can supply 0 or more configuration files. 0 is useful if you have pre-generated the cache or use some sort of remote generation system. 1 is useful for the common case, where you have a configuration file that describes your entire source and use just that. More are useful if you have supplemental bits of config you wish to apply/override - see the changes to the integration test framework where we do exactly this.


Test Plan:
This isn't super well tested. It works for the test cases which add features via the config or enable `codegen.ignore`.

- CI

Reviewed By: ajor

Differential Revision: D49758032

Pulled By: JakeHillion
2023-10-02 14:06:39 -06:00
Alastair Robertson
35d45c2b4f folly::sorted_vector_map: Add key-capture support 2023-09-29 11:21:41 -07:00
Alastair Robertson
fb66f3ea05 CaptureKeys: Add test for capturing object pointers 2023-09-28 19:42:49 -07:00
Alastair Robertson
5572e294f7 CaptureKeys: Add support for std::map and std::unordered_map 2023-09-28 19:42:49 -07:00
Alastair Robertson
3446339358 TypeGraph: Add KeyCapture pass 2023-09-28 19:42:49 -07:00
Alastair Robertson
0ae08addc9 TypeGraph: Add CaptureKeys node 2023-09-28 19:42:49 -07:00
Jake Hillion
edb7bf5f3f Implement Container V2 for folly::sorted_vector_set 2023-09-27 19:06:20 -07:00
Jake Hillion
8bad704d9c Implement Container V2 for fbstring 2023-09-27 18:16:36 -07:00
Alastair Robertson
bd826f9794 CodeGen: Store list of ContainerInfos in unique_ptrs for reference stability
Lots of places rely on reference stability of ContainerInfo objects
(CodeGen's deduplication, Container nodes' containerInfo_ member).

In the key capture work, we need to be able to append to this list,
which would invalidate references before this change.
2023-09-22 17:10:56 +01:00
Jake Hillion
5632738d97 make StubbedPointer an explicit C++ type 2023-09-22 11:49:50 +01:00
Jake Hillion
c766d7b572 codegen: generate enums as enum class 2023-09-20 18:13:45 +01:00
Alastair Robertson
a509354624 DrgnParser: Options should default to false
We only want to do the extra work if it's explicitly requested.

chaseRawPointers is already explicitly requested whenever it's needed
and readEnumValues currently isn't needed at all.
2023-09-19 18:32:37 +01:00
Jake Hillion
a6d74a20a6 Update to clang/llvm 15 (#342)
Summary:

Update to clang-15 compiler and libraries as clang-12 is ancient.

The changes to oilgen are necessary because the new internal toolchain is being more picky about linking PIC to PIC. In certain modes we build with PIC, but try to link a non-PIC oilgen artifact. Add the ability to build the oilgen artifacts with PIC which sorts this.

Reviewed By: ttreyer

Differential Revision: D46220858
2023-09-14 06:02:32 -07:00
Thierry Treyer
331c47705c Implement Container V2 for folly::small_vector 2023-09-08 16:34:34 +02:00
Thierry Treyer
465303cb99 Implement new container for F14ValueMap 2023-09-08 16:31:36 +02:00
Thierry Treyer
5d3aeec86d Implement new container for F14ValueSet 2023-09-08 16:31:36 +02:00
Thierry Treyer
0df6879f66 Implement Container V2 for F14FastSet 2023-09-08 16:31:36 +02:00
Thierry Treyer
a3d14d227f Implement Container V2 for F14NodeSet 2023-09-08 16:31:36 +02:00
Thierry Treyer
65fecf314a Implement Container V2 for F14VectorSet 2023-09-08 16:31:36 +02:00
Thierry Treyer
b327cf956b Implement Container V2 for F14FastMap 2023-09-07 18:47:09 +02:00
Thierry Treyer
b8e2770e2c Implement Container V2 for F14NodeMap 2023-09-07 18:47:09 +02:00
Thierry Treyer
d2a40b4f45 Implement Container V2 for F14VectorMap 2023-09-07 18:47:09 +02:00
Thierry Treyer
a5284549da Implement Container V2 for std::shared_ptr 2023-08-31 20:07:32 +02:00
Thierry Treyer
344023239b Add OILv2 tests for std::optional 2023-08-31 20:07:32 +02:00
Jake Hillion
a95d6f2187 add support for std::optional in treebuilder v2 2023-08-31 20:07:32 +02:00
Thierry Treyer
2699b4a665 Implement Container V2 for std::unique_ptr 2023-08-31 20:07:32 +02:00
Thierry Treyer
deb7dcdf1c Implement Container V2 for std::unordered_multiset 2023-08-30 18:45:00 +02:00
Thierry Treyer
54e01cfe27 Implement Container V2 for std::unordered_multimap 2023-08-30 18:45:00 +02:00
Thierry Treyer
7bdf72ec58 Implement Container V2 for std::unordered_map 2023-08-30 18:45:00 +02:00
Thierry Treyer
c1f322dc42 Implement Container V2 for std::unordered_set 2023-08-30 18:45:00 +02:00
Jake Hillion
d009f02ecb name contained types properly in treebuilder v2
Types within containers were previously named TODO. This sorts it out so
they're named as their most resolved type. The current implementation
skips Typedef names.
2023-08-25 16:25:14 +01:00
Thierry Treyer
1459433a50 Implement Container V2 for std::multiset 2023-08-25 16:07:10 +02:00
Thierry Treyer
f9b4d65cd8 Implement Container V2 for std::multimap 2023-08-25 16:07:10 +02:00
Thierry Treyer
19222a4fe2 Implement Container V2 for std::map 2023-08-25 15:13:55 +02:00
Alastair Robertson
03429f3da9 TypeGraph: Remove NodeTracker from the TypeGraph class
The TypeGraph class should only be responsible for storing Type nodes.
Traversing the graph and tracking which nodes have been visited should
not be included there.

Passes now take a NodeTrackerHolder as an input parameter, which
provides access to a zeroed-out NodeTracker.
2023-08-24 15:01:45 +01:00
Thierry Treyer
b8cb81e366 std::set implementation for Container V2 2023-08-24 13:57:27 +02:00
Jake Hillion
5071519e45 oil v2 2023-08-23 15:59:53 +01:00
Jake Hillion
c62fbe371d type_graph: provide inputName for all types
Type Graph deduplicates and modifies names to better fit the generated
code, for example `int32_t[4]` becomes `OIArray<int32_t, 4>` and `struct
MyStruct` might become `struct MyStruct_0`.

Add an `inputName` which better represents the original input code which
can be used when building the tree.
2023-08-18 16:58:21 +01:00
Alastair Robertson
373dbe8f6c TypeGraph: Add option to record enumerator names 2023-08-17 15:47:23 +01:00
Jake Hillion
a2f7462a5d DrgnParser: store type of template param value 2023-08-17 15:40:34 +01:00
Alastair Robertson
ff31971bd3 Printer: Use NodeIds for stable IDs when printing graphs
This removes Printer's legacy behaviour of generating an ID for each
node as it gets printed. This old method meant that if new nodes were
added to or removed from a graph, every ID after the new/removed node
would change.

Now IDs are stable so it is easier to follow specific nodes through
multiple transformation passes in CodeGen.
2023-08-16 12:19:14 +01:00
Alastair Robertson
97ba03620a TypeGraph: Convert unit tests relying on Printer to use TypeGraphParser 2023-08-14 15:01:09 +01:00
Alastair Robertson
e5a83a3a37 TopoSorterTest: Add test for value template params 2023-08-11 10:50:33 +01:00
Alastair Robertson
d45c7f4931 Flattener: Handle incomplete parent types 2023-08-02 14:29:19 +01:00
Alastair Robertson
0612159121 AlignmentCalc: Mark as packed if members are not aligned
We previously only marked as packed if there was no tail padding, which
was not a sufficient condition.

The new AlignmentCalcTest.PackedMembers test case is an example which
would previously not have been marked as packed.
2023-08-02 12:07:52 +01:00
Alastair Robertson
e9975286b2 NameGen: Fix naming of const pointers 2023-08-01 17:53:39 +01:00
Alastair Robertson
6fbb60826f
EnforceCompatibility: Stub out void pointers
CodeGen v1 does not record anything for pointers to incomplete types.
Not even the address, as is done for other pointers.

Introduce a new Primitive type "Incomplete". This behaves identically to
"Void", but allows us to tell whether a type was defined as void or if
it ended up like that because of incomplete DWARF information.
2023-07-31 14:28:05 +01:00
Alastair Robertson
7bb6791af9 AddPadding: Insert padding at the beginning of structs if necessary
This is sometimes needed now that we're removing members before adding
padding.
2023-07-27 16:01:35 +01:00