mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-30 22:02:41 +01:00
Keep a pointer to the Clang declaration in Carbon's function declaration and use it in Carbon mangling by calling Clang mangling. Create Clang's `MangleContext` once on demand. Part of #4666. C++ Interop Demo: ```c++ // hello_world.h void hello_world(); ``` ```c++ // hello_world.cpp #include <cstdio> void hello_world() { printf("Hello World!\n"); } ``` ``` // main.carbon library "Main"; import Cpp library "hello_world.h"; fn Run() -> i32 { Cpp.hello_world(); return 0; } ``` ```shell $ clang -c hello_world.cpp $ bazel-bin/toolchain/carbon compile main.carbon $ bazel-bin/toolchain/carbon link hello_world.o main.o --output=demo $ ./demo Hello World! ```