Skip to content

Commit da37246

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:c47321524c8b into amd-gfx:1b3f7c53de71
Local branch amd-gfx 1b3f7c5 Merged main:ddbcc10b9e26 into amd-gfx:632a231f2ac6 Remote branch main c473215 [llvm] Adopt WithMarkup in the MIPS backend (llvm#65384)
2 parents 1b3f7c5 + c473215 commit da37246

File tree

78 files changed

+1514
-99
lines changed

Some content is hidden

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

78 files changed

+1514
-99
lines changed

clang-tools-extra/docs/clang-tidy/checks/fuchsia/statically-constructed-objects.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ For example:
2222

2323
class C {
2424
public:
25-
C(int Val) : Val(Val) {}
26-
constexpr C() : Val(0) {}
25+
constexpr C(int Val) : Val(Val) {}
26+
C(int Val1, int Val2) : Val(Val1+Val2) {}
2727

2828
private:
2929
int Val;
@@ -38,6 +38,6 @@ For example:
3838
static int i; // No warning, as it is trivial
3939

4040
extern int get_i();
41-
static C(get_i()) // Warning, as the constructor is dynamically initialized
41+
static C c3(get_i());// Warning, as the constructor is dynamically initialized
4242

4343
See the features disallowed in Fuchsia at https://fuchsia.dev/fuchsia-src/development/languages/c-cpp/cxx?hl=en

clang/lib/CodeGen/CoverageMappingGen.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,12 @@ class CoverageMappingBuilder {
322322
for (const auto &FL : FileLocs) {
323323
SourceLocation Loc = FL.first;
324324
FileID SpellingFile = SM.getDecomposedSpellingLoc(Loc).first;
325-
auto Entry = SM.getFileEntryForID(SpellingFile);
325+
auto Entry = SM.getFileEntryRefForID(SpellingFile);
326326
if (!Entry)
327327
continue;
328328

329329
FileIDMapping[SM.getFileID(Loc)] = std::make_pair(Mapping.size(), Loc);
330-
Mapping.push_back(CVM.getFileID(Entry));
330+
Mapping.push_back(CVM.getFileID(*Entry));
331331
}
332332
}
333333

@@ -1740,7 +1740,7 @@ void CoverageMappingModuleGen::addFunctionMappingRecord(
17401740
FilenameStrs[0] = normalizeFilename(getCurrentDirname());
17411741
for (const auto &Entry : FileEntries) {
17421742
auto I = Entry.second;
1743-
FilenameStrs[I] = normalizeFilename(Entry.first->getName());
1743+
FilenameStrs[I] = normalizeFilename(Entry.first.getName());
17441744
}
17451745
ArrayRef<std::string> FilenameRefs = llvm::ArrayRef(FilenameStrs);
17461746
RawCoverageMappingReader Reader(CoverageMapping, FilenameRefs, Filenames,
@@ -1764,7 +1764,7 @@ void CoverageMappingModuleGen::emit() {
17641764
FilenameStrs[0] = normalizeFilename(getCurrentDirname());
17651765
for (const auto &Entry : FileEntries) {
17661766
auto I = Entry.second;
1767-
FilenameStrs[I] = normalizeFilename(Entry.first->getName());
1767+
FilenameStrs[I] = normalizeFilename(Entry.first.getName());
17681768
}
17691769

17701770
std::string Filenames;
@@ -1823,7 +1823,7 @@ void CoverageMappingModuleGen::emit() {
18231823
}
18241824
}
18251825

1826-
unsigned CoverageMappingModuleGen::getFileID(const FileEntry *File) {
1826+
unsigned CoverageMappingModuleGen::getFileID(FileEntryRef File) {
18271827
auto It = FileEntries.find(File);
18281828
if (It != FileEntries.end())
18291829
return It->second;

clang/lib/CodeGen/CoverageMappingGen.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class CoverageMappingModuleGen {
104104

105105
CodeGenModule &CGM;
106106
CoverageSourceInfo &SourceInfo;
107-
llvm::SmallDenseMap<const FileEntry *, unsigned, 8> FileEntries;
107+
llvm::SmallDenseMap<FileEntryRef, unsigned, 8> FileEntries;
108108
std::vector<llvm::Constant *> FunctionNames;
109109
std::vector<FunctionInfo> FunctionRecords;
110110

@@ -137,7 +137,7 @@ class CoverageMappingModuleGen {
137137

138138
/// Return the coverage mapping translation unit file id
139139
/// for the given file.
140-
unsigned getFileID(const FileEntry *File);
140+
unsigned getFileID(FileEntryRef File);
141141

142142
/// Return an interface into CodeGenModule.
143143
CodeGenModule &getCodeGenModule() { return CGM; }

clang/lib/Rewrite/Rewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ bool Rewriter::overwriteChangedFiles() {
412412
unsigned OverwriteFailure = Diag.getCustomDiagID(
413413
DiagnosticsEngine::Error, "unable to overwrite file %0: %1");
414414
for (buffer_iterator I = buffer_begin(), E = buffer_end(); I != E; ++I) {
415-
OptionalFileEntryRef Entry = getSourceMgr().getFileEntryRefForID(I->first);
415+
const FileEntry *Entry = getSourceMgr().getFileEntryForID(I->first);
416416
if (auto Error =
417417
llvm::writeToOutput(Entry->getName(), [&](llvm::raw_ostream &OS) {
418418
I->second.write(OS);

clang/www/get_started.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"http://www.w3.org/TR/html4/strict.dtd">
33
<html>
44
<head>
5-
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
5+
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
66
<title>Clang - Getting Started</title>
77
<link type="text/css" rel="stylesheet" href="menu.css">
88
<link type="text/css" rel="stylesheet" href="content.css">
@@ -125,7 +125,7 @@ <h3 id="buildWindows">Using Visual Studio</h3>
125125
project files. Get it from:
126126
<a href="https://cmake.org/download/">
127127
https://cmake.org/download/</a></li>
128-
<li><b>Visual Studio 2017 or later</b></li>
128+
<li><b>Visual Studio 2019 16.7 or later</b></li>
129129
<li><b>Python</b>. It is used to run the clang test suite. Get it from:
130130
<a href="https://www.python.org/download/">
131131
https://www.python.org/download/</a></li>
@@ -156,8 +156,8 @@ <h3 id="buildWindows">Using Visual Studio</h3>
156156
<li><tt>mkdir build</tt> (for building without polluting the source dir)</li>
157157
<li><tt>cd build</tt></li>
158158
<li>
159-
If you are using Visual Studio 2017:
160-
<tt>cmake -DLLVM_ENABLE_PROJECTS=clang -G "Visual Studio 15 2017" -A x64 -Thost=x64 ..\llvm</tt><br/>
159+
If you are using Visual Studio 2019:
160+
<tt>cmake -DLLVM_ENABLE_PROJECTS=clang -G "Visual Studio 16 2019" -A x64 -Thost=x64 ..\llvm</tt><br/>
161161
<tt>-Thost=x64</tt> is required, since the 32-bit linker will run out of memory.
162162
</li>
163163
<li>To generate x86 binaries instead of x64, pass <tt>-A Win32</tt>.</li>

libc/cmake/modules/LLVMLibCLibraryRules.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ function(collect_object_file_deps target result)
1919
return()
2020
endif()
2121

22-
if(${target_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE})
22+
if(${target_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE} OR
23+
${target_type} STREQUAL ${ENTRYPOINT_OBJ_VENDOR_TARGET_TYPE})
2324
set(entrypoint_target ${target})
2425
get_target_property(is_alias ${entrypoint_target} "IS_ALIAS")
2526
if(is_alias)
@@ -85,7 +86,8 @@ function(add_entrypoint_library target_name)
8586
list(APPEND all_deps ${recursive_deps})
8687
# Add the entrypoint object target explicitly as collect_object_file_deps
8788
# only collects object files from non-entrypoint targets.
88-
if(${dep_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE})
89+
if(${dep_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE} OR
90+
${dep_type} STREQUAL ${ENTRYPOINT_OBJ_VENDOR_TARGET_TYPE})
8991
set(entrypoint_target ${dep})
9092
get_target_property(is_alias ${entrypoint_target} "IS_ALIAS")
9193
if(is_alias)

libc/test/src/time/clock_gettime_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
TEST(LlvmLibcClockGetTime, RealTime) {
1515
struct timespec tp;
1616
int result;
17-
result = clock_gettime(CLOCK_REALTIME, &tp);
17+
result = __llvm_libc::clock_gettime(CLOCK_REALTIME, &tp);
1818
ASSERT_EQ(result, 0);
1919
ASSERT_GT(tp.tv_sec, time_t(0));
2020
}
@@ -23,10 +23,10 @@ TEST(LlvmLibcClockGetTime, RealTime) {
2323
TEST(LlvmLibcClockGetTime, MonotonicTime) {
2424
struct timespec tp1, tp2;
2525
int result;
26-
result = clock_gettime(CLOCK_MONOTONIC, &tp1);
26+
result = __llvm_libc::clock_gettime(CLOCK_MONOTONIC, &tp1);
2727
ASSERT_EQ(result, 0);
2828
ASSERT_GT(tp1.tv_sec, time_t(0));
29-
result = clock_gettime(CLOCK_MONOTONIC, &tp2);
29+
result = __llvm_libc::clock_gettime(CLOCK_MONOTONIC, &tp2);
3030
ASSERT_EQ(result, 0);
3131
ASSERT_GE(tp2.tv_sec, tp1.tv_sec); // The monotonic clock should increase.
3232
if (tp2.tv_sec == tp1.tv_sec) {

libc/test/src/time/gettimeofday_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ TEST(LlvmLibcGettimeofday, SmokeTest) {
2525
int ret = __llvm_libc::gettimeofday(&tv, tz);
2626
ASSERT_EQ(ret, 0);
2727

28-
int sleep_time = -sleep_times[i];
28+
int sleep_time = sleep_times[i];
2929
// Sleep for {sleep_time} microsceconds.
3030
struct timespec tim = {0, sleep_time * 1000};
3131
struct timespec tim2 = {0, 0};

libc/test/src/time/mktime_test.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
187187
.tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0,
188188
.tm_yday = 0
189189
};
190-
EXPECT_THAT(__llvm_libc::mktime(&tm_data),
191-
Succeeds(TimeConstants::OUT_OF_RANGE_RETURN_VALUE));
190+
EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
192191
}
193192

194193
{
@@ -198,8 +197,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
198197
.tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0,
199198
.tm_yday = 0
200199
};
201-
EXPECT_THAT(__llvm_libc::mktime(&tm_data),
202-
Succeeds(TimeConstants::OUT_OF_RANGE_RETURN_VALUE));
200+
EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
203201
}
204202

205203
{
@@ -209,8 +207,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
209207
.tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0,
210208
.tm_yday = 0
211209
};
212-
EXPECT_THAT(__llvm_libc::mktime(&tm_data),
213-
Succeeds(TimeConstants::OUT_OF_RANGE_RETURN_VALUE));
210+
EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
214211
}
215212

216213
{
@@ -220,8 +217,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
220217
.tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0,
221218
.tm_yday = 0
222219
};
223-
EXPECT_THAT(__llvm_libc::mktime(&tm_data),
224-
Succeeds(TimeConstants::OUT_OF_RANGE_RETURN_VALUE));
220+
EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
225221
}
226222

227223
{
@@ -231,8 +227,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
231227
.tm_mon = Month::FEBRUARY, .tm_year = tm_year(2038), .tm_wday = 0,
232228
.tm_yday = 0
233229
};
234-
EXPECT_THAT(__llvm_libc::mktime(&tm_data),
235-
Succeeds(TimeConstants::OUT_OF_RANGE_RETURN_VALUE));
230+
EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
236231
}
237232

238233
{
@@ -242,8 +237,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
242237
.tm_mon = Month::JANUARY, .tm_year = tm_year(2039), .tm_wday = 0,
243238
.tm_yday = 0
244239
};
245-
EXPECT_THAT(__llvm_libc::mktime(&tm_data),
246-
Succeeds(TimeConstants::OUT_OF_RANGE_RETURN_VALUE));
240+
EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW));
247241
}
248242
}
249243

libcxx/CMakeLists.txt

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,24 @@ option(LIBCXX_ENABLE_WIDE_CHARACTERS
8787
support the C functionality for wide characters. When wide characters are
8888
not supported, several parts of the library will be disabled, notably the
8989
wide character specializations of std::basic_string." ON)
90+
91+
# To use time zone support in libc++ the platform needs to have the IANA
92+
# database installed. Libc++ will fail to build if this is enabled on a
93+
# platform that does not provide the IANA database. The default is set to the
94+
# current implementation state on the different platforms.
95+
#
96+
# TODO TZDB make the default always ON when most platforms ship with the IANA
97+
# database.
98+
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
99+
set(ENABLE_TIME_ZONE_DATABASE_DEFAULT ON)
100+
else()
101+
set(ENABLE_TIME_ZONE_DATABASE_DEFAULT OFF)
102+
endif()
103+
option(LIBCXX_ENABLE_TIME_ZONE_DATABASE
104+
"Whether to include support for time zones in the library. Disabling
105+
time zone support can be useful when porting to platforms that don't
106+
ship the IANA time zone database. When time zones are not supported,
107+
time zone support in <chrono> will be disabled." ${ENABLE_TIME_ZONE_DATABASE_DEFAULT})
90108
option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS
91109
"Whether to turn on vendor availability annotations on declarations that depend
92110
on definitions in a shared library. By default, we assume that we're not building
@@ -334,21 +352,21 @@ endif()
334352
if (LIBCXX_HAS_EXTERNAL_THREAD_API)
335353
if (LIBCXX_HAS_PTHREAD_API)
336354
message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API"
337-
"and LIBCXX_HAS_PTHREAD_API cannot be both"
338-
"set to ON at the same time.")
355+
" and LIBCXX_HAS_PTHREAD_API cannot be both"
356+
" set to ON at the same time.")
339357
endif()
340358
if (LIBCXX_HAS_WIN32_THREAD_API)
341359
message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API"
342-
"and LIBCXX_HAS_WIN32_THREAD_API cannot be both"
343-
"set to ON at the same time.")
360+
" and LIBCXX_HAS_WIN32_THREAD_API cannot be both"
361+
" set to ON at the same time.")
344362
endif()
345363
endif()
346364

347365
if (LIBCXX_HAS_PTHREAD_API)
348366
if (LIBCXX_HAS_WIN32_THREAD_API)
349367
message(FATAL_ERROR "The options LIBCXX_HAS_PTHREAD_API"
350-
"and LIBCXX_HAS_WIN32_THREAD_API cannot be both"
351-
"set to ON at the same time.")
368+
" and LIBCXX_HAS_WIN32_THREAD_API cannot be both"
369+
" set to ON at the same time.")
352370
endif()
353371
endif()
354372

@@ -756,6 +774,7 @@ config_define_if_not(LIBCXX_ENABLE_LOCALIZATION _LIBCPP_HAS_NO_LOCALIZATION)
756774
config_define_if_not(LIBCXX_ENABLE_UNICODE _LIBCPP_HAS_NO_UNICODE)
757775
config_define_if_not(LIBCXX_ENABLE_WIDE_CHARACTERS _LIBCPP_HAS_NO_WIDE_CHARACTERS)
758776
config_define_if_not(LIBCXX_ENABLE_STD_MODULES _LIBCPP_HAS_NO_STD_MODULES)
777+
config_define_if_not(LIBCXX_ENABLE_TIME_ZONE_DATABASE _LIBCPP_HAS_NO_TIME_ZONE_DATABASE)
759778
config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
760779
if (LIBCXX_HARDENING_MODE STREQUAL "hardened")
761780
config_define(1 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set(LIBCXX_ENABLE_TIME_ZONE_DATABASE OFF CACHE BOOL "")

libcxx/docs/BuildingLibcxx.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,15 @@ libc++ specific options
255255
support for ``wchar_t``. This is especially useful in embedded settings where
256256
C Standard Libraries don't always provide all the usual bells and whistles.
257257

258+
.. option:: LIBCXX_ENABLE_TIME_ZONE_DATABASE:BOOL
259+
260+
**Default**: ``ON``
261+
262+
Whether to include support for time zones in the library. Disabling
263+
time zone support can be useful when porting to platforms that don't
264+
ship the IANA time zone database. When time zones are not supported,
265+
time zone support in <chrono> will be disabled.
266+
258267
.. option:: LIBCXX_INSTALL_LIBRARY_DIR:PATH
259268

260269
**Default**: ``lib${LIBCXX_LIBDIR_SUFFIX}``

0 commit comments

Comments
 (0)