brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 0b8954e Raw
35 lines · c
1// This test demonstrates how -fmodule-map-file-home-is-cwd with -fmodules-embed-all-files2// extend the importer search paths by relying on the side effects of pragma diagnostic3// mappings deserialization.4 5// RUN: rm -rf %t6// RUN: split-file %s %t7 8//--- dir1/a.modulemap9module a { header "a.h" }10//--- dir1/a.h11#include "search.h"12// The first compilation is configured such that -I search does contain the search.h header.13//--- dir1/search/search.h14#pragma clang diagnostic push15#pragma clang diagnostic ignored "-Wparentheses"16#pragma clang diagnostic pop17// RUN: cd %t/dir1 && %clang_cc1 -fmodules -I search \18// RUN:   -emit-module -fmodule-name=a a.modulemap -o %t/a.pcm \19// RUN:   -fmodules-embed-all-files -fmodule-map-file-home-is-cwd20 21//--- dir2/b.modulemap22module b { header "b.h" }23//--- dir2/b.h24#include "search.h" // expected-error{{'search.h' file not found}}25// The second compilation is configured such that -I search is an empty directory.26// However, since b.pcm simply embeds the headers as "search/search.h", this compilation27// ends up seeing it too. This relies solely on ASTReader::ReadPragmaDiagnosticMappings()28// eagerly reading the corresponding INPUT_FILE record before header search happens.29// Removing the eager deserialization makes this header invisible and so does removing30// the pragma directives.31// RUN: mkdir %t/dir2/search32// RUN: cd %t/dir2 && %clang_cc1 -fmodules -I search \33// RUN:   -emit-module -fmodule-name=b b.modulemap -o %t/b.pcm \34// RUN:   -fmodule-file=%t/a.pcm -verify35