explicit-build-relpath.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // REQUIRES: shell
  2. //
  3. // RUN: rm -rf %t
  4. // RUN: mkdir %t
  5. // ----------------------
  6. // Build modules A and B.
  7. // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
  8. // RUN: -fmodule-name=a -emit-module %S/Inputs/explicit-build/module.modulemap -o a.pcm
  9. //
  10. // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
  11. // RUN: -fmodule-file=a.pcm \
  12. // RUN: -fmodule-name=b -emit-module %S/Inputs/explicit-build/module.modulemap -o b-rel.pcm
  13. //
  14. // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
  15. // RUN: -fmodule-file=%t/a.pcm \
  16. // RUN: -fmodule-name=b -emit-module %S/Inputs/explicit-build/module.modulemap -o b-abs.pcm
  17. // ------------------------------------------
  18. // Mix and match relative and absolute paths.
  19. // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
  20. // RUN: -I%S/Inputs/explicit-build \
  21. // RUN: -fmodule-file=%t/a.pcm \
  22. // RUN: -fmodule-file=a.pcm \
  23. // RUN: -verify %s
  24. //
  25. // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
  26. // RUN: -I%S/Inputs/explicit-build \
  27. // RUN: -fmodule-file=%t/a.pcm \
  28. // RUN: -fmodule-file=b-rel.pcm \
  29. // RUN: -verify %s
  30. //
  31. // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
  32. // RUN: -I%S/Inputs/explicit-build \
  33. // RUN: -fmodule-file=a.pcm \
  34. // RUN: -fmodule-file=b-abs.pcm \
  35. // RUN: -verify %s
  36. //
  37. // RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
  38. // RUN: -I%S/Inputs/explicit-build \
  39. // RUN: -fmodule-file=b-rel.pcm \
  40. // RUN: -fmodule-file=b-abs.pcm \
  41. // RUN: -verify %s 2>&1 | FileCheck %s
  42. // CHECK: module 'b' is defined in both '{{.*}}b-rel.pcm' and '{{.*}}b-abs.pcm'
  43. #include "a.h"
  44. static_assert(a == 1, "");
  45. // expected-no-diagnostics