Skip to content

Commit e88d709

Browse files
committed
merge main into amd-staging
Flang team looking into: land and reverted 3/1/25 a8db1fb [flang] update fir.coordinate_of to carry the fields (llvm#127231 subsequent landed and reverted, relates to prev. 9805854 [flang][NFC] clean-up fir.field_index legacy usages in tests (llvm#129219)
2 parents 21215a7 + a557861 commit e88d709

File tree

318 files changed

+5500
-2190
lines changed

Some content is hidden

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

318 files changed

+5500
-2190
lines changed

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,6 @@ class BinaryFunction {
343343
/// True if the function uses ORC format for stack unwinding.
344344
bool HasORC{false};
345345

346-
/// True if the original entry point was patched.
347-
bool IsPatched{false};
348-
349346
/// True if the function contains explicit or implicit indirect branch to its
350347
/// split fragments, e.g., split jump table, landing pad in split fragment
351348
bool HasIndirectTargetToSplitFragment{false};
@@ -1376,9 +1373,6 @@ class BinaryFunction {
13761373
/// Return true if the function uses ORC format for stack unwinding.
13771374
bool hasORC() const { return HasORC; }
13781375

1379-
/// Return true if the original entry point was patched.
1380-
bool isPatched() const { return IsPatched; }
1381-
13821376
const JumpTable *getJumpTable(const MCInst &Inst) const {
13831377
const uint64_t Address = BC.MIB->getJumpTable(Inst);
13841378
return getJumpTableContainingAddress(Address);
@@ -1729,8 +1723,6 @@ class BinaryFunction {
17291723
/// Mark function that should not be emitted.
17301724
void setIgnored();
17311725

1732-
void setIsPatched(bool V) { IsPatched = V; }
1733-
17341726
void setHasIndirectTargetToSplitFragment(bool V) {
17351727
HasIndirectTargetToSplitFragment = V;
17361728
}

bolt/lib/Passes/PatchEntries.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ Error PatchEntries::runOnFunctions(BinaryContext &BC) {
130130
assert(!ColdSize && "unexpected cold code");
131131
assert(HotSize <= PatchSize && "max patch size exceeded");
132132
}
133-
134-
Function.setIsPatched(true);
135133
}
136134
return Error::success();
137135
}

clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,16 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
184184
return;
185185
}
186186
// Check user-defined literals
187-
if (const auto *UDL = Result.Nodes.getNodeAs<UserDefinedLiteral>("used"))
188-
removeFromFoundDecls(UDL->getCalleeDecl());
187+
if (const auto *UDL = Result.Nodes.getNodeAs<UserDefinedLiteral>("used")) {
188+
const Decl *CalleeDecl = UDL->getCalleeDecl();
189+
if (const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl)) {
190+
if (const FunctionTemplateDecl *FPT = FD->getPrimaryTemplate()) {
191+
removeFromFoundDecls(FPT);
192+
return;
193+
}
194+
}
195+
removeFromFoundDecls(CalleeDecl);
196+
}
189197
}
190198

