Skip to content

Commit 69fbfee

Browse files
authored
merge main into amd-staging (llvm#3995)
2 parents 787e876 + 3286b34 commit 69fbfee

File tree

162 files changed

+2881
-1716
lines changed

Some content is hidden

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

162 files changed

+2881
-1716
lines changed

clang/docs/OpenMPSupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ implementation.
366366
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
367367
| threadset clause | :part:`in progress` | :none:`unclaimed` | |
368368
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
369-
| Recording of task graphs | :none:`unclaimed` | :none:`unclaimed` | |
369+
| Recording of task graphs | :part:`in progress` | :part:`in progress` | clang: jtb20, flang: kparzysz |
370370
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
371371
| Parallel inductions | :none:`unclaimed` | :none:`unclaimed` | |
372372
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,9 @@ Bug Fixes to C++ Support
596596
authentication enabled. (#GH152601)
597597
- Fix the check for narrowing int-to-float conversions, so that they are detected in
598598
cases where converting the float back to an integer is undefined behaviour (#GH157067).
599+
- Fix a crash when applying binary or ternary operators to two same function types with different spellings,
600+
where at least one of the function parameters has an attribute which affects
601+
the function type.
599602
- Fix an assertion failure when a ``constexpr`` variable is only referenced through
600603
``__builtin_addressof``, and related issues with builtin arguments. (#GH154034)
601604

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3290,7 +3290,8 @@ defm declspec : BoolOption<"f", "declspec",
32903290
def fmodules_cache_path : Joined<["-"], "fmodules-cache-path=">, Group<i_Group>,
32913291
Flags<[]>, Visibility<[ClangOption, CC1Option]>,
32923292
MetaVarName<"<directory>">,
3293-
HelpText<"Specify the module cache path">;
3293+
HelpText<"Specify the module cache path">,
3294+
MarshallingInfoString<HeaderSearchOpts<"ModuleCachePath">>;
32943295
def fmodules_user_build_path : Separate<["-"], "fmodules-user-build-path">, Group<i_Group>,
32953296
Flags<[]>, Visibility<[ClangOption, CC1Option]>,
32963297
MetaVarName<"<directory>">,

clang/include/clang/Lex/HeaderSearch.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,9 @@ void ApplyHeaderSearchOptions(HeaderSearch &HS,
986986
const LangOptions &Lang,
987987
const llvm::Triple &triple);
988988

989+
void normalizeModuleCachePath(FileManager &FileMgr, StringRef Path,
990+
SmallVectorImpl<char> &NormalizedPath);
991+
989992
} // namespace clang
990993

991994
#endif // LLVM_CLANG_LEX_HEADERSEARCH_H

clang/include/clang/Sema/Sema.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,9 +845,16 @@ enum AttrName { Target, TargetClones, TargetVersion };
845845

846846
void inferNoReturnAttr(Sema &S, const Decl *D);
847847

848+
#ifdef __GNUC__
849+
#pragma GCC diagnostic push
850+
#pragma GCC diagnostic ignored "-Wattributes"
851+
#endif
848852
/// Sema - This implements semantic analysis and AST building for C.
849853
/// \nosubgrouping
850854
class Sema final : public SemaBase {
855+
#ifdef __GNUC__
856+
#pragma GCC diagnostic pop
857+
#endif
851858
// Table of Contents
852859
// -----------------
853860
// 1. Semantic Analysis (Sema.cpp)

clang/lib/AST/ASTContext.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14204,7 +14204,11 @@ static QualType getCommonNonSugarTypeNode(const ASTContext &Ctx, const Type *X,
1420414204
FunctionProtoType::ExtProtoInfo EPIX = FX->getExtProtoInfo(),
1420514205
EPIY = FY->getExtProtoInfo();
1420614206
assert(EPIX.ExtInfo == EPIY.ExtInfo);
14207-
assert(EPIX.ExtParameterInfos == EPIY.ExtParameterInfos);
14207+
assert(!EPIX.ExtParameterInfos == !EPIY.ExtParameterInfos);
14208+
assert(!EPIX.ExtParameterInfos ||
14209+
llvm::equal(
14210+
llvm::ArrayRef(EPIX.ExtParameterInfos, FX->getNumParams()),
14211+
llvm::ArrayRef(EPIY.ExtParameterInfos, FY->getNumParams())));
1420814212
assert(EPIX.RefQualifier == EPIY.RefQualifier);
1420914213
assert(EPIX.TypeQuals == EPIY.TypeQuals);
1421014214
assert(EPIX.Variadic == EPIY.Variadic);

clang/lib/Frontend/CompilerInstance.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,16 @@ void CompilerInstance::createPreprocessor(TranslationUnitKind TUKind) {
554554
}
555555

556556
std::string CompilerInstance::getSpecificModuleCachePath(StringRef ModuleHash) {
557+
assert(FileMgr && "Specific module cache path requires a FileManager");
558+
559+
if (getHeaderSearchOpts().ModuleCachePath.empty())
560+
return "";
561+
557562
// Set up the module path, including the hash for the module-creation options.
558-
SmallString<256> SpecificModuleCache(getHeaderSearchOpts().ModuleCachePath);
559-
if (!SpecificModuleCache.empty() && !getHeaderSearchOpts().DisableModuleHash)
563+
SmallString<256> SpecificModuleCache;
564+
normalizeModuleCachePath(*FileMgr, getHeaderSearchOpts().ModuleCachePath,
565+
SpecificModuleCache);
566+
if (!getHeaderSearchOpts().DisableModuleHash)
560567
llvm::sys::path::append(SpecificModuleCache, ModuleHash);
561568
return std::string(SpecificModuleCache);
562569
}

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3323,9 +3323,6 @@ static void GenerateHeaderSearchArgs(const HeaderSearchOptions &Opts,
33233323
if (Opts.UseLibcxx)
33243324
GenerateArg(Consumer, OPT_stdlib_EQ, "libc++");
33253325

3326-
if (!Opts.ModuleCachePath.empty())
3327-
GenerateArg(Consumer, OPT_fmodules_cache_path, Opts.ModuleCachePath);
3328-
33293326
for (const auto &File : Opts.PrebuiltModuleFiles)
33303327
GenerateArg(Consumer, OPT_fmodule_file, File.first + "=" + File.second);
33313328

@@ -3428,8 +3425,7 @@ static void GenerateHeaderSearchArgs(const HeaderSearchOptions &Opts,
34283425
}
34293426

34303427
static bool ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
3431-
DiagnosticsEngine &Diags,
3432-
const std::string &WorkingDir) {
3428+
DiagnosticsEngine &Diags) {
34333429
unsigned NumErrorsBefore = Diags.getNumErrors();
34343430

34353431
HeaderSearchOptions *HeaderSearchOpts = &Opts;
@@ -3442,17 +3438,6 @@ static bool ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
34423438
if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
34433439
Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
34443440

3445-
// Canonicalize -fmodules-cache-path before storing it.
3446-
SmallString<128> P(Args.getLastArgValue(OPT_fmodules_cache_path));
3447-
if (!(P.empty() || llvm::sys::path::is_absolute(P))) {
3448-
if (WorkingDir.empty())
3449-
llvm::sys::fs::make_absolute(P);
3450-
else
3451-
llvm::sys::fs::make_absolute(WorkingDir, P);
3452-
}
3453-
llvm::sys::path::remove_dots(P);
3454-
Opts.ModuleCachePath = std::string(P);
3455-
34563441
// Only the -fmodule-file=<name>=<file> form.
34573442
for (const auto *A : Args.filtered(OPT_fmodule_file)) {
34583443
StringRef Val = A->getValue();
@@ -5150,8 +5135,7 @@ bool CompilerInvocation::CreateFromArgsImpl(
51505135
InputKind DashX = Res.getFrontendOpts().DashX;
51515136
ParseTargetArgs(Res.getTargetOpts(), Args, Diags);
51525137
llvm::Triple T(Res.getTargetOpts().Triple);
5153-
ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args, Diags,
5154-
Res.getFileSystemOpts().WorkingDir);
5138+
ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args, Diags);
51555139
if (Res.getFrontendOpts().GenReducedBMI ||
51565140
Res.getFrontendOpts().ProgramAction ==
51575141
frontend::GenerateReducedModuleInterface ||

clang/lib/Lex/HeaderSearch.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,3 +2183,10 @@ std::string HeaderSearch::suggestPathToFileForDiagnostics(
21832183
}
21842184
return path::convert_to_slash(Filename);
21852185
}
2186+
2187+
void clang::normalizeModuleCachePath(FileManager &FileMgr, StringRef Path,
2188+
SmallVectorImpl<char> &NormalizedPath) {
2189+
NormalizedPath.assign(Path.begin(), Path.end());
2190+
FileMgr.makeAbsolutePath(NormalizedPath);
2191+
llvm::sys::path::remove_dots(NormalizedPath);
2192+
}

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include "clang/Basic/TargetInfo.h"
5858
#include "clang/Basic/TargetOptions.h"
5959
#include "clang/Basic/Version.h"
60+
#include "clang/Frontend/CompilerInstance.h"
6061
#include "clang/Lex/HeaderSearch.h"
6162
#include "clang/Lex/HeaderSearchOptions.h"
6263
#include "clang/Lex/MacroInfo.h"
@@ -1710,9 +1711,13 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, StringRef isysroot) {
17101711
const HeaderSearchOptions &HSOpts =
17111712
PP.getHeaderSearchInfo().getHeaderSearchOpts();
17121713

1714+
SmallString<256> HSOpts_ModuleCachePath;
1715+
normalizeModuleCachePath(PP.getFileManager(), HSOpts.ModuleCachePath,
1716+
HSOpts_ModuleCachePath);
1717+
17131718
AddString(HSOpts.Sysroot, Record);
17141719
AddString(HSOpts.ResourceDir, Record);
1715-
AddString(HSOpts.ModuleCachePath, Record);
1720+
AddString(HSOpts_ModuleCachePath, Record);
17161721
AddString(HSOpts.ModuleUserBuildPath, Record);
17171722
Record.push_back(HSOpts.DisableModuleHash);
17181723
Record.push_back(HSOpts.ImplicitModuleMaps);

0 commit comments

Comments
 (0)