Skip to content

Commit 1438623

Browse files
committed
[𝘀𝗽𝗿] changes introduced through rebase
Created using spr 1.3.4 [skip ci]
2 parents c394171 + d3c0ed3 commit 1438623

Some content is hidden

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

42 files changed

+567
-309
lines changed

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ namespace bolt {
184184
/// Emits debug information into .debug_info or .debug_types section.
185185
class DIEStreamer : public DwarfStreamer {
186186
DIEBuilder *DIEBldr;
187-
DWARFRewriter &Rewriter;
188187
GDBIndex &GDBIndexSection;
189188

190189
private:
@@ -285,7 +284,7 @@ class DIEStreamer : public DwarfStreamer {
285284
raw_pwrite_stream &OutFile,
286285
DWARFLinkerBase::MessageHandlerTy Warning)
287286
: DwarfStreamer(OutFileType, OutFile, Warning), DIEBldr(DIEBldr),
288-
Rewriter(Rewriter), GDBIndexSection(GDBIndexSection) {};
287+
GDBIndexSection(GDBIndexSection) {};
289288

290289
using DwarfStreamer::emitCompileUnitHeader;
291290

clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def main():
242242
filename = None
243243
lines_by_file = {}
244244
for line in sys.stdin:
245-
match = re.search('^\+\+\+\ "?(.*?/){%s}([^ \t\n"]*)' % args.p, line)
245+
match = re.search('^\\+\\+\\+\\ "?(.*?/){%s}([^ \t\n"]*)' % args.p, line)
246246
if match:
247247
filename = match.group(2)
248248
if filename is None:
@@ -255,7 +255,7 @@ def main():
255255
if not re.match("^%s$" % args.iregex, filename, re.IGNORECASE):
256256
continue
257257

258-
match = re.search("^@@.*\+(\d+)(,(\d+))?", line)
258+
match = re.search(r"^@@.*\+(\d+)(,(\d+))?", line)
259259
if match:
260260
start_line = int(match.group(1))
261261
line_count = 1
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.. title:: clang-tidy - clang-analyzer-cplusplus.ArrayDelete
2+
.. meta::
3+
:http-equiv=refresh: 5;URL=https://clang.llvm.org/docs/analyzer/checkers.html#cplusplus-arraydelete
4+
5+
clang-analyzer-cplusplus.ArrayDelete
6+
====================================
7+
8+
Reports destructions of arrays of polymorphic objects that are destructed as
9+
their base class.
10+
11+
The `clang-analyzer-cplusplus.ArrayDelete` check is an alias, please see
12+
`Clang Static Analyzer Available Checkers
13+
<https://clang.llvm.org/docs/analyzer/checkers.html#cplusplus-arraydelete>`_
14+
for more information.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. title:: clang-tidy - clang-analyzer-security.SetgidSetuidOrder
2+
3+
clang-analyzer-security.SetgidSetuidOrder
4+
=========================================
5+
6+
Warn on possible reversed order of 'setgid(getgid()))' and 'setuid(getuid())'
7+
(CERT: POS36-C).
8+
9+
The clang-analyzer-security.SetgidSetuidOrder check is an alias of
10+
Clang Static Analyzer security.SetgidSetuidOrder.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.. title:: clang-tidy - clang-analyzer-unix.Stream
2+
.. meta::
3+
:http-equiv=refresh: 5;URL=https://clang.llvm.org/docs/analyzer/checkers.html#unix-stream
4+
5+
clang-analyzer-unix.Stream
6+
==========================
7+
8+
Check stream handling functions.
9+
10+
The `clang-analyzer-unix.Stream` check is an alias, please see
11+
`Clang Static Analyzer Available Checkers
12+
<https://clang.llvm.org/docs/analyzer/checkers.html#unix-stream>`_
13+
for more information.

clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def get_checkers(checkers_td, checkers_rst):
5959
"clang-analyzer-" + checker_package_prefix + "." + checker_name
6060
)
6161
anchor_url = re.sub(
62-
"\.", "-", checker_package_prefix + "." + checker_name
62+
r"\.", "-", checker_package_prefix + "." + checker_name
6363
).lower()
6464

6565
if not hidden and "alpha" not in full_package_name.lower():
@@ -130,7 +130,7 @@ def generate_documentation(checker, has_documentation):
130130
def update_documentation_list(checkers):
131131
with open(os.path.join(__location__, "list.rst"), "r+") as f:
132132
f_text = f.read()
133-
check_text = f_text.split(".. csv-table:: Aliases..\n")[1]
133+
check_text = f_text.split(':header: "Name", "Redirect", "Offers fixes"\n')[1]
134134
checks = [x for x in check_text.split("\n") if ":header:" not in x and x]
135135
old_check_text = "\n".join(checks)
136136
checks = [x for x in checks if "clang-analyzer-" not in x]

clang-tools-extra/docs/clang-tidy/checks/list.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ Check aliases
443443
:doc:`clang-analyzer-core.uninitialized.CapturedBlockVariable <clang-analyzer/core.uninitialized.CapturedBlockVariable>`, `Clang Static Analyzer core.uninitialized.CapturedBlockVariable <https://clang.llvm.org/docs/analyzer/checkers.html#core-uninitialized-capturedblockvariable>`_,
444444
:doc:`clang-analyzer-core.uninitialized.NewArraySize <clang-analyzer/core.uninitialized.NewArraySize>`, `Clang Static Analyzer core.uninitialized.NewArraySize <https://clang.llvm.org/docs/analyzer/checkers.html#core-uninitialized-newarraysize>`_,
445445
:doc:`clang-analyzer-core.uninitialized.UndefReturn <clang-analyzer/core.uninitialized.UndefReturn>`, `Clang Static Analyzer core.uninitialized.UndefReturn <https://clang.llvm.org/docs/analyzer/checkers.html#core-uninitialized-undefreturn>`_,
446+
:doc:`clang-analyzer-cplusplus.ArrayDelete <clang-analyzer/cplusplus.ArrayDelete>`, `Clang Static Analyzer cplusplus.ArrayDelete <https://clang.llvm.org/docs/analyzer/checkers.html#cplusplus-arraydelete>`_,
446447
:doc:`clang-analyzer-cplusplus.InnerPointer <clang-analyzer/cplusplus.InnerPointer>`, `Clang Static Analyzer cplusplus.InnerPointer <https://clang.llvm.org/docs/analyzer/checkers.html#cplusplus-innerpointer>`_,
447448
:doc:`clang-analyzer-cplusplus.Move <clang-analyzer/cplusplus.Move>`, Clang Static Analyzer cplusplus.Move,
448449
:doc:`clang-analyzer-cplusplus.NewDelete <clang-analyzer/cplusplus.NewDelete>`, `Clang Static Analyzer cplusplus.NewDelete <https://clang.llvm.org/docs/analyzer/checkers.html#cplusplus-newdelete>`_,
@@ -497,6 +498,7 @@ Check aliases
497498
:doc:`clang-analyzer-osx.coreFoundation.containers.OutOfBounds <clang-analyzer/osx.coreFoundation.containers.OutOfBounds>`, `Clang Static Analyzer osx.coreFoundation.containers.OutOfBounds <https://clang.llvm.org/docs/analyzer/checkers.html#osx-corefoundation-containers-outofbounds>`_,
498499
:doc:`clang-analyzer-osx.coreFoundation.containers.PointerSizedValues <clang-analyzer/osx.coreFoundation.containers.PointerSizedValues>`, `Clang Static Analyzer osx.coreFoundation.containers.PointerSizedValues <https://clang.llvm.org/docs/analyzer/checkers.html#osx-corefoundation-containers-pointersizedvalues>`_,
499500
:doc:`clang-analyzer-security.FloatLoopCounter <clang-analyzer/security.FloatLoopCounter>`, `Clang Static Analyzer security.FloatLoopCounter <https://clang.llvm.org/docs/analyzer/checkers.html#security-floatloopcounter>`_,
501+
:doc:`clang-analyzer-security.SetgidSetuidOrder <clang-analyzer/security.SetgidSetuidOrder>`, Clang Static Analyzer security.SetgidSetuidOrder,
500502
:doc:`clang-analyzer-security.cert.env.InvalidPtr <clang-analyzer/security.cert.env.InvalidPtr>`, `Clang Static Analyzer security.cert.env.InvalidPtr <https://clang.llvm.org/docs/analyzer/checkers.html#security-cert-env-invalidptr>`_,
501503
:doc:`clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling <clang-analyzer/security.insecureAPI.DeprecatedOrUnsafeBufferHandling>`, `Clang Static Analyzer security.insecureAPI.DeprecatedOrUnsafeBufferHandling <https://clang.llvm.org/docs/analyzer/checkers.html#security-insecureapi-deprecatedorunsafebufferhandling>`_,
502504
:doc:`clang-analyzer-security.insecureAPI.UncheckedReturn <clang-analyzer/security.insecureAPI.UncheckedReturn>`, `Clang Static Analyzer security.insecureAPI.UncheckedReturn <https://clang.llvm.org/docs/analyzer/checkers.html#security-insecureapi-uncheckedreturn>`_,
@@ -517,6 +519,7 @@ Check aliases
517519
:doc:`clang-analyzer-unix.MallocSizeof <clang-analyzer/unix.MallocSizeof>`, `Clang Static Analyzer unix.MallocSizeof <https://clang.llvm.org/docs/analyzer/checkers.html#unix-mallocsizeof>`_,
518520
:doc:`clang-analyzer-unix.MismatchedDeallocator <clang-analyzer/unix.MismatchedDeallocator>`, `Clang Static Analyzer unix.MismatchedDeallocator <https://clang.llvm.org/docs/analyzer/checkers.html#unix-mismatcheddeallocator>`_,
519521
:doc:`clang-analyzer-unix.StdCLibraryFunctions <clang-analyzer/unix.StdCLibraryFunctions>`, `Clang Static Analyzer unix.StdCLibraryFunctions <https://clang.llvm.org/docs/analyzer/checkers.html#unix-stdclibraryfunctions>`_,
522+
:doc:`clang-analyzer-unix.Stream <clang-analyzer/unix.Stream>`, `Clang Static Analyzer unix.Stream <https://clang.llvm.org/docs/analyzer/checkers.html#unix-stream>`_,
520523
:doc:`clang-analyzer-unix.Vfork <clang-analyzer/unix.Vfork>`, `Clang Static Analyzer unix.Vfork <https://clang.llvm.org/docs/analyzer/checkers.html#unix-vfork>`_,
521524
:doc:`clang-analyzer-unix.cstring.BadSizeArg <clang-analyzer/unix.cstring.BadSizeArg>`, `Clang Static Analyzer unix.cstring.BadSizeArg <https://clang.llvm.org/docs/analyzer/checkers.html#unix-cstring-badsizearg>`_,
522525
:doc:`clang-analyzer-unix.cstring.NullArg <clang-analyzer/unix.cstring.NullArg>`, `Clang Static Analyzer unix.cstring.NullArg <https://clang.llvm.org/docs/analyzer/checkers.html#unix-cstring-nullarg>`_,

clang/CMakeLists.txt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -848,23 +848,17 @@ if (CLANG_ENABLE_BOOTSTRAP)
848848
set(CLANG_BOOTSTRAP_TARGETS check-llvm check-clang check-all)
849849
endif()
850850
foreach(target ${CLANG_BOOTSTRAP_TARGETS})
851-
# Install targets have side effects, so we always want to execute them.
852-
# "install" is reserved by CMake and can't be used as a step name for
853-
# ExternalProject_Add_Step, so we can match against "^install-" instead of
854-
# "^install" to get a tighter match. CMake's installation scripts already
855-
# skip up-to-date files, so there's no behavior change if you install to the
856-
# same destination multiple times.
857-
if(target MATCHES "^install-")
858-
set(step_always ON)
859-
else()
860-
set(step_always OFF)
861-
endif()
862851

863852
ExternalProject_Add_Step(${NEXT_CLANG_STAGE} ${target}
864853
COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target ${target}
865854
COMMENT "Performing ${target} for '${NEXT_CLANG_STAGE}'"
866855
DEPENDEES configure
867-
ALWAYS ${step_always}
856+
# We need to set ALWAYS to ON here, otherwise these targets won't be
857+
# built on a second invocation of ninja. The targets have their own
858+
# logic to determine if they should build or not so setting ALWAYS ON
859+
# here does not mean the targets will always rebuild it just means that
860+
# they will check their dependenices and see if they need to be built.
861+
ALWAYS ON
868862
EXCLUDE_FROM_MAIN ON
869863
USES_TERMINAL 1
870864
)

clang/cmake/caches/Release.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ endfunction()
3030
#
3131
# cmake -D LLVM_RELEASE_ENABLE_PGO=ON -C Release.cmake
3232
set(LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "")
33-
set(LLVM_RELEASE_ENABLE_PGO OFF CACHE BOOL "")
33+
set(LLVM_RELEASE_ENABLE_PGO ON CACHE BOOL "")
3434
set(LLVM_RELEASE_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
3535
set(LLVM_RELEASE_ENABLE_PROJECTS "clang;lld;lldb;clang-tools-extra;bolt;polly;mlir;flang" CACHE STRING "")
3636
# Note we don't need to add install here, since it is one of the pre-defined

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4512,6 +4512,19 @@ llvm::Constant *CodeGenModule::GetOrCreateMultiVersionResolver(GlobalDecl GD) {
45124512
return Resolver;
45134513
}
45144514

4515+
bool CodeGenModule::shouldDropDLLAttribute(const Decl *D,
4516+
const llvm::GlobalValue *GV) const {
4517+
auto SC = GV->getDLLStorageClass();
4518+
if (SC == llvm::GlobalValue::DefaultStorageClass)
4519+
return false;
4520+
const Decl *MRD = D->getMostRecentDecl();
4521+
return (((SC == llvm::GlobalValue::DLLImportStorageClass &&
4522+
!MRD->hasAttr<DLLImportAttr>()) ||
4523+
(SC == llvm::GlobalValue::DLLExportStorageClass &&
4524+
!MRD->hasAttr<DLLExportAttr>())) &&
4525+
!shouldMapVisibilityToDLLExport(cast<NamedDecl>(MRD)));
4526+
}
4527+
45154528
/// GetOrCreateLLVMFunction - If the specified mangled name is not in the
45164529
/// module, create and return an llvm Function with the specified type. If there
45174530
/// is something in the module with the specified name, return it potentially
@@ -4564,8 +4577,7 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(
45644577
}
45654578

45664579
// Handle dropped DLL attributes.
4567-
if (D && !D->hasAttr<DLLImportAttr>() && !D->hasAttr<DLLExportAttr>() &&
4568-
!shouldMapVisibilityToDLLExport(cast_or_null<NamedDecl>(D))) {
4580+
if (D && shouldDropDLLAttribute(D, Entry)) {
45694581
Entry->setDLLStorageClass(llvm::GlobalValue::DefaultStorageClass);
45704582
setDSOLocal(Entry);
45714583
}
@@ -4859,8 +4871,7 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, llvm::Type *Ty,
48594871
}
48604872

48614873
// Handle dropped DLL attributes.
4862-
if (D && !D->hasAttr<DLLImportAttr>() && !D->hasAttr<DLLExportAttr>() &&
4863-
!shouldMapVisibilityToDLLExport(D))
4874+
if (D && shouldDropDLLAttribute(D, Entry))
48644875
Entry->setDLLStorageClass(llvm::GlobalValue::DefaultStorageClass);
48654876

48664877
if (LangOpts.OpenMP && !LangOpts.OpenMPSimd && D)

clang/lib/CodeGen/CodeGenModule.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,8 @@ class CodeGenModule : public CodeGenTypeCache {
15941594
}
15951595

15961596
private:
1597+
bool shouldDropDLLAttribute(const Decl *D, const llvm::GlobalValue *GV) const;
1598+
15971599
llvm::Constant *GetOrCreateLLVMFunction(
15981600
StringRef MangledName, llvm::Type *Ty, GlobalDecl D, bool ForVTable,
15991601
bool DontDefer = false, bool IsThunk = false,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %clang_cc1 -triple i686-windows -fdeclspec -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-MS
2+
// RUN: %clang_cc1 -triple i686-windows-itanium -fdeclspec -emit-llvm %s -o - | FileCheck %s
3+
// RUN: %clang_cc1 -triple x86_64-scei-ps4 -fdeclspec -emit-llvm %s -o - | FileCheck %s
4+
// RUN: %clang_cc1 -triple x86_64-sie-ps5 -fdeclspec -emit-llvm %s -o - | FileCheck %s
5+
6+
struct s {
7+
template <bool b = true> static bool f();
8+
};
9+
10+
template <typename T> bool template_using_f(T) { return s::f(); }
11+
12+
bool use_template_using_f() { return template_using_f(0); }
13+
14+
template<>
15+
bool __declspec(dllexport) s::f<true>() { return true; }
16+
17+
// CHECK-MS: dllexport {{.*}} @"??$f@$00@s@@SA_NXZ"
18+
// CHECK: dllexport {{.*}} @_ZN1s1fILb1EEEbv

clang/utils/perf-training/CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if(LLVM_BUILD_INSTRUMENTED)
1515
add_lit_testsuite(generate-profraw "Generating clang PGO data"
1616
${CMAKE_CURRENT_BINARY_DIR}/pgo-data/
1717
EXCLUDE_FROM_CHECK_ALL
18-
DEPENDS clang clear-profraw ${CLANG_PGO_TRAINING_DEPS}
18+
DEPENDS clear-profraw
1919
)
2020

2121
add_custom_target(clear-profraw
@@ -29,10 +29,21 @@ if(LLVM_BUILD_INSTRUMENTED)
2929
if(NOT LLVM_PROFDATA)
3030
message(STATUS "To enable merging PGO data LLVM_PROFDATA has to point to llvm-profdata")
3131
else()
32-
add_custom_target(generate-profdata
32+
add_custom_command(
33+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata
34+
# generate-profraw is a custom_target which are always considered stale.
35+
# If we add it here to 'DEPENDS', then it will always execute and running
36+
# ninja install && ninja check-all will result in the profile data being
37+
# generated twice, and cause the ninja check-all build to fail with errors like:
38+
# `ld.lld: error: Function Import: link error: linking module flags 'ProfileSummary': IDs have conflicting values in`
39+
# Therefor we call the generate-profraw target manually as part of this custom
40+
# command, which will only run if clang or ${CLANG_PGO_TRAINING_DEPS} are updated.
41+
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target generate-profraw
3342
COMMAND "${Python3_EXECUTABLE}" ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/profiles/
3443
COMMENT "Merging profdata"
35-
DEPENDS generate-profraw)
44+
DEPENDS clang ${CLANG_PGO_TRAINING_DEPS}
45+
)
46+
add_custom_target(generate-profdata DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata)
3647
if (CLANG_PGO_TRAINING_DATA_SOURCE_DIR)
3748
llvm_ExternalProject_Add(generate-profraw-external ${CLANG_PGO_TRAINING_DATA_SOURCE_DIR}
3849
USE_TOOLCHAIN EXLUDE_FROM_ALL NO_INSTALL DEPENDS generate-profraw)

libc/include/llvm-libc-macros/float16-macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#if defined(__FLT16_MANT_DIG__) && \
1313
(!defined(__GNUC__) || __GNUC__ >= 13 || defined(__clang__)) && \
14-
!defined(__riscv)
14+
!defined(__arm__) && !defined(_M_ARM) && !defined(__riscv)
1515
#define LIBC_TYPES_HAS_FLOAT16
1616
#endif
1717

0 commit comments

Comments
 (0)