Skip to content

Commit c32cb4a

Browse files
authored
merge main into amd-staging (llvm#778)
2 parents dadc147 + 9abe0cc commit c32cb4a

File tree

122 files changed

+10494
-4995
lines changed

Some content is hidden

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

122 files changed

+10494
-4995
lines changed

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/CodeGen/HLSLBufferLayoutBuilder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ llvm::TargetExtType *HLSLBufferLayoutBuilder::createLayoutType(
8989
RecordTypes.pop_back();
9090

9191
for (const auto *FD : RT->getDecl()->fields()) {
92-
assert(!Packoffsets || Index < Packoffsets->size() &&
93-
"number of elements in layout struct does not "
94-
"match number of packoffset annotations");
92+
assert((!Packoffsets || Index < Packoffsets->size()) &&
93+
"number of elements in layout struct does not "
94+
"match number of packoffset annotations");
9595

9696
if (!layoutField(FD, EndOffset, Layout, LayoutElements,
9797
Packoffsets ? (*Packoffsets)[Index] : -1))

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,8 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
878878
checkForAMDProprietaryOptOptions(ToolChain, D, Args, CmdArgs,
879879
false /*isLLD*/, true /*checkOnly*/);
880880

881-
const bool IsFatLTO = Args.hasArg(options::OPT_ffat_lto_objects);
881+
const bool IsFatLTO = Args.hasFlag(options::OPT_ffat_lto_objects,
882+
options::OPT_fno_fat_lto_objects, false);
882883
const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto);
883884
if (llvm::sys::path::filename(Linker) != "ld.lld" &&
884885
llvm::sys::path::stem(Linker) != "ld.lld" && !ClosedNeeded &&

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.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// REQUIRES: aarch64-registered-target
2+
3+
// RUN: %clang -fsanitize-trap=undefined -fsanitize=hwaddress,array-bounds -target aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=true -mllvm -hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s --check-prefixes=CHECK,SAFETY
4+
// RUN: %clang -fsanitize-trap=undefined -fsanitize=hwaddress,array-bounds -target aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=false -mllvm -hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s --check-prefixes=CHECK,NOSAFETY
5+
6+
// Make sure that HWAsan does not re-check what has been validated by array-bounds
7+
8+
void f(char*);
9+
10+
int foo(unsigned int idx) {
11+
char buf[10];
12+
f(buf);
13+
return buf[idx];
14+
// CHECK-LABEL: {{.*}}foo
15+
// NOSAFETY: call void @llvm.hwasan.check.memaccess.shortgranules
16+
// SAFETY-NOT: call void @llvm.hwasan.check.memaccess.shortgranules
17+
}
18+
19+
int bar(int idx) {
20+
char buf[10];
21+
f(buf);
22+
return buf[idx];
23+
// CHECK-LABEL: {{.*}}bar
24+
// NOSAFETY: call void @llvm.hwasan.check.memaccess.shortgranules
25+
// SAFETY-NOT: call void @llvm.hwasan.check.memaccess.shortgranules
26+
}

clang/test/Driver/fat-lto-objects.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
// CHECK-CC-NOLTO-SAME: -emit-obj
4242
// CHECK-CC-NOLTO-NOT: -ffat-lto-objects
4343

44+
// RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -fno-fat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-NOLTO
45+
4446
/// We need to pass an additional flag (--fat-lto-objects) to lld when linking w/ -flto -ffat-lto-objects
4547
/// But it should not be there when LTO is disabled w/ -fno-lto
4648
// RUN: %clang --target=x86_64-unknown-linux-gnu --sysroot=%S/Inputs/basic_cross_linux_tree %s \

clang/test/Driver/print-supported-extensions-riscv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
// CHECK-NEXT: xqcilo 0.2 'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)
204204
// CHECK-NEXT: xqcilsm 0.2 'Xqcilsm' (Qualcomm uC Load Store Multiple Extension)
205205
// CHECK-NEXT: xqcisls 0.2 'Xqcisls' (Qualcomm uC Scaled Load Store Extension)
206+
// CHECK-NEXT: xrivosvizip 0.1 'XRivosVizip' (Rivos Vector Register Zips)
206207
// CHECK-EMPTY:
207208
// CHECK-NEXT: Supported Profiles
208209
// CHECK-NEXT: rva20s64

0 commit comments

Comments
 (0)