Skip to content

Instantly share code, notes, and snippets.

View EricWF's full-sized avatar

Eric EricWF

View GitHub Profile

Introduction

This document provides a detailed exploration of how C++ standard library headers are used when building, testing, and using the LLVM libc++ library. It covers the different types of headers involved, the main header layouts used, and the importance of include paths and how they are constructed. It also dives into the specific include paths used in key scenarios on Linux and Apple platforms. The goal is to explain the key concepts and complexities around libc++ headers to support informed decision making about the library's header layout.

The Headers

There are several types of headers involved in the libc++ library:

v4l2-compliance SHA: not available, 64 bits
Compliance test for uvcvideo device /dev/video0:
Driver Info:
Driver name : uvcvideo
Card type : Live Streaming USB Device: Live
Bus info : usb-0000:00:14.0-6
Driver version : 5.2.17
Capabilities : 0x84a00001
// RUN: $CXX -c %s -o /tmp/first.o -std=c++17 -g
// RUN: $CXX -c %s -o /tmp/second.o -std=c++17 -g -DWITH_MAIN
// RUN: $CXX -o /tmp/test.out /tmp/first.o /tmp/second.o
// RUN: /tmp/test.out
#include <cassert>
#define ABSL_INTERNAL_UNIQUE_SMALL_NAME2(x) #x
#define ABSL_INTERNAL_UNIQUE_SMALL_NAME1(x) ABSL_INTERNAL_UNIQUE_SMALL_NAME2(x)
#define ABSL_INTERNAL_UNIQUE_SMALL_NAME() \
// RUN: $CXX -c %s -o /tmp/first.o -std=c++17 -g
// RUN: $CXX -c %s -o /tmp/second.o -std=c++17 -g -DWITH_MAIN
// RUN: $CXX -o /tmp/test.out /tmp/first.o /tmp/second.o
// RUN: /tmp/test.out
#include <cassert>
namespace {
__attribute__((noinline))
int bar() asm(".my-name");
#ifdef SYS_HEADER
#pragma GCC system_header
#endif
template <class Ret, class Fn, class ...Args>
constexpr Ret foo(Fn fn, Args... args) { return fn(args...); }
3946218306
62183069
32000 : __front_spare() == 384 : __back_spare() == 383 : __capacity() == 32767 : bytes allocated == 32840
31000 : __front_spare() == 884 : __back_spare() == 883 : __capacity() == 32767 : bytes allocated == 32840
30000 : __front_spare() == 1384 : __back_spare() == 1383 : __capacity() == 32767 : bytes allocated == 32840
29000 : __front_spare() == 1884 : __back_spare() == 1883 : __capacity() == 32767 : bytes allocated == 32840
28000 : __front_spare() == 2384 : __back_spare() == 2383 : __capacity() == 32767 : bytes allocated == 32840
27000 : __front_spare() == 2884 : __back_spare() == 2883 : __capacity() == 32767 : bytes allocated == 32840
26000 : __front_spare() == 3384 : __back_spare() == 3383 : __capacity() == 32767 : bytes allocated == 32840
25000 : __front_spare() == 3884 : __back_spare() == 3883 : __capacity() == 32767 : bytes allocated == 32840
24000 : __front_spare() == 288 : __back_spare() == 287 : __capacity() == 24575 : bytes allocated == 24648
23000 : __front_spare() == 788 : __back_spare() == 787 : _
Passing Tests (481):
libc++ :: std/algorithms/alg.c.library/tested_elsewhere.pass.cpp
libc++ :: std/atomics/atomics.fences/atomic_signal_fence.pass.cpp
libc++ :: std/atomics/atomics.fences/atomic_thread_fence.pass.cpp
libc++ :: std/atomics/atomics.flag/atomic_flag_clear.pass.cpp
libc++ :: std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
libc++ :: std/atomics/atomics.flag/atomic_flag_test_and_set.pass.cpp
libc++ :: std/atomics/atomics.flag/atomic_flag_test_and_set_explicit.pass.cpp
libc++ :: std/atomics/atomics.flag/clear.pass.cpp
// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fresumable-functions -emit-llvm -o - %s -fexceptions -std=c++17 | FileCheck %s
resumable int foo() {
return 42;
}
void bar() {
resumable auto r = foo();
bool b = r.ready();
int x = r.result();
@EricWF
EricWF / DefaultInitIssue.md
Last active July 10, 2018 23:41
Fixes for the specification of default-initialization and value-initialization.

Unify the behavior of value-initialization and default-initialization.

Introduction

Currently default-initialization and value-initialization act bizzarely compared to each other. Specifically default-initialization is required to call trivial constructors when value-initialization is not.

For example:

struct T { int x; };
// default_init is initialized by a call to the trivial default ctor.