Skip to content

Commit 7120061

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:96b17043507caec02a2ef440b369506122bdeb11 into amd-gfx:d4bdcbc628f2
Local branch amd-gfx d4bdcbc Merged main:9eb399b8548b835547947884b75c5fa79f977394 into amd-gfx:0ad536a6314e Remote branch main 96b1704 [flang][runtime] Dont write implied ENDFILE for REC=/POS= (llvm#79637)
2 parents d4bdcbc + 96b1704 commit 7120061

File tree

186 files changed

+4690
-1160
lines changed

Some content is hidden

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

186 files changed

+4690
-1160
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,7 @@ linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
233233

234234
windows_projects_to_test=$(exclude-windows $(compute-projects-to-test ${modified_projects}))
235235
windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq)
236-
# Temporary disable the windows job.
237-
# See https://discourse.llvm.org/t/rfc-future-of-windows-pre-commit-ci/76840
238-
#windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
239-
windows_projects=""
236+
windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
240237

241238
# Generate the appropriate pipeline
242239
if [[ "${linux_projects}" != "" ]]; then

.ci/monolithic-windows.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ targets="${2}"
3838

3939
echo "--- cmake"
4040
pip install -q -r ${MONOREPO_ROOT}/mlir/python/requirements.txt
41+
42+
# The CMAKE_*_LINKER_FLAGS to disable the manifest come from research
43+
# on fixing a build reliability issue on the build server, please
44+
# see https://github.com/llvm/llvm-project/pull/82393 and
45+
# https://discourse.llvm.org/t/rfc-future-of-windows-pre-commit-ci/76840/40
46+
# for further information.
4147
cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
4248
-D LLVM_ENABLE_PROJECTS="${projects}" \
4349
-G Ninja \
@@ -49,7 +55,10 @@ cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
4955
-D COMPILER_RT_BUILD_ORC=OFF \
5056
-D CMAKE_C_COMPILER_LAUNCHER=sccache \
5157
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
52-
-D MLIR_ENABLE_BINDINGS_PYTHON=ON
58+
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
59+
-D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \
60+
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
61+
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO"
5362

5463
echo "--- ninja"
5564
# Targets are not escaped as they are passed as separate arguments.

clang/docs/ReleaseNotes.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,18 @@ Improvements to Clang's diagnostics
201201
- Added diagnostics for C11 keywords being incompatible with language standards
202202
before C11, under a new warning group: ``-Wpre-c11-compat``.
203203

204+
- Now diagnoses an enumeration constant whose value is larger than can be
205+
represented by ``unsigned long long``, which can happen with a large constant
206+
using the ``wb`` or ``uwb`` suffix. The maximal underlying type is currently
207+
``unsigned long long``, but this behavior may change in the future when Clang
208+
implements
209+
`WG14 N3029 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3029.htm>`_.
210+
Fixes `#69352 <https://github.com/llvm/llvm-project/issues/69352>`_.
211+
212+
- Clang now diagnoses extraneous template parameter lists as a language extension.
213+
214+
- Clang now diagnoses declarative nested name specifiers that name alias templates.
215+
204216
Improvements to Clang's time-trace
205217
----------------------------------
206218

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5325,7 +5325,7 @@ def err_alias_template_extra_headers : Error<
53255325
def err_template_spec_extra_headers : Error<
53265326
"extraneous template parameter list in template specialization or "
53275327
"out-of-line template definition">;
5328-
def warn_template_spec_extra_headers : Warning<
5328+
def ext_template_spec_extra_headers : ExtWarn<
53295329
"extraneous template parameter list in template specialization">;
53305330
def note_explicit_template_spec_does_not_need_header : Note<
53315331
"'template<>' header not required for explicitly-specialized class %0 "
@@ -8255,6 +8255,9 @@ def err_not_tag_in_scope : Error<
82558255
def ext_template_after_declarative_nns : ExtWarn<
82568256
"'template' cannot be used after a declarative nested name specifier">,
82578257
InGroup<DiagGroup<"template-in-declaration-name">>;
8258+
def ext_alias_template_in_declarative_nns : ExtWarn<
8259+
"a declarative nested name specifier cannot name an alias template">,
8260+
InGroup<DiagGroup<"alias-template-in-declaration-name">>;
82588261

