Skip to content

Commit 2b5fc4d

Browse files
committed
Merge branch 'main' into pr-riscv-xrivosvizip-mc
2 parents 4110b60 + b11e1ba commit 2b5fc4d

File tree

65 files changed

+7808
-4453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+7808
-4453
lines changed

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,10 +1657,6 @@ def err_omp_expected_colon : Error<"missing ':' in %0">;
16571657
def err_omp_missing_comma : Error< "missing ',' after %0">;
16581658
def err_omp_expected_context_selector
16591659
: Error<"expected valid context selector in %0">;
1660-
def err_omp_unknown_clause
1661-
: Error<"unknown clause '%0' in %1">;
1662-
def warn_omp_default_deprecated : Warning<"'default' clause for"
1663-
" 'metadirective' is deprecated; use 'otherwise' instead">, InGroup<Deprecated>;
16641660
def err_omp_requires_out_inout_depend_type : Error<
16651661
"reserved locator 'omp_all_memory' requires 'out' or 'inout' "
16661662
"dependency types">;

clang/include/clang/Basic/Module.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,10 +881,11 @@ class VisibleModuleSet {
881881
StringRef Message)>;
882882

883883
/// Make a specific module visible.
884-
void setVisible(Module *M, SourceLocation Loc,
885-
VisibleCallback Vis = [](Module *) {},
886-
ConflictCallback Cb = [](ArrayRef<Module *>, Module *,
887-
StringRef) {});
884+
void setVisible(
885+
Module *M, SourceLocation Loc, bool IncludeExports = true,
886+
VisibleCallback Vis = [](Module *) {},
887+
ConflictCallback Cb = [](ArrayRef<Module *>, Module *, StringRef) {});
888+
888889
private:
889890
/// Import locations for each visible module. Indexed by the module's
890891
/// VisibilityID.

