sandboxed-api/sandboxed_api/tools/clang_generator
Christian Blichmann 1ae04ac332 clang_generator: Use fully-qualified names, emit in source order
When generating headers from libraries that export functions as `extern "C"`
but still use namespaces (C-compatible C++ libraries), we want to generate
a Sandboxed API that includes fully-qualified namespace names as well.

In addition, we want the generated API to have the same source order as the
original library. Not only is this less surprising when reading the generated
code, it's also more accurate. Previously, we'd bundle all definitions in a
namespace and sort those alphabetically, but for code that relies on symbols
from another namespace to be available, generation will fail:

```c++
namespace zzz {
using entity_count_t = uint64_t;
}  // namespace zzz
namespace sheep_counter {
using sheep_count_t = :💤:entity_count_t;
extern "C" void IncreaseSheepCounter(sheep_count_t increment);
}  // namespace sheep_counter
```

PiperOrigin-RevId: 486586024
Change-Id: I419c9db8e9cb5b904364b353e2dc3d7f1030fab3
2022-11-07 00:37:53 -08:00
..
BUILD.bazel clang_generator: Use fully-qualified names, emit in source order 2022-11-07 00:37:53 -08:00
CMakeLists.txt clang_generator: Use fully-qualified names, emit in source order 2022-11-07 00:37:53 -08:00
compilation_database.cc clang_generator: Enable mixed header processing 2022-03-17 03:41:53 -07:00
compilation_database.h clang_generator: Enable mixed header processing 2022-03-17 03:41:53 -07:00
diagnostics.cc clang_generator: Turn fatal error on struc-by-value into warning 2022-11-03 06:02:32 -07:00
diagnostics.h clang_generator: Turn fatal error on struc-by-value into warning 2022-11-03 06:02:32 -07:00
emitter_test.cc clang_generator: Use fully-qualified names, emit in source order 2022-11-07 00:37:53 -08:00
emitter.cc clang_generator: Use fully-qualified names, emit in source order 2022-11-07 00:37:53 -08:00
emitter.h clang_generator: Use fully-qualified names, emit in source order 2022-11-07 00:37:53 -08:00
frontend_action_test_util.cc clang_generator: Do not collect structs/unions if declared in another record 2022-03-17 03:30:12 -07:00
frontend_action_test_util.h clang_generator: Refactor frontend test utilities 2022-11-01 09:00:34 -07:00
generator_tool.cc #Cleanup: Consistently use std::make_unique 2022-10-12 05:23:42 -07:00
generator.cc clang_generator: Turn fatal error on struc-by-value into warning 2022-11-03 06:02:32 -07:00
generator.h clang_generator: Refactor frontend test utilities 2022-11-01 09:00:34 -07:00
types.cc clang_generator: Use fully-qualified names, emit in source order 2022-11-07 00:37:53 -08:00
types.h clang_generator: Use fully-qualified names, emit in source order 2022-11-07 00:37:53 -08:00