82598262
def err_no_typeid_with_fno_rtti : Error<
82608263
"use of typeid requires -frtti">;

clang/include/clang/Driver/Driver.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,11 @@ class Driver {
251251
/// from non-system headers are emitted.
252252
HeaderIncludeFilteringKind CCPrintHeadersFiltering = HIFIL_None;
253253

254+
/// Name of the library that provides implementations of
255+
/// IEEE-754 128-bit float math functions used by Fortran F128
256+
/// runtime library. It should be linked as needed by the linker job.
257+
std::string FlangF128MathLibrary;
258+
254259
/// Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics
255260
/// to CCLogDiagnosticsFilename or to stderr, in a stable machine readable
256261
/// format.
@@ -440,6 +445,11 @@ class Driver {
440445
bool offloadHostOnly() const { return Offload == OffloadHost; }
441446
bool offloadDeviceOnly() const { return Offload == OffloadDevice; }
442447

448+
void setFlangF128MathLibrary(std::string name) {
449+
FlangF128MathLibrary = std::move(name);
450+
}
451+
StringRef getFlangF128MathLibrary() const { return FlangF128MathLibrary; }
452+
443453
/// Compute the desired OpenMP runtime from the flags provided.
444454
OpenMPRuntimeKind getOpenMPRuntime(const llvm::opt::ArgList &Args) const;
445455

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//===- InstallAPI/FileList.h ------------------------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
///
9+
/// The JSON file list parser is used to communicate input to InstallAPI.
10+
///
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef LLVM_CLANG_INSTALLAPI_FILELIST_H
14+
#define LLVM_CLANG_INSTALLAPI_FILELIST_H
15+
16+
#include "clang/Basic/Diagnostic.h"
17+
#include "clang/Basic/FileManager.h"
18+
#include "clang/InstallAPI/HeaderFile.h"
19+
#include "llvm/Support/Error.h"
20+
#include "llvm/Support/MemoryBuffer.h"
21+
22+
namespace clang {
23+
namespace installapi {
24+
25+
class FileListReader {
26+
public:
27+
/// Decode JSON input and append header input into destination container.
28+
/// Headers are loaded in the order they appear in the JSON input.
29+
///
30+
/// \param InputBuffer JSON input data.
31+
/// \param Destination Container to load headers into.
32+
static llvm::Error
33+
loadHeaders(std::unique_ptr<llvm::MemoryBuffer> InputBuffer,
34+
HeaderSeq &Destination);
35+
36+
FileListReader() = delete;
37+
};
38+
39+
} // namespace installapi
40+
} // namespace clang
41+
42+
#endif // LLVM_CLANG_INSTALLAPI_FILELIST_H
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
//===- InstallAPI/HeaderFile.h ----------------------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
///
9+
/// Representations of a library's headers for InstallAPI.
10+
///
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef LLVM_CLANG_INSTALLAPI_HEADERFILE_H
14+
#define LLVM_CLANG_INSTALLAPI_HEADERFILE_H
15+
16+
#include "clang/Basic/LangStandard.h"
17+
#include "llvm/ADT/StringRef.h"
18+
#include "llvm/Support/Regex.h"
19+
#include <optional>
20+
#include <string>
21+
22+
namespace clang::installapi {
23+
enum class HeaderType {
24+
/// Represents declarations accessible to all clients.
25+
Public,
26+
/// Represents declarations accessible to a disclosed set of clients.
27+
Private,
28+
/// Represents declarations only accessible as implementation details to the
29+
/// input library.
30+
Project,
31+
};
32+
33+
class HeaderFile {
34+
/// Full input path to header.
35+
std::string FullPath;
36+
/// Access level of header.
37+
HeaderType Type;
38+
/// Expected way header will be included by clients.
39+
std::string IncludeName;
40+
/// Supported language mode for header.
41+
std::optional<clang::Language> Language;
42+
43+
public:
44+
HeaderFile(StringRef FullPath, HeaderType Type,
45+
StringRef IncludeName = StringRef(),
46+
std::optional<clang::Language> Language = std::nullopt)
47+
: FullPath(FullPath), Type(Type), IncludeName(IncludeName),
48+
Language(Language) {}
49+
50+
static llvm::Regex getFrameworkIncludeRule();
51+
52+
bool operator==(const HeaderFile &Other) const {
53+
return std::tie(Type, FullPath, IncludeName, Language) ==
54+
std::tie(Other.Type, Other.FullPath, Other.IncludeName,
55+
Other.Language);
56+
}
57+
};
58+
59+
/// Assemble expected way header will be included by clients.
60+
/// As in what maps inside the brackets of `#include <IncludeName.h>`
61+
/// For example,
62+
/// "/System/Library/Frameworks/Foo.framework/Headers/Foo.h" returns
63+
/// "Foo/Foo.h"
64+
///
65+
/// \param FullPath Path to the header file which includes the library
66+
/// structure.
67+
std::optional<std::string> createIncludeHeaderName(const StringRef FullPath);
68+
using HeaderSeq = std::vector<HeaderFile>;
69+
70+
} // namespace clang::installapi
71+
72+
#endif // LLVM_CLANG_INSTALLAPI_HEADERFILE_H

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,14 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
12851285
// add the correct libraries to link against as dependents in the object
12861286
// file.
12871287
if (!TC.getTriple().isKnownWindowsMSVCEnvironment()) {
1288+
StringRef f128LibName = TC.getDriver().getFlangF128MathLibrary();
1289+
f128LibName.consume_front_insensitive("lib");
1290+
if (!f128LibName.empty()) {
1291+
CmdArgs.push_back("-lFortranFloat128Math");
1292+
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/true);
1293+
CmdArgs.push_back(Args.MakeArgString("-l" + f128LibName));
1294+
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false);
1295+
}
12881296
CmdArgs.push_back("-lFortranRuntime");
12891297
CmdArgs.push_back("-lFortranDecimal");
12901298
}

