Skip to content

Commit 11f6a4a

Browse files
authored
merge main into amd-staging (llvm#3105)
2 parents d22d718 + 6a93d59 commit 11f6a4a

Some content is hidden

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

52 files changed

+2708
-171
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Potentially Breaking Changes
3636

3737
- The Objective-C ARC migrator (ARCMigrate) has been removed.
3838
- Fix missing diagnostics for uses of declarations when performing typename access,
39-
such as when performing member access on a '[[deprecated]]' type alias.
39+
such as when performing member access on a ``[[deprecated]]`` type alias.
4040
(#GH58547)
4141
- For ARM targets when compiling assembly files, the features included in the selected CPU
4242
or Architecture's FPU are included. If you wish not to use a specific feature,
@@ -969,6 +969,7 @@ Bug Fixes to C++ Support
969969
- Fix a bug where private access specifier of overloaded function not respected. (#GH107629)
970970
- Correctly handles calling an explicit object member function template overload set
971971
through its address (``(&Foo::bar<baz>)()``).
972+
- Fix a crash when using an explicit object parameter in a non-member function. (#GH113185)
972973
- Fix a crash when forming an invalid call to an operator with an explicit object member. (#GH147121)
973974
- Correctly handle allocations in the condition of a ``if constexpr``.(#GH120197) (#GH134820)
974975
- Fixed a crash when handling invalid member using-declaration in C++20+ mode. (#GH63254)

clang/include/clang/CIR/Dialect/Passes.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def CIRFlattenCFG : Pass<"cir-flatten-cfg"> {
7373
}
7474

7575
def LoweringPrepare : Pass<"cir-lowering-prepare"> {
76-
let summary = "Lower to more fine-grained CIR operations before lowering to
77-
other dialects";
76+
let summary = "Lower to more fine-grained CIR operations before lowering to "
77+
"other dialects";
7878
let description = [{
7979
This pass does preparation work for lowering to other dialects. For example,
8080
it may expand the global variable initialziation in a more ABI-friendly form.

clang/include/clang/Sema/DeclSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,7 @@ class Declarator {
19181918
/// parsed. This is pushed from the identifier out, which means that element
19191919
/// #0 will be the most closely bound to the identifier, and
19201920
/// DeclTypeInfo.back() will be the least closely bound.
1921-
SmallVector<DeclaratorChunk, 8> DeclTypeInfo;
1921+
SmallVector<DeclaratorChunk, 4> DeclTypeInfo;
19221922

19231923
/// InvalidType - Set by Sema::GetTypeForDeclarator().
19241924
LLVM_PREFERRED_TYPE(bool)

clang/include/clang/Sema/ParsedAttr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ class AttributePool {
678678
friend class AttributeFactory;
679679
friend class ParsedAttributes;
680680
AttributeFactory &Factory;
681-
llvm::SmallVector<ParsedAttr *> Attrs;
681+
llvm::SmallVector<ParsedAttr *, 2> Attrs;
682682

683683
void *allocate(size_t size) {
684684
return Factory.allocate(size);
@@ -808,7 +808,7 @@ class AttributePool {
808808

809809
class ParsedAttributesView {
810810
friend class AttributePool;
811-
using VecTy = llvm::SmallVector<ParsedAttr *>;
811+
using VecTy = llvm::SmallVector<ParsedAttr *, 2>;
812812
using SizeType = decltype(std::declval<VecTy>().size());
813813

814814
public:

clang/lib/CodeGen/CGObjCGNU.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,8 +1942,9 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
19421942
// struct objc_class *sibling_class
19431943
classFields.addNullPointer(PtrTy);
19441944
// struct objc_protocol_list *protocols;
1945-
auto RuntimeProtocols = GetRuntimeProtocolList(classDecl->protocol_begin(),
1946-
classDecl->protocol_end());
1945+
auto RuntimeProtocols =
1946+
GetRuntimeProtocolList(classDecl->all_referenced_protocol_begin(),
1947+
classDecl->all_referenced_protocol_end());
19471948
SmallVector<llvm::Constant *, 16> Protocols;
19481949
for (const auto *I : RuntimeProtocols)
19491950
Protocols.push_back(GenerateProtocolRef(I));

clang/lib/Sema/SemaType.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4860,7 +4860,9 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
48604860
S.Diag(First->getBeginLoc(),
48614861
diag::err_explicit_object_parameter_invalid)
48624862
<< First->getSourceRange();
4863-
4863+
// Do let non-member function have explicit parameters
4864+
// to not break assumptions elsewhere in the code.
4865+
First->setExplicitObjectParameterLoc(SourceLocation());
48644866
D.setInvalidType();
48654867
AreDeclaratorChunksValid = false;
48664868
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -fobjc-runtime=gnustep-2.2 -emit-llvm -o - %s | FileCheck %s
2+
3+
@protocol BaseProtocol
4+
@end
5+
6+
@protocol ExtendedProtocol
7+
@end
8+
9+
@interface TestClass <BaseProtocol>
10+
11+
-(void) Meth;
12+
@end
13+
14+
@interface TestClass () <BaseProtocol, ExtendedProtocol>
15+
@end
16+
17+
@implementation TestClass
18+
@end
19+
20+
// Check that we emit metadata for both protocols
21+
// CHECK: @._OBJC_PROTOCOL_ExtendedProtocol = global
22+
// CHECK: @._OBJC_PROTOCOL_BaseProtocol = global
23+
24+
// Check that we deduplicate the protocol list
25+
// CHECK: @.objc_protocol_list{{\.[0-9]*}} = internal global { ptr, i64, [2 x ptr] }
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %clang_cc1 -triple x86_64-linux-gnu -gkey-instructions %s -debug-info-kind=line-tables-only -gno-column-info -emit-llvm -o - \
2+
// RUN: | FileCheck %s
3+
4+
// Array cookie store doesn't need to be a key instruction.
5+
6+
struct a { char c; ~a(); };
7+
void b() { new a[2]; }
8+
9+
// CHECK: %call = call {{.*}}ptr @_Znam(i64 noundef 10)
10+
// CHECK-NEXT: store i64 2, ptr %call, align 8, !dbg [[DBG:!.*]]
11+
12+
// CHECK: [[DBG]] = !DILocation(line: 7, scope: ![[#]])

clang/test/SemaCXX/cxx2b-deducing-this.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,3 +1347,13 @@ int main() {
13471347
// expected-note@#S3-f-cand2 {{candidate function not viable: no known conversion from 'S3' to 'int' for object argument}}
13481348
}
13491349
}
1350+
1351+
namespace GH113185 {
1352+
1353+
void Bar(this int) { // expected-note {{candidate function}}
1354+
// expected-error@-1 {{an explicit object parameter cannot appear in a non-member function}}
1355+
Bar(0);
1356+
Bar(); // expected-error {{no matching function for call to 'Bar'}}
1357+
}
1358+
1359+
}

libclc/CMakeLists.txt

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -164,34 +164,14 @@ endif()
164164

165165
list( SORT LIBCLC_TARGETS_TO_BUILD )
166166

167-
# Construct LLVM version define
168-
set( LLVM_VERSION_DEFINE "-DHAVE_LLVM=0x${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}" )
169-
170167
# This needs to be set before any target that needs it
171168
# We need to use LLVM_INCLUDE_DIRS here, because if we are linking to an
172169
# llvm build directory, this includes $src/llvm/include which is where all the
173170
# headers are not $build/include/ which is what LLVM_INCLUDE_DIR is set to.
174171
include_directories( ${LLVM_INCLUDE_DIRS} )
175172

176-
# Setup prepare_builtins tools
177-
set(LLVM_LINK_COMPONENTS
178-
BitReader
179-
BitWriter
180-
Core
181-
IRReader
182-
Support
183-
)
184-
if( LIBCLC_STANDALONE_BUILD )
185-
add_llvm_executable( prepare_builtins utils/prepare-builtins.cpp )
186-
set( prepare_builtins_exe prepare_builtins )
187-
set( prepare_builtins_target prepare_builtins )
188-
else()
189-
add_llvm_utility( prepare_builtins utils/prepare-builtins.cpp )
190-
setup_host_tool( prepare_builtins PREPARE_BUILTINS prepare_builtins_exe prepare_builtins_target )
191-
endif()
192-
target_compile_definitions( prepare_builtins PRIVATE ${LLVM_VERSION_DEFINE} )
193-
# These were not properly reported in early LLVM and we don't need them
194-
target_compile_options( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )
173+
# Configure prepare_builtins
174+
add_subdirectory( utils )
195175

196176
# Setup arch devices
197177
set( r600--_devices cedar cypress barts cayman )

0 commit comments

Comments
 (0)