191199
void UnusedUsingDeclsCheck::removeFromFoundDecls(const Decl *D) {

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ Changes in existing checks
138138
<clang-tidy/checks/performance/move-const-arg>` check by fixing false negatives
139139
on ternary operators calling ``std::move``.
140140

141+
- Improved :doc:`misc-unused-using-decls
142+
<clang-tidy/checks/misc/unused-using-decls>` check by fixing false positives
143+
on ``operator""`` with template parameters.
144+
141145
Removed checks
142146
^^^^^^^^^^^^^^
143147

clang-tools-extra/test/clang-tidy/checkers/misc/unused-using-decls.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,19 @@ using gh69714::StructGH69714_1;
222222
using gh69714::StructGH69714_2;
223223
struct StructGH69714_1 a;
224224
struct StructGH69714_2 *b;
225+
226+
namespace gh53444 {
227+
namespace my_literals {
228+
template <char... Ts>
229+
int operator""_r() {
230+
return {};
231+
}
232+
}
233+
234+
using my_literals::operator"" _r;
235+
236+
int foo() {
237+
auto x2 = 123_r;
238+
}
239+
240+
}

clang/cmake/caches/BOLT.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
22
set(CLANG_BOLT "INSTRUMENT" CACHE STRING "")
33
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--emit-relocs,-znow" CACHE STRING "")
4+
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--emit-relocs,-znow" CACHE STRING "")
45

56
set(LLVM_ENABLE_PROJECTS "bolt;clang" CACHE STRING "")
67
set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")

clang/docs/analyzer/checkers.rst

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,6 @@ core.NullDereference (C, C++, ObjC)
118118
"""""""""""""""""""""""""""""""""""
119119
Check for dereferences of null pointers.
120120

121-
This checker specifically does
122-
not report null pointer dereferences for x86 and x86-64 targets when the
123-
address space is 256 (x86 GS Segment), 257 (x86 FS Segment), or 258 (x86 SS
124-
segment). See `X86/X86-64 Language Extensions
125-
<https://clang.llvm.org/docs/LanguageExtensions.html#memory-references-to-specified-segments>`__
126-
for reference.
127-
128-
The ``SuppressAddressSpaces`` option suppresses
129-
warnings for null dereferences of all pointers with address spaces. You can
130-
disable this behavior with the option
131-
``-analyzer-config core.NullDereference:SuppressAddressSpaces=false``.
132-
*Defaults to true*.
133-
134121
.. code-block:: objc
135122
136123
// C
@@ -170,6 +157,19 @@ disable this behavior with the option
170157
obj->x = 1; // warn
171158
}
172159
160+
Null pointer dereferences of pointers with address spaces are not always defined
161+
as error. Specifically on x86/x86-64 target if the pointer address space is
162+
256 (x86 GS Segment), 257 (x86 FS Segment), or 258 (x86 SS Segment), a null
163+
dereference is not defined as error. See `X86/X86-64 Language Extensions
164+
<https://clang.llvm.org/docs/LanguageExtensions.html#memory-references-to-specified-segments>`__
165+
for reference.
166+
167+
If the analyzer option ``suppress-dereferences-from-any-address-space`` is set
168+
to true (the default value), then this checker never reports dereference of
169+
pointers with a specified address space. If the option is set to false, then
170+
reports from the specific x86 address spaces 256, 257 and 258 are still
171+
suppressed, but null dereferences from other address spaces are reported.
172+
173173
.. _core-StackAddressEscape:
174174
175175
core.StackAddressEscape (C)
@@ -2919,6 +2919,41 @@ Check for assignment of a fixed address to a pointer.
29192919
p = (int *) 0x10000; // warn
29202920
}
29212921
2922+
.. _alpha-core-FixedAddressDereference:
2923+
2924+
alpha.core.FixedAddressDereference (C, C++, ObjC)
2925+
"""""""""""""""""""""""""""""""""""""""""""""""""
2926+
Check for dereferences of fixed addresses.
2927+
2928+
A pointer contains a fixed address if it was set to a hard-coded value or it
2929+
becomes otherwise obvious that at that point it can have only a single specific
2930+
value.
2931+
2932+
.. code-block:: c
2933+
2934+
void test1() {
2935+
int *p = (int *)0x020;
2936+
int x = p[0]; // warn
2937+
}
2938+
2939+
void test2(int *p) {
2940+
if (p == (int *)-1)
2941+
*p = 0; // warn
2942+
}
2943+
2944+
void test3() {
2945+
int (*p_function)(char, char);
2946+
p_function = (int (*)(char, char))0x04080;
2947+
int x = (*p_function)('x', 'y'); // NO warning yet at functon pointer calls
2948+
}
2949+
2950+
If the analyzer option ``suppress-dereferences-from-any-address-space`` is set
2951+
to true (the default value), then this checker never reports dereference of
2952+
pointers with a specified address space. If the option is set to false, then
2953+
reports from the specific x86 address spaces 256, 257 and 258 are still
2954+
suppressed, but fixed address dereferences from other address spaces are
2955+
reported.
2956+
29222957
.. _alpha-core-PointerArithm:
29232958
29242959
alpha.core.PointerArithm (C)

