brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · 1858f02 Raw
45 lines · c
1// Test creation of modules that include extension blocks.2// RUN: rm -rf %t3// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -ftest-module-file-extension=clang.testA:1:5:0:user_info_for_A -ftest-module-file-extension=clang.testB:2:3:0:user_info_for_B -fmodules-cache-path=%t -I %S/Inputs %s4 5// Make sure the extension blocks are actually there.6// RUN: llvm-bcanalyzer %t/ExtensionTestA.pcm | FileCheck -check-prefix=CHECK-BCANALYZER %s7// RUN: %clang_cc1 -module-file-info %t/ExtensionTestA.pcm | FileCheck -check-prefix=CHECK-INFO %s8 9// Make sure that the readers are able to check the metadata.10// RUN: rm -rf %t11// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -ftest-module-file-extension=clang.testA:1:5:0:user_info_for_A -ftest-module-file-extension=clang.testB:2:3:0:user_info_for_B -fmodules-cache-path=%t -I %S/Inputs %s12// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -ftest-module-file-extension=clang.testA:1:3:0:user_info_for_A -ftest-module-file-extension=clang.testB:3:2:0:user_info_for_B -fmodules-cache-path=%t -I %S/Inputs %s -verify13 14// Make sure that extension blocks can be part of the module hash.15// We test this in an obscure way, by making sure we don't get conflicts when16// using different "versions" of the extensions. Above, the "-verify" test17// checks that such conflicts produce errors.18// RUN: rm -rf %t19// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -ftest-module-file-extension=clang.testA:1:5:1:user_info_for_A -ftest-module-file-extension=clang.testB:2:3:1:user_info_for_B -fmodules-cache-path=%t -I %S/Inputs %s20// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -ftest-module-file-extension=clang.testA:1:3:1:user_info_for_A -ftest-module-file-extension=clang.testB:3:2:1:user_info_for_B -fmodules-cache-path=%t -I %S/Inputs %s21// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -ftest-module-file-extension=clang.testA:2:5:0:user_info_for_A -ftest-module-file-extension=clang.testB:7:3:0:user_info_for_B -fmodules-cache-path=%t -I %S/Inputs %s22 23// Make sure we can read the message back.24// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -ftest-module-file-extension=clang.testA:1:5:0:user_info_for_A -ftest-module-file-extension=clang.testB:2:3:0:user_info_for_B -fmodules-cache-path=%t -I %S/Inputs %s > %t.log 2>&125// RUN: FileCheck -check-prefix=CHECK-MESSAGE %s < %t.log26 27// Make sure we diagnose duplicate module file extensions.28// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -ftest-module-file-extension=clang.testA:1:5:0:user_info_for_A -ftest-module-file-extension=clang.testA:1:5:0:user_info_for_A -fmodules-cache-path=%t -I %S/Inputs %s > %t.log 2>&129// RUN: FileCheck -check-prefix=CHECK-DUPLICATE %s < %t.log30 31#include "ExtensionTestA.h"32// expected-error@-1{{test module file extension 'clang.testA' has different version (1.5) than expected (1.3)}}33// expected-error@-2{{test module file extension 'clang.testB' has different version (2.3) than expected (3.2)}}34 35// CHECK-BCANALYZER: {{Block ID.*EXTENSION_BLOCK}}36// CHECK-BCANALYZER: {{100.00.*EXTENSION_METADATA}}37 38// CHECK-INFO: Module file extension 'clang.testA' 1.5: user_info_for_A39// CHECK-INFO: Module file extension 'clang.testB' 2.3: user_info_for_B40 41// CHECK-MESSAGE: Read extension block message: Hello from clang.testA v1.542// CHECK-MESSAGE: Read extension block message: Hello from clang.testB v2.343 44// CHECK-DUPLICATE: warning: duplicate module file extension block name 'clang.testA'45