implicit-invalidate-common.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // REQUIRES: shell
  2. // RUN: rm -rf %t
  3. // RUN: mkdir -p %t/implicit-invalidate-common
  4. // RUN: cp -r %S/Inputs/implicit-invalidate-common %t/
  5. // RUN: echo '#include "A.h"' > %t/A.c
  6. // RUN: echo '#include "B.h"' > %t/B.c
  7. // Build with an empty module cache. Module 'Common' should be built only once.
  8. //
  9. // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/Cache \
  10. // RUN: -fsyntax-only -I %t/implicit-invalidate-common -Rmodule-build \
  11. // RUN: %t/A.c 2> %t/initial_build.txt
  12. // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/Cache \
  13. // RUN: -fsyntax-only -I %t/implicit-invalidate-common -Rmodule-build \
  14. // RUN: %t/B.c 2>> %t/initial_build.txt
  15. // RUN: FileCheck %s --implicit-check-not "remark:" --input-file %t/initial_build.txt
  16. // Update module 'Common' and build with the populated module cache. Module
  17. // 'Common' still should be built only once. Note that we are using the same
  18. // flags for A.c and B.c to avoid building Common.pcm at different paths.
  19. //
  20. // RUN: echo ' // ' >> %t/implicit-invalidate-common/Common.h
  21. // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/Cache \
  22. // RUN: -fsyntax-only -I %t/implicit-invalidate-common -Rmodule-build \
  23. // RUN: %t/A.c 2> %t/incremental_build.txt
  24. // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/Cache \
  25. // RUN: -fsyntax-only -I %t/implicit-invalidate-common -Rmodule-build \
  26. // RUN: %t/B.c 2>> %t/incremental_build.txt
  27. // RUN: FileCheck %s --implicit-check-not "remark:" --input-file %t/incremental_build.txt
  28. // CHECK: remark: building module 'A'
  29. // CHECK: remark: building module 'Common'
  30. // CHECK: remark: finished building module 'Common'
  31. // CHECK: remark: finished building module 'A'
  32. // CHECK: remark: building module 'B'
  33. // CHECK: remark: finished building module 'B'