1118 Commits

Author SHA1 Message Date
David Tolnay
7c6ac7195e
Add copy assignment operator for Error 2020-10-31 17:24:32 -07:00
David Tolnay
e58f4270ed
Merge pull request #389 from dtolnay/error
Fill in Error base class constructor calls
2020-10-31 17:22:36 -07:00
David Tolnay
23c2319bc8
Fill in Error base class constructor calls 2020-10-31 17:11:48 -07:00
David Tolnay
d5712ee32c
Use member initializer lists for Error constructors 2020-10-31 17:10:00 -07:00
David Tolnay
59c5dc2891
Merge pull request #388 from dtolnay/error
Decouple Error from Str::Repr
2020-10-31 17:09:02 -07:00
David Tolnay
d68dfa8ee7
Decouple exception catch from Str::Repr 2020-10-31 16:59:29 -07:00
David Tolnay
84ddf9e27f
Move "impl" into anonymous namespace 2020-10-31 16:59:29 -07:00
David Tolnay
a0c9bc7167
Decouple Error from Str::Repr
It was misleading to use Str (which ordinarily represents borrowed
strings) also for owned error messages.
2020-10-31 16:59:29 -07:00
David Tolnay
5b41479aeb
Fix stray delete in Error move constructor 2020-10-31 16:58:14 -07:00
David Tolnay
504cf3cfb8
Fix unqualified strncpy call 2020-10-31 16:09:18 -07:00
David Tolnay
cc1ae76bd0
Remove redundant header branch from write_cxx_function_shim
These shims only get emitted in the non-header case in the first place.
2020-10-31 15:53:53 -07:00
David Tolnay
4852122f35
Fill in some missing final specifiers 2020-10-31 14:59:42 -07:00
David Tolnay
a53086ba51
Merge pull request #387 from dtolnay/trivial
Guarantee trivial copy constructor and destructor for Str and Slice
2020-10-31 12:31:50 -07:00
David Tolnay
de9a5b12b3
Guarantee trivial copy constructor and destructor for Str and Slice
Repro:

    const char *ptr(Str str) { return str.repr.ptr; }
    size_t len(Str str) { return str.repr.len; }

Before:

    ptr(Str):
        mov     rax, qword ptr [rdi]
        ret
    len(Str):
        mov     rax, qword ptr [rdi + 8]
        ret

After:

    ptr(Str):
        mov     rax, rdi
        ret
    len(Str):
        mov     rax, rsi
        ret
