brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 710c9c3 Raw
127 lines · plain
1// This test verifies that system module variants are mergable despite having2// different warning flags, as most warnings are disabled in system modules.3// This checks for system modules marked as such both via `-isystem` and4// `[system]`.5 6// RUN: rm -rf %t7// RUN: split-file %s %t8// RUN: sed -e "s|DIR|%/t|g" %t/build/compile-commands.json.in > %t/build/compile-commands.json9// RUN: clang-scan-deps -compilation-database %t/build/compile-commands.json \10// RUN:   -j 1 -format experimental-full -optimize-args=system-warnings > %t/deps.db11// RUN: cat %t/deps.db | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t12 13// CHECK:      {14// CHECK-NEXT:   "modules": [15// CHECK-NEXT:     {16// CHECK-NEXT:       "clang-module-deps": [],17// CHECK-NEXT:       "clang-modulemap-file":18// CHECK-NEXT:       "command-line": [19// CHECK-NOT:          "-W20// CHECK:            ],21// CHECK-NEXT:       "context-hash": "{{.*}}",22// CHECK-NEXT:       "file-deps": [23// CHECK:            ],24// CHECK-NEXT:       "link-libraries": [],25// CHECK-NEXT:       "name": "A"26// CHECK-NEXT:     },27// CHECK-NEXT:     {28// CHECK-NEXT:       "clang-module-deps": [],29// CHECK-NEXT:       "clang-modulemap-file":30// CHECK-NEXT:       "command-line": [31// CHECK-NOT:          "-W32// CHECK:            ],33// CHECK-NEXT:       "context-hash": "{{.*}}",34// CHECK-NEXT:       "file-deps": [35// CHECK:            ],36// CHECK-NEXT:       "link-libraries": [],37// CHECK-NEXT:       "name": "B"38// CHECK-NEXT:     },39// CHECK-NEXT:     {40// CHECK-NEXT:       "clang-module-deps": [],41// CHECK-NEXT:       "clang-modulemap-file":42// CHECK-NEXT:       "command-line": [43// CHECK:              "-Wmaybe-unused44// CHECK:            ],45// CHECK-NEXT:       "context-hash": "{{.*}}",46// CHECK-NEXT:       "file-deps": [47// CHECK:            ],48// CHECK-NEXT:       "link-libraries": [],49// CHECK-NEXT:       "name": "C"50// CHECK-NEXT:     }51// CHECK-NEXT:   ],52// CHECK-NEXT:   "translation-units": [53// CHECK:        ]54// CHECK:      }55 56// A.m and B.m verify that system modules with different warning flags get57// merged. C.m verifies that -Wsystem-headers disables the optimization.58//--- build/compile-commands.json.in59 60[61{62  "directory": "DIR",63  "command": "clang -c DIR/A.m -isystem modules/A -I modules/B -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps",64  "file": "DIR/A.m"65},66{67  "directory": "DIR",68  "command": "clang -c DIR/B.m -isystem modules/A -I modules/B -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps -Wmaybe-unused",69  "file": "DIR/B.m"70},71{72  "directory": "DIR",73  "command": "clang -c DIR/C.m -isystem modules/C              -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps -Wmaybe-unused -Wsystem-headers",74  "file": "DIR/C.m"75}76]77 78//--- modules/A/module.modulemap79 80module A {81  umbrella header "A.h"82}83 84//--- modules/A/A.h85 86typedef int A_t;87 88//--- modules/B/module.modulemap89 90module B [system] {91  umbrella header "B.h"92}93 94//--- modules/B/B.h95 96typedef int B_t;97 98//--- modules/C/module.modulemap99 100module C [system] {101  umbrella header "C.h"102}103 104//--- modules/C/C.h105 106typedef int C_t;107 108//--- A.m109 110#include <A.h>111#include <B.h>112 113A_t a = 0;114 115//--- B.m116 117#include <A.h>118#include <B.h>119 120A_t b = 0;121 122//--- C.m123 124#include <C.h>125 126C_t c = 0;127