- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15k
[clang][modules] Derive mtime from PCM timestamps, not PCM files #162965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
        
      
    
      
        
          +137
        
        
          −111
        
        
          
        
      
    
  
  
     Merged
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            235 changes: 125 additions & 110 deletions
          
          235 
        
  clang/test/Modules/fmodules-validate-once-per-build-session.c
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,119 +1,134 @@ | ||
| #include "foo.h" | ||
| #include "bar.h" | ||
|  | ||
| // Clear the module cache. | ||
| // RUN: rm -rf %t | ||
| // RUN: mkdir -p %t/Inputs | ||
| // RUN: mkdir -p %t/modules-to-compare | ||
| // This tests the behavior of -fmodules-validate-once-per-build-session with | ||
| // different combinations of flags and states of the module cache. | ||
|  | ||
| // === | ||
| // Create a module. We will use -I or -isystem to determine whether to treat | ||
| // foo.h as a system header. | ||
| // RUN: echo 'void meow(void);' > %t/Inputs/foo.h | ||
| // RUN: echo 'void woof(void);' > %t/Inputs/bar.h | ||
| // RUN: echo 'module Foo { header "foo.h" }' > %t/Inputs/module.modulemap | ||
| // RUN: echo 'extern module Bar "bar.modulemap"' >> %t/Inputs/module.modulemap | ||
| // RUN: echo 'module Bar { header "bar.h" }' > %t/Inputs/bar.modulemap | ||
| // Note: The `sleep 1` commands sprinkled throughout this test make the strict | ||
| // comparisons of epoch mtimes work as expected. Some may be unnecessary, | ||
| // but make the intent clearer. | ||
|  | ||
| // === | ||
| // Compile the module. | ||
| // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fmodules-validate-system-headers -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s | ||
| // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fmodules-validate-system-headers -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s | ||
| // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user-no-force -fsyntax-only -I %t/Inputs -fno-modules-force-validate-user-headers -fmodules-validate-system-headers -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s | ||
| // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache | grep Bar.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user | grep Foo.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user | grep Bar.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user-no-force | grep Foo.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user-no-force | grep Bar.pcm.timestamp | ||
| // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-before.pcm | ||
| // RUN: cp %t/modules-cache/Bar.pcm %t/modules-to-compare/Bar-before.pcm | ||
| // RUN: cp %t/modules-cache-user/Foo.pcm %t/modules-to-compare/Foo-before-user.pcm | ||
| // RUN: cp %t/modules-cache-user/Bar.pcm %t/modules-to-compare/Bar-before-user.pcm | ||
| // RUN: cp %t/modules-cache-user-no-force/Foo.pcm %t/modules-to-compare/Foo-before-user-no-force.pcm | ||
| // RUN: cp %t/modules-cache-user-no-force/Bar.pcm %t/modules-to-compare/Bar-before-user-no-force.pcm | ||
|  | ||
| // === | ||
| // Use it, and make sure that we did not recompile it. | ||
| // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fmodules-validate-system-headers -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s | ||
| // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fmodules-validate-system-headers -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s | ||
| // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-use-no-force -fsyntax-only -I %t/Inputs -fno-modules-force-validate-user-headers -fmodules-validate-system-headers -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s | ||
| // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache | grep Bar.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user | grep Foo.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user | grep Bar.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user-no-force | grep Foo.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user-no-force | grep Bar.pcm.timestamp | ||
| // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm | ||
| // RUN: cp %t/modules-cache/Bar.pcm %t/modules-to-compare/Bar-after.pcm | ||
| // RUN: cp %t/modules-cache-user/Foo.pcm %t/modules-to-compare/Foo-after-user.pcm | ||
| // RUN: cp %t/modules-cache-user/Bar.pcm %t/modules-to-compare/Bar-after-user.pcm | ||
| // RUN: cp %t/modules-cache-user-no-force/Foo.pcm %t/modules-to-compare/Foo-after-user-no-force.pcm | ||
| // RUN: cp %t/modules-cache-user-no-force/Bar.pcm %t/modules-to-compare/Bar-after-user-no-force.pcm | ||
| // RUN: rm -rf %t | ||
| // RUN: split-file %s %t | ||
| // RUN: echo "-fsyntax-only -fmodules -fmodules-cache-path=%/t/module-cache" > %t/ctx.rsp | ||
| // RUN: echo "-fbuild-session-file=%/t/module-cache/session.timestamp" >> %t/ctx.rsp | ||
| // RUN: echo "-fmodules-validate-once-per-build-session" >> %t/ctx.rsp | ||
| // RUN: echo "-Rmodule-build -Rmodule-validation" >> %t/ctx.rsp | ||
|  | ||
| // RUN: diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm | ||
| // RUN: diff %t/modules-to-compare/Bar-before.pcm %t/modules-to-compare/Bar-after.pcm | ||
| // RUN: diff %t/modules-to-compare/Foo-before-user.pcm %t/modules-to-compare/Foo-after-user.pcm | ||
| // RUN: diff %t/modules-to-compare/Bar-before-user.pcm %t/modules-to-compare/Bar-after-user.pcm | ||
| // RUN: diff %t/modules-to-compare/Foo-before-user-no-force.pcm %t/modules-to-compare/Foo-after-user-no-force.pcm | ||
| // RUN: diff %t/modules-to-compare/Bar-before-user-no-force.pcm %t/modules-to-compare/Bar-after-user-no-force.pcm | ||
| //--- include/foo.h | ||
| //--- include/module.modulemap | ||
| module Foo { header "foo.h" } | ||
|  | ||
| // === | ||
| // Change the sources. | ||
| //--- clean.c | ||
| // Clean module cache. Modules will get compiled regardless of validation settings. | ||
| // RUN: mkdir %t/module-cache | ||
| // RUN: sleep 1 | ||
| // RUN: echo 'void meow2(void);' > %t/Inputs/foo.h | ||
| // RUN: echo 'module Bar { header "bar.h" export * }' > %t/Inputs/bar.modulemap | ||
| // RUN: touch %t/module-cache/session.timestamp | ||
| // RUN: sleep 1 | ||
| // RUN: %clang @%t/ctx.rsp %t/clean.c -DCTX=1 \ | ||
| // RUN: -isystem %t/include -fmodules-validate-system-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/clean.c | ||
| // RUN: %clang @%t/ctx.rsp %t/clean.c -DCTX=2 \ | ||
| // RUN: -I %t/include -fmodules-validate-system-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/clean.c | ||
| // RUN: %clang @%t/ctx.rsp %t/clean.c -DCTX=3 \ | ||
| // RUN: -I %t/include -fmodules-validate-system-headers -Xclang -fno-modules-force-validate-user-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/clean.c | ||
| #include "foo.h" | ||
| // CHECK: building module 'Foo' | ||
|  | ||
| // === | ||
| // Use the module, and make sure that we did not recompile it if foo.h or | ||
| // module.modulemap are system files or user files with force validation disabled, | ||
| // even though the sources changed. | ||
| // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fmodules-validate-system-headers -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s | ||
| // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fmodules-validate-system-headers -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s | ||
| // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user-no-force -fsyntax-only -I %t/Inputs -fno-modules-force-validate-user-headers -fmodules-validate-system-headers -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s | ||
| // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache | grep Bar.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user | grep Foo.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user | grep Bar.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user-no-force | grep Foo.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user-no-force | grep Bar.pcm.timestamp | ||
| // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm | ||
| // RUN: cp %t/modules-cache/Bar.pcm %t/modules-to-compare/Bar-after.pcm | ||
| // RUN: cp %t/modules-cache-user/Foo.pcm %t/modules-to-compare/Foo-after-user.pcm | ||
| // RUN: cp %t/modules-cache-user/Bar.pcm %t/modules-to-compare/Bar-after-user.pcm | ||
| // RUN: cp %t/modules-cache-user-no-force/Foo.pcm %t/modules-to-compare/Foo-after-user-no-force.pcm | ||
| // RUN: cp %t/modules-cache-user-no-force/Bar.pcm %t/modules-to-compare/Bar-after-user-no-force.pcm | ||
| //--- no-change-same-session.c | ||
| // Populated module cache in the same build session with unchanged inputs. | ||
| // Validation only happens when it's forced for user headers. No compiles. | ||
| // RUN: sleep 1 | ||
| // RUN: %clang @%t/ctx.rsp %t/no-change-same-session.c -DCTX=1 \ | ||
| // RUN: -isystem %t/include -fmodules-validate-system-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/no-change-same-session.c --check-prefix=CHECK-NO-VALIDATION-OR-BUILD --allow-empty | ||
| // RUN: %clang @%t/ctx.rsp %t/no-change-same-session.c -DCTX=2 \ | ||
| // RUN: -I %t/include -fmodules-validate-system-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/no-change-same-session.c --check-prefix=CHECK-VALIDATION-ONLY | ||
| // RUN: %clang @%t/ctx.rsp %t/no-change-same-session.c -DCTX=3 \ | ||
| // RUN: -I %t/include -fmodules-validate-system-headers -Xclang -fno-modules-force-validate-user-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/no-change-same-session.c --check-prefix=CHECK-NO-VALIDATION-OR-BUILD --allow-empty | ||
| #include "foo.h" | ||
| // CHECK-NO-VALIDATION-OR-BUILD-NOT: validating {{[0-9]+}} input files in module 'Foo' | ||
| // CHECK-NO-VALIDATION-OR-BUILD-NOT: building module 'Foo' | ||
| // CHECK-VALIDATION-ONLY: validating {{[0-9]+}} input files in module 'Foo' | ||
| // CHECK-VALIDATION-ONLY-NOT: building module 'Foo' | ||
|  | ||
| // RUN: diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm | ||
| // RUN: diff %t/modules-to-compare/Bar-before.pcm %t/modules-to-compare/Bar-after.pcm | ||
| // When foo.h is an user header, we will validate it by default. | ||
| // RUN: not diff %t/modules-to-compare/Foo-before-user.pcm %t/modules-to-compare/Foo-after-user.pcm | ||
| // RUN: not diff %t/modules-to-compare/Bar-before-user.pcm %t/modules-to-compare/Bar-after-user.pcm | ||
| // When foo.h is an user header, we will not validate it if force validation is turned off. | ||
| // RUN: diff %t/modules-to-compare/Foo-before-user-no-force.pcm %t/modules-to-compare/Foo-after-user-no-force.pcm | ||
| // RUN: diff %t/modules-to-compare/Bar-before-user-no-force.pcm %t/modules-to-compare/Bar-after-user-no-force.pcm | ||
| //--- change-same-session.c | ||
| // Populated module cache in the same build session with changed inputs. | ||
| // Validation only happens when it's forced for user headers and results in compilation. | ||
| // RUN: sleep 1 | ||
| // RUN: touch %t/include/foo.h | ||
| // RUN: sleep 1 | ||
| // RUN: %clang @%t/ctx.rsp %t/change-same-session.c -DCTX=1 \ | ||
| // RUN: -isystem %t/include -fmodules-validate-system-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/change-same-session.c --check-prefix=CHECK-NO-VALIDATION-OR-BUILD --allow-empty | ||
| // RUN: %clang @%t/ctx.rsp %t/change-same-session.c -DCTX=2 \ | ||
| // RUN: -I %t/include -fmodules-validate-system-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/change-same-session.c --check-prefix=CHECK-VALIDATION-AND-BUILD | ||
| // RUN: %clang @%t/ctx.rsp %t/change-same-session.c -DCTX=3 \ | ||
| // RUN: -I %t/include -fmodules-validate-system-headers -Xclang -fno-modules-force-validate-user-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/change-same-session.c --check-prefix=CHECK-NO-VALIDATION-OR-BUILD --allow-empty | ||
| #include "foo.h" | ||
| // CHECK-NO-VALIDATION-OR-BUILD-NOT: validating {{[0-9]+}} input files in module 'Foo' | ||
| // CHECK-NO-VALIDATION-OR-BUILD-NOT: building module 'Foo' | ||
| // CHECK-VALIDATION-AND-BUILD: validating {{[0-9]+}} input files in module 'Foo' | ||
| // CHECK-VALIDATION-AND-BUILD: building module 'Foo' | ||
|  | ||
| // === | ||
| // Recompile the module if the today's date is before 01 January 2100. | ||
| // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fmodules-validate-system-headers -fbuild-session-timestamp=4102441200 -fmodules-validate-once-per-build-session %s | ||
| // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fmodules-validate-system-headers -fbuild-session-timestamp=4102441200 -fmodules-validate-once-per-build-session %s | ||
| // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user-no-force -fsyntax-only -I %t/Inputs -fno-modules-force-validate-user-headers -fmodules-validate-system-headers -fbuild-session-timestamp=4102441200 -fmodules-validate-once-per-build-session %s | ||
| // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache | grep Bar.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user | grep Foo.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user | grep Bar.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user-no-force | grep Foo.pcm.timestamp | ||
| // RUN: ls -R %t/modules-cache-user-no-force | grep Bar.pcm.timestamp | ||
| // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm | ||
| // RUN: cp %t/modules-cache/Bar.pcm %t/modules-to-compare/Bar-after.pcm | ||
| // RUN: cp %t/modules-cache-user/Foo.pcm %t/modules-to-compare/Foo-after-user.pcm | ||
| // RUN: cp %t/modules-cache-user/Bar.pcm %t/modules-to-compare/Bar-after-user.pcm | ||
| // RUN: cp %t/modules-cache-user-no-force/Foo.pcm %t/modules-to-compare/Foo-after-user-no-force.pcm | ||
| // RUN: cp %t/modules-cache-user-no-force/Bar.pcm %t/modules-to-compare/Bar-after-user-no-force.pcm | ||
| //--- change-new-session.c | ||
| // Populated module cache in a new build session with changed inputs. | ||
| // All configurations validate and recompile. | ||
| // RUN: sleep 1 | ||
| // RUN: touch %t/include/foo.h | ||
| // RUN: sleep 1 | ||
| // RUN: touch %t/module-cache/session.timestamp | ||
| // RUN: sleep 1 | ||
| // RUN: %clang @%t/ctx.rsp %t/change-new-session.c -DCTX=1 \ | ||
| // RUN: -isystem %t/include -fmodules-validate-system-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/change-new-session.c --check-prefixes=CHECK,CHECK-VALIDATE-ONCE | ||
| // NOTE: Forced user headers validation causes redundant validation of the just-built module. | ||
| // RUN: %clang @%t/ctx.rsp %t/change-new-session.c -DCTX=2 \ | ||
| // RUN: -I %t/include -fmodules-validate-system-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/change-new-session.c --check-prefixes=CHECK,CHECK-FORCE-VALIDATE-TWICE | ||
| // RUN: %clang @%t/ctx.rsp %t/change-new-session.c -DCTX=3 \ | ||
| // RUN: -I %t/include -fmodules-validate-system-headers -Xclang -fno-modules-force-validate-user-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/change-new-session.c --check-prefixes=CHECK,CHECK-VALIDATE-ONCE | ||
| #include "foo.h" | ||
| // CHECK: validating {{[0-9]+}} input files in module 'Foo' | ||
| // CHECK: building module 'Foo' | ||
| // CHECK-VALIDATE-ONCE-NOT: validating {{[0-9]+}} input files in module 'Foo' | ||
| // CHECK-FORCE-VALIDATE-TWICE: validating {{[0-9]+}} input files in module 'Foo' | ||
|  | ||
| // RUN: not diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm | ||
| // RUN: not diff %t/modules-to-compare/Bar-before.pcm %t/modules-to-compare/Bar-after.pcm | ||
| // RUN: not diff %t/modules-to-compare/Foo-before-user.pcm %t/modules-to-compare/Foo-after-user.pcm | ||
| // RUN: not diff %t/modules-to-compare/Bar-before-user.pcm %t/modules-to-compare/Bar-after-user.pcm | ||
| // RUN: not diff %t/modules-to-compare/Foo-before-user-no-force.pcm %t/modules-to-compare/Foo-after-user-no-force.pcm | ||
| // RUN: not diff %t/modules-to-compare/Bar-before-user-no-force.pcm %t/modules-to-compare/Bar-after-user-no-force.pcm | ||
| //--- no-change-new-session-twice.c | ||
| // Populated module cache in a new build session with unchanged inputs. | ||
| // At first, all configurations validate but don't recompile. | ||
| // RUN: sleep 1 | ||
| // RUN: touch %t/module-cache/session.timestamp | ||
| // RUN: sleep 1 | ||
| // RUN: %clang @%t/ctx.rsp %t/no-change-new-session-twice.c -DCTX=1 \ | ||
| // RUN: -isystem %t/include -fmodules-validate-system-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/no-change-new-session-twice.c --check-prefix=CHECK-ONCE | ||
| // RUN: %clang @%t/ctx.rsp %t/no-change-new-session-twice.c -DCTX=2 \ | ||
| // RUN: -I %t/include -fmodules-validate-system-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/no-change-new-session-twice.c --check-prefix=CHECK-ONCE | ||
| // RUN: %clang @%t/ctx.rsp %t/no-change-new-session-twice.c -DCTX=3 \ | ||
| // RUN: -I %t/include -fmodules-validate-system-headers -Xclang -fno-modules-force-validate-user-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/no-change-new-session-twice.c --check-prefix=CHECK-ONCE | ||
| // | ||
| // Then, only the forced user header validation performs redundant validation (but no compilation). | ||
| // All other configurations do not validate and do not compile. | ||
| // RUN: sleep 1 | ||
| // RUN: %clang @%t/ctx.rsp %t/no-change-new-session-twice.c -DCTX=1 \ | ||
| // RUN: -isystem %t/include -fmodules-validate-system-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/no-change-new-session-twice.c --check-prefix=CHECK-NOT-TWICE --allow-empty | ||
| // NOTE: Forced user headers validation causes redundant validation of the just-validated module. | ||
| // RUN: %clang @%t/ctx.rsp %t/no-change-new-session-twice.c -DCTX=2 \ | ||
| // RUN: -I %t/include -fmodules-validate-system-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/no-change-new-session-twice.c --check-prefix=CHECK-ONCE | ||
| // RUN: %clang @%t/ctx.rsp %t/no-change-new-session-twice.c -DCTX=3 \ | ||
| // RUN: -I %t/include -fmodules-validate-system-headers -Xclang -fno-modules-force-validate-user-headers \ | ||
| // RUN: 2>&1 | FileCheck %t/no-change-new-session-twice.c --check-prefix=CHECK-NOT-TWICE --allow-empty | ||
| #include "foo.h" | ||
| // CHECK-ONCE: validating {{[0-9]+}} input files in module 'Foo' | ||
| // CHECK-ONCE-NOT: building module 'Foo' | ||
| // CHECK-NOT-TWICE-NOT: validating {{[0-9]+}} input files in module 'Foo' | ||
| // CHECK-NOT-TWICE-NOT: building module 'Foo' | ||
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what fails without the fix to
ModuleCache.cpp. We'd use the mtime of the PCM from the old build session instead of the mtime of the PCM.timestampfile from the current build session. That would trigger unnecessary validation.