2020-10-31 12:17:42 -07:00
David Tolnay
cedcde1ddd
Fill in missing const on operator Repr 2020-10-31 11:47:14 -07:00
David Tolnay
5fedc9a359
Use a less strange return type for NamespaceEntries::children 2020-10-30 21:46:17 -07:00
David Tolnay
a7c2ea10f1
Avoid passing Types around everywhere 2020-10-30 21:40:14 -07:00
David Tolnay
b560a0fabf
Make type information accessible through OutFile 2020-10-30 21:40:03 -07:00
David Tolnay
598154250c
Remove unneeded derives on ResolvableName 2020-10-30 21:24:05 -07:00
David Tolnay
be7e30e0c9
Clarify name struct comments 2020-10-30 21:21:23 -07:00
David Tolnay
abff2d5ed0
Rewrap name struct comments to 80 columns 2020-10-30 21:20:07 -07:00
David Tolnay
9071c264e2
Collect name-related structs to the bottom of syntax tree definition 2020-10-30 21:18:54 -07:00
David Tolnay
50de2c4813
Remove various Ident type aliases
I don't see these being particularly helpful to maintaining correctness.
Where needed, we should clarify the meaning of a field with a comment
rather than writing its type as an alias.
2020-10-30 21:16:05 -07:00
David Tolnay
bf23e3e185
Format PR 370 with clang-format 2020-10-30 21:12:50 -07:00
David Tolnay
2e5c529055
Merge pull request #385 from dtolnay/string
Add asserts to protect string construction from nullptr when building with assertions
2020-10-30 21:08:17 -07:00
David Tolnay
54b13222e2
Add asserts to protect string construction from nullptr when building with assertions 2020-10-30 20:58:44 -07:00
David Tolnay
6d431e8e24
Merge pull request #384 from dtolnay/string
Reduce duplicated checks in string construction
2020-10-30 20:58:36 -07:00
David Tolnay
032d853161
Reduce duplicated checks in string construction 2020-10-30 20:51:51 -07:00
David Tolnay
9167590318
Merge pull request #383 from dtolnay/nullempty
Match std::string's behavior on (nullptr, 0) construction
2020-10-30 20:51:26 -07:00
David Tolnay
8d32366682
Match std::string's behavior on (nullptr, 0) construction 2020-10-30 20:29:49 -07:00
David Tolnay
6791c39ec6
Merge pull request #382 from adetaylor/namespace-code-review
Namespace code review
2020-10-30 14:07:14 -07:00
Adrian Taylor
451ec9f44b Clippy fixes. 2020-10-29 22:51:30 -07:00
Adrian Taylor
7827d78f29 Add tests for namespace sorter. 2020-10-29 22:14:34 -07:00
Adrian Taylor
0f8ab22aee Improving Pair construction. 2020-10-29 21:33:49 -07:00
Adrian Taylor
0447e96b84 Revert to older error string. 2020-10-29 21:22:24 -07:00
Adrian Taylor
f2d9d86c3d Simplify test suite. 2020-10-29 21:21:30 -07:00
Adrian Taylor
565ddf035e Code review comments on namespace work. 2020-10-29 21:12:36 -07:00
David Tolnay
71b34be0be
Merge pull request #380 from adetaylor/namespaces-syntax-update
Switch to #[namespace = A::B] syntax.
2020-10-29 20:05:09 -07:00
Adrian Taylor
3e5cff4a3d Switch to #[namespace = A::B] syntax.
Thanks to sbrocket for this parsing code.
2020-10-29 19:48:45 -07:00
David Tolnay
d60c07b762
Merge pull request 370 from adetaylor/allow-namespace-override 2020-10-29 16:46:40 -07:00
David Tolnay
7b14585af9
Merge pull request #377 from dtolnay/unsupported-type
Include typename in diagnostic on unsupported type
2020-10-28 18:27:36 -07:00
David Tolnay
dbc5377e9f
Avoid repeating the underlined type in the label 2020-10-28 17:28:51 -07:00
David Tolnay
353d98cdd9
Move syntax Include to gen Include conversion to From impl 2020-10-28 15:43:35 -07:00
David Tolnay
2cc2e3a4d1
Include angle brackets in include-related errors 2020-10-28 13:48:34 -07:00
David Tolnay
faa1a7c448
Merge pull request #375 from dtolnay/include
Check for disallowed include strings in Cargo-based workflow
2020-10-28 13:48:22 -07:00
David Tolnay
75c2385e30
Check for disallowed include strings
error[cxxbridge]: #include relative to `.` or `..` is not supported in Cargo builds
       ┌─ src/main.rs:10:18
       │
    10 │         include!("../header.h");
       │                  ^^^^^^^^^^^^^ #include relative to `.` or `..` is not supported in Cargo builds
       │
       = note: use a path starting with the crate name
2020-10-28 13:41:45 -07:00
David Tolnay
d5107638a1
Merge pull request #374 from dtolnay/include
Expose IncludeKind to cxx_gen library
2020-10-28 13:41:36 -07:00
David Tolnay
700cd0c1df
Expose IncludeKind to cxx_gen library 2020-10-28 13:33:41 -07:00
David Tolnay
36b1dbac2f
Merge pull request #373 from dtolnay/include
Distinguish quoted vs bracketed includes in gen::include
2020-10-28 13:33:33 -07:00
David Tolnay
4aae7c09b7
Distinguish quoted vs bracketed includes in gen::include 2020-10-28 13:23:21 -07:00