llvm-project/clang/test/Headers/header_unit_preprocessed_output.cpp
Dmitry Polukhin 0b7e8c25ec
[C++20][Modules] Quote header unit name in preprocessor output (-E) (#112883)
Summary:
Before this change clang produced output with header unit names that may
conaint path separators, dots and other non-identifier characters. This
diff prints header unit name in quotes and -E output can be compiled
again. Also remove unnecessary space between header unit name and semi.

Test Plan: check-clang
2024-10-24 08:20:43 +01:00

21 lines
572 B
C++

// RUN: rm -fR %t
// RUN: split-file %s %t
// RUN: cd %t
// RUN: %clang_cc1 -verify -std=c++20 -emit-header-unit -xc++-user-header bz0.h
// RUN: %clang_cc1 -verify -std=c++20 -fmodule-file=bz0.pcm -xc++-user-header bz1.h -E -o bz1.output.h
// RUN: FileCheck %s < bz1.output.h
// RUN: %clang_cc1 -std=c++20 -fmodule-file=bz0.pcm -emit-header-unit -xc++-user-header bz1.output.h
//--- bz0.h
// expected-no-diagnostics
#pragma once
void foo();
//--- bz1.h
// expected-no-diagnostics
import "bz0.h";
// CHECK: # 1 ".{{/|\\\\?}}bz1.h"
// CHECK: import ".{{/|\\\\?}}bz0.h";