Chuanqi Xu 7bc170a261 [C++20] [Modules] [Serialization] Don't record '#pragma once' information in named modules
Close https://github.com/llvm/llvm-project/issues/77995

The cause of the issue is that straight forward that we recorded the
'#pragma once' information in named modules, which is an overlook.

I tried to not record the header's information completely within named
modules. But the tests look not happy with some diagnosing problems,
which needs to be looked in details.
2024-01-15 17:00:49 +08:00

26 lines
486 B
C++

// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -emit-module-interface -o %t/foo.pcm
// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fmodule-file=foo=%t/foo.pcm -verify -fsyntax-only
//--- a.hpp
#pragma once
#define A 43
//--- foo.cppm
module;
#include "a.hpp"
export module foo;
export constexpr auto B = A;
//--- use.cpp
// expected-no-diagnostics
import foo;
#include "a.hpp"
static_assert(A == 43);
static_assert(B == 43);