mirror of
https://github.com/topjohnwu/cxx.git
synced 2024-11-24 04:20:02 +00:00
Include <cstddef> for size_t
This commit is contained in:
parent
a4dd952094
commit
30430f13c9
@ -30,6 +30,7 @@ fn find_line(line: &str) -> Option<usize> {
|
||||
pub struct Includes {
|
||||
custom: Vec<String>,
|
||||
pub array: bool,
|
||||
pub cstddef: bool,
|
||||
pub cstdint: bool,
|
||||
pub cstring: bool,
|
||||
pub exception: bool,
|
||||
@ -63,6 +64,9 @@ impl Display for Includes {
|
||||
if self.array {
|
||||
writeln!(f, "#include <array>")?;
|
||||
}
|
||||
if self.cstddef {
|
||||
writeln!(f, "#include <cstddef>")?;
|
||||
}
|
||||
if self.cstdint {
|
||||
writeln!(f, "#include <cstdint>")?;
|
||||
}
|
||||
|
@ -91,10 +91,11 @@ fn write_includes(out: &mut OutFile, types: &Types) {
|
||||
for ty in types {
|
||||
match ty {
|
||||
Type::Ident(ident) => match Atom::from(ident) {
|
||||
Some(U8) | Some(U16) | Some(U32) | Some(U64) | Some(Usize) | Some(I8)
|
||||
| Some(I16) | Some(I32) | Some(I64) | Some(Isize) => out.include.cstdint = true,
|
||||
Some(U8) | Some(U16) | Some(U32) | Some(U64) | Some(I8) | Some(I16) | Some(I32)
|
||||
| Some(I64) => out.include.cstdint = true,
|
||||
Some(Usize) => out.include.cstddef = true,
|
||||
Some(CxxString) => out.include.string = true,
|
||||
Some(Bool) | Some(F32) | Some(F64) | Some(RustString) | None => {}
|
||||
Some(Bool) | Some(Isize) | Some(F32) | Some(F64) | Some(RustString) | None => {}
|
||||
},
|
||||
Type::RustBox(_) => out.include.type_traits = true,
|
||||
Type::UniquePtr(_) => out.include.memory = true,
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <exception>
|
||||
#include <iosfwd>
|
||||
|
Loading…
Reference in New Issue
Block a user