include_paths.carbon 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/uint.carbon
  6. // EXTRA-ARGS: --target=x86_64-linux-gnu
  7. //
  8. // AUTOUPDATE
  9. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/import/include_paths.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/include_paths.carbon
  13. // --- include_stddef.h
  14. // Check that include paths are properly set up when running Clang.
  15. // Clang provides <stddef.h> as a builtin header.
  16. #include <stddef.h>
  17. ptrdiff_t GetSize();
  18. // --- import_stddef_indirectly.carbon
  19. library "[[@TEST_NAME]]";
  20. import Cpp library "include_stddef.h";
  21. fn CallGetSize() -> Cpp.ptrdiff_t {
  22. return Cpp.GetSize();
  23. }
  24. // --- import_stddef_directly.carbon
  25. library "[[@TEST_NAME]]";
  26. import Cpp library "stddef.h";
  27. var n: Cpp.size_t = 42;