File: extensions.c

package info (click to toggle)
llvm-toolchain-3.8 1%3A3.8.1-24
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 379,280 kB
  • ctags: 388,501
  • sloc: cpp: 2,309,705; ansic: 477,070; objc: 100,918; asm: 97,974; python: 95,911; sh: 18,634; makefile: 7,294; perl: 5,584; ml: 5,460; pascal: 4,661; lisp: 2,548; xml: 686; cs: 350; php: 212; csh: 117
file content (44 lines) | stat: -rw-r--r-- 3,501 bytes parent folder | download | duplicates (39)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Test creation of modules that include extension blocks.
// RUN: rm -rf %t
// 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

// Make sure the extension blocks are actually there.
// RUN: llvm-bcanalyzer %t/ExtensionTestA.pcm | FileCheck -check-prefix=CHECK-BCANALYZER %s
// RUN: %clang_cc1 -module-file-info %t/ExtensionTestA.pcm | FileCheck -check-prefix=CHECK-INFO %s

// Make sure that the readers are able to check the metadata.
// RUN: rm -rf %t
// 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 %s
// 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 -verify

// Make sure that extension blocks can be part of the module hash.
// We test this in an obscure way, by making sure we don't get conflicts when
// using different "versions" of the extensions. Above, the "-verify" test
// checks that such conflicts produce errors.
// RUN: rm -rf %t
// 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 %s
// 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 %s
// 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 %s

// Make sure we can read the message back.
// 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>&1
// RUN: FileCheck -check-prefix=CHECK-MESSAGE %s < %t.log

// Make sure we diagnose duplicate module file extensions.
// 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>&1
// RUN: FileCheck -check-prefix=CHECK-DUPLICATE %s < %t.log

#include "ExtensionTestA.h"
// expected-error@-1{{test module file extension 'clang.testA' has different version (1.5) than expected (1.3)}}
// expected-error@-2{{test module file extension 'clang.testB' has different version (2.3) than expected (3.2)}}

// CHECK-BCANALYZER: {{Block ID.*EXTENSION_BLOCK}}
// CHECK-BCANALYZER: {{100.00.*EXTENSION_METADATA}}

// CHECK-INFO: Module file extension 'clang.testA' 1.5: user_info_for_A
// CHECK-INFO: Module file extension 'clang.testB' 2.3: user_info_for_B

// CHECK-MESSAGE: Read extension block message: Hello from clang.testA v1.5
// CHECK-MESSAGE: Read extension block message: Hello from clang.testB v2.3

// CHECK-DUPLICATE: warning: duplicate module file extension block name 'clang.testA'