clang/include/clang-c/Index.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3061,6 +3061,18 @@ enum CXCallingConv {
30613061
CXCallingConv_M68kRTD = 19,
30623062
CXCallingConv_PreserveNone = 20,
30633063
CXCallingConv_RISCVVectorCall = 21,
3064+
CXCallingConv_RISCVVLSCall_32 = 22,
3065+
CXCallingConv_RISCVVLSCall_64 = 23,
3066+
CXCallingConv_RISCVVLSCall_128 = 24,
3067+
CXCallingConv_RISCVVLSCall_256 = 25,
3068+
CXCallingConv_RISCVVLSCall_512 = 26,
3069+
CXCallingConv_RISCVVLSCall_1024 = 27,
3070+
CXCallingConv_RISCVVLSCall_2048 = 28,
3071+
CXCallingConv_RISCVVLSCall_4096 = 29,
3072+
CXCallingConv_RISCVVLSCall_8192 = 30,
3073+
CXCallingConv_RISCVVLSCall_16384 = 31,
3074+
CXCallingConv_RISCVVLSCall_32768 = 32,
3075+
CXCallingConv_RISCVVLSCall_65536 = 33,
30643076

30653077
CXCallingConv_Invalid = 100,
30663078
CXCallingConv_Unexposed = 200

clang/include/clang/AST/Type.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
19461946
/// Extra information which affects how the function is called, like
19471947
/// regparm and the calling convention.
19481948
LLVM_PREFERRED_TYPE(CallingConv)
1949-
unsigned ExtInfo : 13;
1949+
unsigned ExtInfo : 14;
19501950

19511951
/// The ref-qualifier associated with a \c FunctionProtoType.
19521952
///
@@ -4438,19 +4438,16 @@ class FunctionType : public Type {
44384438
// Type::FunctionTypeBitfields::ExtInfo as well.
44394439

44404440
// | CC |noreturn|produces|nocallersavedregs|regparm|nocfcheck|cmsenscall|
4441-
// |0 .. 4| 5 | 6 | 7 |8 .. 10| 11 | 12 |
4441+
// |0 .. 5| 6 | 7 | 8 |9 .. 11| 12 | 13 |
44424442
//
44434443
// regparm is either 0 (no regparm attribute) or the regparm value+1.
4444-
enum { CallConvMask = 0x1F };
4445-
enum { NoReturnMask = 0x20 };
4446-
enum { ProducesResultMask = 0x40 };
4447-
enum { NoCallerSavedRegsMask = 0x80 };
4448-
enum {
4449-
RegParmMask = 0x700,
4450-
RegParmOffset = 8
4451-
};
4452-
enum { NoCfCheckMask = 0x800 };
4453-
enum { CmseNSCallMask = 0x1000 };
4444+
enum { CallConvMask = 0x3F };
4445+
enum { NoReturnMask = 0x40 };
4446+
enum { ProducesResultMask = 0x80 };
4447+
enum { NoCallerSavedRegsMask = 0x100 };
4448+
enum { RegParmMask = 0xe00, RegParmOffset = 9 };
4449+
enum { NoCfCheckMask = 0x1000 };
4450+
enum { CmseNSCallMask = 0x2000 };
44544451
uint16_t Bits = CC_C;
44554452

44564453
ExtInfo(unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}

clang/include/clang/Basic/Attr.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3316,6 +3316,14 @@ def RISCVVectorCC: DeclOrTypeAttr, TargetSpecificAttr<TargetRISCV> {
33163316
let Documentation = [RISCVVectorCCDocs];
33173317
}
33183318

3319+
def RISCVVLSCC: DeclOrTypeAttr, TargetSpecificAttr<TargetRISCV> {
3320+
let Spellings = [CXX11<"riscv", "vls_cc">,
3321+
C23<"riscv", "vls_cc">,
3322+
Clang<"riscv_vls_cc">];
3323+
let Args = [UnsignedArgument<"VectorWidth", /*opt*/1>];
3324+
let Documentation = [RISCVVLSCCDocs];
3325+
}
3326+
33193327
def Target : InheritableAttr {
33203328
let Spellings = [GCC<"target">];
33213329
let Args = [StringArgument<"featuresStr">];

0 commit comments

Comments
 (0)