Commit d1536673 authored by Siva Chandra Reddy's avatar Siva Chandra Reddy
Browse files

[libc] Add ability to generate enum types/values to HdrGen.

A target to generate the std C threads.h file has been added. This
utilizes the new feature added in this change.

Reviewers: phosek

Differential Revision: https://reviews.llvm.org/D75379
parent 95fa5c4f
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -143,3 +143,16 @@ def SignalAPI : PublicAPI<"signal.h"> {
    "raise",
  ];
}

def ThreadsAPI : PublicAPI<"threads.h"> {
  let Enumerations = [
    "mtx_plain",
    "mtx_recursive",
    "mtx_timed",
    "thrd_timedout",
    "thrd_success",
    "thrd_busy",
    "thrd_error",
    "thrd_nomem",
  ];
}
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ class PublicAPI<string name> {
  string HeaderName = name;
  list<MacroDef> Macros = [];
  list<TypeDecl> TypeDeclarations = [];
  list<string> Enumerations = [];
  list<string> Structs = [];
  list<string> Functions = [];
}
+8 −0
Original line number Diff line number Diff line
@@ -35,6 +35,14 @@ add_gen_header(
    llvm_libc_common_h
)

add_gen_header(
  threads_h
  DEF_FILE threads.h.def
  GEN_HDR threads.h
  DEPENDS
    llvm_libc_common_h
)

add_gen_header(
  errno_h
  DEF_FILE errno.h.def
+16 −0
Original line number Diff line number Diff line
//===---------------- C standard library header threads.h -----------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_THREADS_H
#define LLVM_LIBC_THREADS_H

#include <__llvm-libc-common.h>

%%public_api()

#endif // LLVM_LIBC_THREADS_H
+3 −9
Original line number Diff line number Diff line
@@ -55,16 +55,12 @@ def Linux : StandardSpec<"Linux"> {
        Macro<"EL2NSYNC">,
        Macro<"EADV">,
        Macro<"ECOMM">,
      ],
      [], // Types
      []  // Functions
      ]
  >;

  HeaderSpec SysMMan = HeaderSpec<
      "sys/mman.h",
      [Macro<"MAP_ANONYMOUS">],
      [], // Types
      []  // Functions
      [Macro<"MAP_ANONYMOUS">]
  >;

  HeaderSpec Signal = HeaderSpec<
@@ -106,9 +102,7 @@ def Linux : StandardSpec<"Linux"> {
        Macro<"SIGPWR">,
        Macro<"SIGSYS">,
        Macro<"SIGUNUSED">,
      ],
      [], // Types
      []  // Functions
      ]
  >;

  let Headers = [
Loading