Files
clang-p2996/clang/test/Modules/pr73023.cpp
Chuanqi Xu f0c3870388 [Modules] [HeaderSearch] Don't reenter headers if it is pragma once (#76119)
Close https://github.com/llvm/llvm-project/issues/73023

The direct issue of https://github.com/llvm/llvm-project/issues/73023 is
that we entered a header which is marked as pragma once since the
compiler think it is OK if there is controlling macro.

It doesn't make sense. I feel like it should be sufficient to skip it
after we see the '#pragma once'.

From the context, it looks like the workaround is primarily for
ObjectiveC. So we might need reviewers from OC.
2024-01-24 10:22:35 +08:00

20 lines
280 B
C++

// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/test.cpp -fsyntax-only -verify
//--- i.h
#ifndef I_H
#pragma once
struct S{};
#endif
//--- test.cpp
// expected-no-diagnostics
#include "i.h"
int foo() {
return sizeof(S);
}