clang/lib/ExtractAPI/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ add_clang_library(clangExtractAPI
1616
clangBasic
1717
clangFrontend
1818
clangIndex
19+
clangInstallAPI
1920
clangLex
2021
)

clang/lib/ExtractAPI/ExtractAPIConsumer.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "clang/Frontend/CompilerInstance.h"
3131
#include "clang/Frontend/FrontendOptions.h"
3232
#include "clang/Frontend/MultiplexConsumer.h"
33+
#include "clang/InstallAPI/HeaderFile.h"
3334
#include "clang/Lex/MacroInfo.h"
3435
#include "clang/Lex/PPCallbacks.h"
3536
#include "clang/Lex/Preprocessor.h"
@@ -61,9 +62,6 @@ std::optional<std::string> getRelativeIncludeName(const CompilerInstance &CI,
6162
"CompilerInstance does not have a FileNamager!");
6263

6364
using namespace llvm::sys;
64-
// Matches framework include patterns
65-
const llvm::Regex Rule("/(.+)\\.framework/(.+)?Headers/(.+)");
66-
6765
const auto &FS = CI.getVirtualFileSystem();
6866

6967
SmallString<128> FilePath(File.begin(), File.end());
@@ -147,7 +145,8 @@ std::optional<std::string> getRelativeIncludeName(const CompilerInstance &CI,
147145
// include name `<Framework/Header.h>`
148146
if (Entry.IsFramework) {
149147
SmallVector<StringRef, 4> Matches;
150-
Rule.match(File, &Matches);
148+
clang::installapi::HeaderFile::getFrameworkIncludeRule().match(
149+
File, &Matches);
151150
// Returned matches are always in stable order.
152151
if (Matches.size() != 4)
153152
return std::nullopt;

clang/lib/InstallAPI/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ set(LLVM_LINK_COMPONENTS
55

66
add_clang_library(clangInstallAPI
77
Context.cpp
8+
FileList.cpp
9+
HeaderFile.cpp
810

911
LINK_LIBS
1012
clangAST

0 commit comments

Comments
 (0)