clang/include/clang/Lex/Preprocessor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,8 @@ class Preprocessor {
17551755
bool LexAfterModuleImport(Token &Result);
17561756
void CollectPpImportSuffix(SmallVectorImpl<Token> &Toks);
17571757

1758-
void makeModuleVisible(Module *M, SourceLocation Loc);
1758+
void makeModuleVisible(Module *M, SourceLocation Loc,
1759+
bool IncludeExports = true);
17591760

17601761
SourceLocation getModuleImportLoc(Module *M) const {
17611762
return CurSubmoduleState->VisibleModules.getImportLoc(M);

clang/lib/Basic/Module.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,8 @@ LLVM_DUMP_METHOD void Module::dump() const {
662662
}
663663

664664
void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc,
665-
VisibleCallback Vis, ConflictCallback Cb) {
665+
bool IncludeExports, VisibleCallback Vis,
666+
ConflictCallback Cb) {
666667
// We can't import a global module fragment so the location can be invalid.
667668
assert((M->isGlobalModule() || Loc.isValid()) &&
668669
"setVisible expects a valid import location");
@@ -688,12 +689,14 @@ void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc,
688689
Vis(V.M);
689690

690691
// Make any exported modules visible.
691-
SmallVector<Module *, 16> Exports;
692-
V.M->getExportedModules(Exports);
693-
for (Module *E : Exports) {
694-
// Don't import non-importable modules.
695-
if (!E->isUnimportable())
696-
VisitModule({E, &V});
692+
if (IncludeExports) {
693+
SmallVector<Module *, 16> Exports;
694+
V.M->getExportedModules(Exports);
695+
for (Module *E : Exports) {
696+
// Don't import non-importable modules.
697+
if (!E->isUnimportable())
698+
VisitModule({E, &V});
699+
}
697700
}
698701

699702
for (auto &C : V.M->Conflicts) {

clang/lib/Lex/PPLexerChange.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,10 @@ void Preprocessor::EnterSubmodule(Module *M, SourceLocation ImportLoc,
754754
// Switch to this submodule as the current submodule.
755755
CurSubmoduleState = &State;
756756

757-
// This module is visible to itself.
757+
// This module is visible to itself, but exports should not be made visible
758+
// until they are imported.
758759
if (FirstTime)
759-
makeModuleVisible(M, ImportLoc);
760+
makeModuleVisible(M, ImportLoc, /*IncludeExports=*/false);
760761
}
761762

762763
bool Preprocessor::needModuleMacros() const {

clang/lib/Lex/Preprocessor.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,9 +1331,10 @@ bool Preprocessor::LexAfterModuleImport(Token &Result) {
13311331
return true;
13321332
}
13331333

1334-
void Preprocessor::makeModuleVisible(Module *M, SourceLocation Loc) {
1334+
void Preprocessor::makeModuleVisible(Module *M, SourceLocation Loc,
1335+
bool IncludeExports) {
13351336
CurSubmoduleState->VisibleModules.setVisible(
1336-
M, Loc, [](Module *) {},
1337+
M, Loc, IncludeExports, [](Module *) {},
13371338
[&](ArrayRef<Module *> Path, Module *Conflict, StringRef Message) {
13381339
// FIXME: Include the path in the diagnostic.
13391340
// FIXME: Include the import location for the conflicting module.

clang/lib/Parse/ParseOpenMP.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2759,19 +2759,6 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
27592759
OpenMPClauseKind CKind = Tok.isAnnotation()
27602760
? OMPC_unknown
27612761
: getOpenMPClauseKind(PP.getSpelling(Tok));
2762-
// Check if the clause is unrecognized.
2763-
if (getLangOpts().OpenMP < 52 &&
2764-
(CKind == OMPC_unknown || CKind == OMPC_otherwise)) {
2765-
Diag(Tok, diag::err_omp_unknown_clause)
2766-
<< PP.getSpelling(Tok) << "metadirective";
2767-
}
2768-
if (getLangOpts().OpenMP >= 52 && CKind == OMPC_unknown) {
2769-
Diag(Tok, diag::err_omp_unknown_clause)
2770-
<< PP.getSpelling(Tok) << "metadirective";
2771-
}
2772-
if (CKind == OMPC_default && getLangOpts().OpenMP >= 52) {
2773-
Diag(Tok, diag::warn_omp_default_deprecated);
2774-
}
27752762
SourceLocation Loc = ConsumeToken();
27762763

27772764
// Parse '('.
@@ -2798,13 +2785,6 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
27982785
return Directive;
27992786
}
28002787
}
2801-
if (CKind == OMPC_otherwise) {
2802-
// Check for 'otherwise' keyword.
2803-
if (Tok.is(tok::identifier) &&
2804-
Tok.getIdentifierInfo()->getName() == "otherwise") {
2805-
ConsumeToken(); // Consume 'otherwise'
2806-
}
2807-
}
28082788
// Skip Directive for now. We will parse directive in the second iteration
28092789
int paren = 0;
28102790
while (Tok.isNot(tok::r_paren) || paren != 0) {
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Checks that macros from transitive imports work with local submodule
2+
// visibility. In the below test, previously a() and d() failed because
3+
// OTHER_MACRO1 and OTHER_MACRO3 were not visible at the use site.
4+
5+
// RUN: rm -rf %t
6+
// RUN: split-file %s %t
7+
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
8+
// RUN: -fmodules-local-submodule-visibility -I%t %t/tu.c -verify
9+
10+
//--- Other1.h
11+
#define OTHER_MACRO1(...)
12+
13+
//--- Other2.h
14+
#define OTHER_MACRO2(...)
15+
16+
//--- Other3.h
17+
#define OTHER_MACRO3(...)
18+
19+
//--- module.modulemap
20+
module Other {
21+
module O1 { header "Other1.h" }
22+
module O2 { header "Other2.h" }
23+
module O3 { header "Other3.h" }
24+
}
25+
26+
//--- Top/A.h
27+
#include "Other1.h"
28+
#define MACRO_A OTHER_MACRO1(x, y)
29+
30+
//--- Top/B.h
31+
#include "Other2.h"
32+
#define MACRO_B OTHER_MACRO2(x, y)
33+
34+
//--- Top/C.h
35+
#include "D.h"
36+
37+
//--- Top/D.h
38+
#include "Other3.h"
39+
#define MACRO_D OTHER_MACRO3(x, y)
40+
41+
//--- Top/Top.h
42+
#include "A.h"
43+
#include "B.h"
44+
#include "C.h"
45+
46+
void a() MACRO_A;
47+
void b() MACRO_B;
48+
void d() MACRO_D;
49+
50+
//--- Top/module.modulemap
51+
module Top {
52+
umbrella header "Top.h"
53+
module A { header "A.h" export * }
54+
module D { header "D.h" export * }
55+
module * { export * }
56+
export *
57+
export Other.O3
58+
}
59+
60+
//--- tu.c
61+
#include "Top/Top.h"
62+
// expected-no-diagnostics

clang/test/OpenMP/metadirective_messages.cpp

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,21 @@
22

33
// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -verify -fopenmp-simd -x c++ -std=c++14 -fexceptions -fcxx-exceptions %s
44

5-
// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -ferror-limit 100 -o - %s -Wuninitialized
6-
75
void foo() {
8-
#if _OPENMP >= 202111
9-
#pragma omp metadirective // omp52-error {{expected expression}}
10-
;
11-
#pragma omp metadirective when() // omp52-error {{expected valid context selector in when clause}} expected-error {{expected expression}} expected-warning {{expected identifier or string literal describing a context set; set skipped}} expected-note {{context set options are: 'construct' 'device' 'target_device' 'implementation' 'user'}} expected-note {{the ignored set spans until here}}
12-
;
13-
#pragma omp metadirective when(device{}) // omp52-warning {{expected '=' after the context set name "device"; '=' assumed}} expected-warning {{expected identifier or string literal describing a context selector; selector skipped}} expected-note {{context selector options are: 'kind' 'arch' 'isa'}} expected-note {{the ignored selector spans until here}} expected-error {{expected valid context selector in when clause}} expected-error {{expected expression}}
14-
;
15-
#pragma omp metadirective when(device{arch(nvptx)}) // omp52-error {{missing ':' in when clause}} expected-error {{expected expression}} expected-warning {{expected '=' after the context set name "device"; '=' assumed}}
16-
;
17-
#pragma omp metadirective when(device{arch(nvptx)}: ) otherwise() // omp52-warning {{expected '=' after the context set name "device"; '=' assumed}}
18-
;
19-
#pragma omp metadirective when(device = {arch(nvptx)} : ) otherwise(xyz) // omp52-error {{expected an OpenMP directive}} expected-error {{use of undeclared identifier 'xyz'}}
20-
;
21-
#pragma omp metadirective when(device = {arch(nvptx)} : parallel otherwise() // omp52-error {{expected ',' or ')' in 'when' clause}} expected-error {{expected expression}}
22-
;
23-
#pragma omp metadirective when(device = {isa("some-unsupported-feature")} : parallel) otherwise(single) // omp52-warning {{isa trait 'some-unsupported-feature' is not known to the current target; verify the spelling or consider restricting the context selector with the 'arch' selector further}}
24-
;
25-
#pragma omp metadirective when(device = {arch(nvptx)} : parallel) default() // omp52-warning {{'default' clause for 'metadirective' is deprecated; use 'otherwise' instead}}
26-
;
27-
#pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() //omp52-error {{unknown clause 'xyz' in metadirective}}
28-
;
29-
#else
30-
#pragma omp metadirective // expected-error {{expected expression}}
31-
;
32-
#pragma omp metadirective when() // expected-error {{expected valid context selector in when clause}} expected-error {{expected expression}} expected-warning {{expected identifier or string literal describing a context set; set skipped}} expected-note {{context set options are: 'construct' 'device' 'target_device' 'implementation' 'user'}} expected-note {{the ignored set spans until here}}
33-
;
34-
#pragma omp metadirective when(device{}) // expected-warning {{expected '=' after the context set name "device"; '=' assumed}} expected-warning {{expected identifier or string literal describing a context selector; selector skipped}} expected-note {{context selector options are: 'kind' 'arch' 'isa'}} expected-note {{the ignored selector spans until here}} expected-error {{expected valid context selector in when clause}} expected-error {{expected expression}}
35-
;
36-
#pragma omp metadirective when(device{arch(nvptx)}) // expected-error {{missing ':' in when clause}} expected-error {{expected expression}} expected-warning {{expected '=' after the context set name "device"; '=' assumed}}
37-
;
38-
#pragma omp metadirective when(device{arch(nvptx)}: ) default() // expected-warning {{expected '=' after the context set name "device"; '=' assumed}}
39-
;
40-
#pragma omp metadirective when(device = {arch(nvptx)} : ) default(xyz) // expected-error {{expected an OpenMP directive}} expected-error {{use of undeclared identifier 'xyz'}}
41-
;
42-
#pragma omp metadirective when(device = {arch(nvptx)} : parallel default() // expected-error {{expected ',' or ')' in 'when' clause}} expected-error {{expected expression}}
43-
;
44-
#pragma omp metadirective when(device = {isa("some-unsupported-feature")} : parallel) default(single) // expected-warning {{isa trait 'some-unsupported-feature' is not known to the current target; verify the spelling or consider restricting the context selector with the 'arch' selector further}}
45-
;
46-
#pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() //expected-error {{unknown clause 'xyz' in metadirective}}
47-
;
48-
#endif
6+
#pragma omp metadirective // expected-error {{expected expression}}
7+
;
8+
#pragma omp metadirective when() // expected-error {{expected valid context selector in when clause}} expected-error {{expected expression}} expected-warning {{expected identifier or string literal describing a context set; set skipped}} expected-note {{context set options are: 'construct' 'device' 'target_device' 'implementation' 'user'}} expected-note {{the ignored set spans until here}}
9+
;
10+
#pragma omp metadirective when(device{}) // expected-warning {{expected '=' after the context set name "device"; '=' assumed}} expected-warning {{expected identifier or string literal describing a context selector; selector skipped}} expected-note {{context selector options are: 'kind' 'arch' 'isa'}} expected-note {{the ignored selector spans until here}} expected-error {{expected valid context selector in when clause}} expected-error {{expected expression}}
11+
;
12+
#pragma omp metadirective when(device{arch(nvptx)}) // expected-error {{missing ':' in when clause}} expected-error {{expected expression}} expected-warning {{expected '=' after the context set name "device"; '=' assumed}}
13+
;
14+
#pragma omp metadirective when(device{arch(nvptx)}: ) default() // expected-warning {{expected '=' after the context set name "device"; '=' assumed}}
15+
;
16+
#pragma omp metadirective when(device = {arch(nvptx)} : ) default(xyz) // expected-error {{expected an OpenMP directive}} expected-error {{use of undeclared identifier 'xyz'}}
17+
;
18+
#pragma omp metadirective when(device = {arch(nvptx)} : parallel default() // expected-error {{expected ',' or ')' in 'when' clause}} expected-error {{expected expression}}
19+
;
20+
#pragma omp metadirective when(device = {isa("some-unsupported-feature")} : parallel) default(single) // expected-warning {{isa trait 'some-unsupported-feature' is not known to the current target; verify the spelling or consider restricting the context selector with the 'arch' selector further}}
21+
;
4922
}

flang-rt/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ as `CMAKE_CXX_COMPILER`, `CMAKE_CXX_COMPILER`, and `CMAKE_Fortran_COMPILER`.
8888
Flang-RT to ensure they are using the same ABI. The C and C++ compiler
8989
can be any compiler supporting the same ABI.
9090

91-
In addition to the compiler, the build be able to find LLVM development tools
92-
such as `lit` and `FileCheck` that are not found in an LLVM's install
91+
In addition to the compiler, the build must be able to find LLVM development
92+
tools such as `lit` and `FileCheck` that are not found in an LLVM's install
9393
directory. Use `CMAKE_BINARY_DIR` to point to directory where LLVM has
9494
been built. A simple build configuration might look like the following:
9595

0 commit comments

Comments
 (0)