Skip to content

Commit be3d846

Browse files
committed
[CIR][CIRGen] Remove -clangir-disable-emit-cxx-default
This is a leftover from when ClangIR was initially focused on analysis and could ignore default method generation. We now handle default methods and should generate them in all cases. This fixes several bugs: - Default methods weren't emitted when emitting LLVM, only CIR. - Default methods only referenced by other default methods weren't emitted. ghstack-source-id: baf60aa ghstack-comment-id: 2513346334 Pull Request resolved: #1198
1 parent 0cb7536 commit be3d846

32 files changed

+66
-92
lines changed

clang/include/clang/CIR/CIRGenerator.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ class CIRGenerator : public clang::ASTConsumer {
102102
bool verifyModule();
103103

104104
void emitDeferredDecls();
105-
void emitDefaultMethods();
106105
};
107106

108107
} // namespace cir

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,10 +3062,6 @@ def clangir_disable_verifier : Flag<["-"], "clangir-disable-verifier">,
30623062
Visibility<[ClangOption, CC1Option]>,
30633063
HelpText<"ClangIR: Disable MLIR module verifier">,
30643064
MarshallingInfoFlag<FrontendOpts<"ClangIRDisableCIRVerifier">>;
3065-
def clangir_disable_emit_cxx_default : Flag<["-"], "clangir-disable-emit-cxx-default">,
3066-
Visibility<[ClangOption, CC1Option]>,
3067-
HelpText<"ClangIR: Disable emission of c++ default (compiler implemented) methods.">,
3068-
MarshallingInfoFlag<FrontendOpts<"ClangIRDisableEmitCXXDefault">>;
30693065
def clangir_verify_diagnostics : Flag<["-"], "clangir-verify-diagnostics">,
30703066
Visibility<[ClangOption, CC1Option]>,
30713067
HelpText<"ClangIR: Enable diagnostic verification in MLIR, similar to clang's -verify">,

clang/include/clang/Frontend/FrontendOptions.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,6 @@ class FrontendOptions {
433433
/// Disable Clang IR (CIR) verifier
434434
unsigned ClangIRDisableCIRVerifier : 1;
435435

436-
/// Disable ClangIR emission for CXX default (compiler generated methods).
437-
unsigned ClangIRDisableEmitCXXDefault : 1;
438-
439436
/// Enable diagnostic verification for CIR
440437
unsigned ClangIRVerifyDiags : 1;
441438

@@ -655,10 +652,9 @@ class FrontendOptions {
655652
EmitPrettySymbolGraphs(false), GenReducedBMI(false),
656653
UseClangIRPipeline(false), ClangIRDirectLowering(false),
657654
ClangIRDisablePasses(false), ClangIRDisableCIRVerifier(false),
658-
ClangIRDisableEmitCXXDefault(false), ClangIRLifetimeCheck(false),
659-
ClangIRIdiomRecognizer(false), ClangIRLibOpt(false),
660-
ClangIRAnalysisOnly(false), TimeTraceGranularity(500),
661-
TimeTraceVerbose(false) {}
655+
ClangIRLifetimeCheck(false), ClangIRIdiomRecognizer(false),
656+
ClangIRLibOpt(false), ClangIRAnalysisOnly(false),
657+
TimeTraceGranularity(500), TimeTraceVerbose(false) {}
662658

663659
/// getInputKindForExtension - Return the appropriate input kind for a file
664660
/// extension. For example, "c" would return Language::C.

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2786,10 +2786,7 @@ cir::FuncOp CIRGenModule::GetOrCreateCIRFunction(
27862786
FD = FD->getPreviousDecl()) {
27872787
if (isa<CXXRecordDecl>(FD->getLexicalDeclContext())) {
27882788
if (FD->doesThisDeclarationHaveABody()) {
2789-
if (isDefaultedMethod(FD))
2790-
addDefaultMethodsToEmit(GD.getWithDecl(FD));
2791-
else
2792-
addDeferredDeclToEmit(GD.getWithDecl(FD));
2789+
addDeferredDeclToEmit(GD.getWithDecl(FD));
27932790
break;
27942791
}
27952792
}
@@ -2939,13 +2936,6 @@ void CIRGenModule::emitDeferred(unsigned recursionLimit) {
29392936
}
29402937
}
29412938

2942-
void CIRGenModule::emitDefaultMethods() {
2943-
// Differently from DeferredDeclsToEmit, there's no recurrent use of
2944-
// DefaultMethodsToEmit, so use it directly for emission.
2945-
for (auto &D : DefaultMethodsToEmit)
2946-
emitGlobalDecl(D);
2947-
}
2948-
29492939
mlir::IntegerAttr CIRGenModule::getSize(CharUnits size) {
29502940
return builder.getSizeFromCharUnits(&getMLIRContext(), size);
29512941
}

clang/lib/CIR/CodeGen/CIRGenModule.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -566,14 +566,6 @@ class CIRGenModule : public CIRGenTypeCache {
566566
DeferredDeclsToEmit.emplace_back(GD);
567567
}
568568

569-
// After HandleTranslation finishes, differently from DeferredDeclsToEmit,
570-
// DefaultMethodsToEmit is only called after a set of CIR passes run. See
571-
// addDefaultMethodsToEmit usage for examples.
572-
std::vector<clang::GlobalDecl> DefaultMethodsToEmit;
573-
void addDefaultMethodsToEmit(clang::GlobalDecl GD) {
574-
DefaultMethodsToEmit.emplace_back(GD);
575-
}
576-
577569
std::pair<cir::FuncType, cir::FuncOp> getAddrAndTypeOfCXXStructor(
578570
clang::GlobalDecl GD, const CIRGenFunctionInfo *FnInfo = nullptr,
579571
cir::FuncType FnType = nullptr, bool Dontdefer = false,
@@ -718,9 +710,6 @@ class CIRGenModule : public CIRGenTypeCache {
718710
/// Helper for `emitDeferred` to apply actual codegen.
719711
void emitGlobalDecl(clang::GlobalDecl &D);
720712

721-
/// Build default methods not emitted before this point.
722-
void emitDefaultMethods();
723-
724713
const llvm::Triple &getTriple() const { return target.getTriple(); }
725714

726715
// Finalize CIR code generation.

clang/lib/CIR/CodeGen/CIRGenerator.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ void CIRGenerator::HandleInlineFunctionDefinition(FunctionDecl *D) {
123123
CGM->AddDeferredUnusedCoverageMapping(D);
124124
}
125125

126-
void CIRGenerator::emitDefaultMethods() { CGM->emitDefaultMethods(); }
127-
128126
void CIRGenerator::emitDeferredDecls() {
129127
if (DeferredInlineMemberFuncDefs.empty())
130128
return;

clang/lib/CIR/FrontendAction/CIRGenAction.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,6 @@ class CIRGenConsumer : public clang::ASTConsumer {
261261
case CIRGenAction::OutputType::EmitCIR:
262262
case CIRGenAction::OutputType::EmitCIRFlat:
263263
if (outputStream && mlirMod) {
264-
// Emit remaining defaulted C++ methods
265-
if (!feOptions.ClangIRDisableEmitCXXDefault)
266-
gen->emitDefaultMethods();
267-
268264
// FIXME: we cannot roundtrip prettyForm=true right now.
269265
mlir::OpPrintingFlags flags;
270266
flags.enableDebugInfo(/*enable=*/true, /*prettyForm=*/false);

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,9 +3055,6 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
30553055
if (Args.hasArg(OPT_clangir_disable_verifier))
30563056
Opts.ClangIRDisableCIRVerifier = true;
30573057

3058-
if (Args.hasArg(OPT_clangir_disable_emit_cxx_default))
3059-
Opts.ClangIRDisableEmitCXXDefault = true;
3060-
30613058
if (Args.hasArg(OPT_clangir_verify_diagnostics))
30623059
Opts.ClangIRVerifyDiags = true;
30633060

clang/test/CIR/CodeGen/assign-operator.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// RUN: %clang_cc1 -std=c++17 -mconstructor-aliases -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

4-
// RUN: %clang_cc1 -std=c++17 -mconstructor-aliases -triple x86_64-unknown-linux-gnu -fclangir -emit-cir -clangir-disable-emit-cxx-default %s -o %t-disable.cir
5-
// RUN: FileCheck --input-file=%t-disable.cir %s --check-prefix=DISABLE
6-
74
int strlen(char const *);
85

96
struct String {
@@ -40,9 +37,6 @@ struct String {
4037
// CHECK: cir.return
4138
// CHECK: }
4239

43-
// DISABLE: cir.func linkonce_odr @_ZN10StringViewC2ERK6String
44-
// DISABLE-NEXT: %0 = cir.alloca !cir.ptr<!ty_StringView>, !cir.ptr<!cir.ptr<!ty_StringView>>, ["this", init] {alignment = 8 : i64}
45-
4640
// StringView::operator=(StringView&&)
4741
//
4842
// CHECK: cir.func linkonce_odr @_ZN10StringViewaSEOS_
@@ -61,9 +55,6 @@ struct String {
6155
// CHECK: %8 = cir.load %2 : !cir.ptr<!cir.ptr<!ty_StringView>>
6256
// CHECK: cir.return %8 : !cir.ptr<!ty_StringView>
6357
// CHECK: }
64-
65-
// DISABLE: cir.func private @_ZN10StringViewaSEOS_
66-
// DISABLE-NEXT: cir.func @main()
6758
};
6859

6960
struct StringView {
@@ -179,8 +170,6 @@ struct Trivial {
179170
// CHECK-NEXT: %[[#OTHER_I_CAST:]] = cir.cast(bitcast, %[[#OTHER_I]] : !cir.ptr<!s32i>), !cir.ptr<!void>
180171
// CHECK-NEXT: cir.libc.memcpy %[[#MEMCPY_SIZE]] bytes from %[[#OTHER_I_CAST]] to %[[#THIS_I_CAST]]
181172
// CHECK-NEXT: cir.store %[[#THIS_LOAD]], %[[#RETVAL]]
182-
// CHECK-NEXT: cir.br ^bb1
183-
// CHECK-NEXT: ^bb1:
184173
// CHECK-NEXT: %[[#RETVAL_LOAD:]] = cir.load %[[#RETVAL]]
185174
// CHECK-NEXT: cir.return %[[#RETVAL_LOAD]]
186175
// CHECK-NEXT: }

clang/test/CIR/CodeGen/coro-task.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -clangir-disable-emit-cxx-default -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
namespace std {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
2+
// RUN: FileCheck --input-file=%t.cir --check-prefix=CIR %s
3+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll
4+
// RUN: FileCheck --input-file=%t.ll --check-prefix=LLVM %s
5+
6+
// We should emit and call both implicit operator= functions.
7+
struct S {
8+
struct T {
9+
int x;
10+
} t;
11+
};
12+
13+
// CIR-LABEL: cir.func linkonce_odr @_ZN1S1TaSERKS0_({{.*}} {
14+
// CIR-LABEL: cir.func linkonce_odr @_ZN1SaSERKS_(
15+
// CIR: cir.call @_ZN1S1TaSERKS0_(
16+
// CIR-LABEL: cir.func @_Z1fR1SS0_(
17+
// CIR: cir.call @_ZN1SaSERKS_(
18+
19+
// LLVM-LABEL: define linkonce_odr ptr @_ZN1S1TaSERKS0_(
20+
// LLVM-LABEL: define linkonce_odr ptr @_ZN1SaSERKS_(
21+
// LLVM: call ptr @_ZN1S1TaSERKS0_(
22+
// LLVM-LABEL: define dso_local void @_Z1fR1SS0_(
23+
// LLVM: call ptr @_ZN1SaSERKS_(
24+
void f(S &s1, S &s2) { s1 = s2; }

clang/test/CIR/CodeGen/delete.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -clangir-disable-emit-cxx-default -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
typedef __typeof(sizeof(int)) size_t;
@@ -12,4 +12,4 @@ namespace test1 {
1212

1313
// CHECK: %[[CONST:.*]] = cir.const #cir.int<4> : !u64i
1414
// CHECK: cir.call @_ZN5test11AdlEPvm({{.*}}, %[[CONST]])
15-
}
15+
}

clang/test/CIR/CodeGen/derived-to-base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -clangir-disable-emit-cxx-default -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
typedef enum {

clang/test/CIR/CodeGen/dtors-scopes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -clangir-disable-emit-cxx-default -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33
// RUN: %clang_cc1 -triple arm64-apple-macosx14.0.0 -std=c++20 -fclangir -emit-cir %s -o %t2.cir
44
// RUN: FileCheck --input-file=%t2.cir %s --check-prefix=DTOR_BODY
@@ -33,4 +33,4 @@ void dtor1() {
3333

3434
// DTOR_BODY: cir.call @_ZN1CD2Ev
3535
// DTOR_BODY: cir.return
36-
// DTOR_BODY: }
36+
// DTOR_BODY: }

clang/test/CIR/CodeGen/dtors.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -clangir-disable-emit-cxx-default -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
enum class EFMode { Always, Verbose };

clang/test/CIR/CodeGen/libcall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -clangir-disable-emit-cxx-default -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
typedef __builtin_va_list va_list;

clang/test/CIR/CodeGen/move.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -clangir-disable-emit-cxx-default -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
namespace std {

clang/test/CIR/CodeGen/new.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -clangir-disable-emit-cxx-default -fclangir -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
#include "std-cxx.h"
@@ -55,4 +55,4 @@ class B {
5555
void t() {
5656
B b;
5757
b.construct(&b);
58-
}
58+
}

clang/test/CIR/CodeGen/nrvo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -clangir-disable-emit-cxx-default -fclangir -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
#include "std-cxx.h"

clang/test/CIR/CodeGen/rangefor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -clangir-disable-emit-cxx-default -fclangir -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
#include "std-cxx.h"

clang/test/CIR/CodeGen/std-array.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -clangir-disable-emit-cxx-default -fclangir -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
#include "std-cxx.h"
@@ -14,4 +14,4 @@ void t() {
1414
// CHECK: {{.*}} = cir.cast(array_to_ptrdecay
1515
// CHECK: {{.*}} = cir.const #cir.int<9> : !u32i
1616

17-
// CHECK: cir.call @_ZNSt5arrayIhLj9EE3endEv
17+
// CHECK: cir.call @_ZNSt5arrayIhLj9EE3endEv

clang/test/CIR/CodeGen/std-find.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -clangir-disable-emit-cxx-default -fclangir -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
#include "std-cxx.h"
@@ -24,4 +24,4 @@ int test_find(unsigned char n = 3)
2424
// CHECK: cir.if %[[neq_cmp]]
2525

2626
return num_found;
27-
}
27+
}

clang/test/CIR/CodeGen/vector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -clangir-disable-emit-cxx-default -fclangir -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
#include "std-cxx.h"
@@ -32,4 +32,4 @@ void m() {
3232
std::vector<unsigned long long> a;
3333
int i = 43;
3434
a.resize(i);
35-
}
35+
}

clang/test/CIR/CodeGen/vtable-rtti.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -clangir-disable-emit-cxx-default -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
3-
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -fno-rtti -mconstructor-aliases -clangir-disable-emit-cxx-default -emit-cir %s -o %t2.cir
3+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -fno-rtti -mconstructor-aliases -emit-cir %s -o %t2.cir
44
// RUN: FileCheck --input-file=%t2.cir --check-prefix=RTTI_DISABLED %s
55

66
class A

clang/test/CIR/Transforms/lib-opt-find.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -clangir-disable-emit-cxx-default -fclangir -fclangir-idiom-recognizer -fclangir-lib-opt -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -fclangir-idiom-recognizer -fclangir-lib-opt -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
33

44
#include "std-cxx.h"

clang/test/CIR/Transforms/lifetime-check-agg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir -clangir-disable-emit-cxx-default -fclangir-lifetime-check="history=all;remarks=all" -clangir-verify-diagnostics -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir -fclangir-lifetime-check="history=all;remarks=all" -clangir-verify-diagnostics -emit-cir %s -o %t.cir
22
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir-analysis-only -fclangir-lifetime-check="history=all;remarks=all" %s -clangir-verify-diagnostics -emit-obj -o /dev/null
33

44
typedef enum SType {

clang/test/CIR/Transforms/lifetime-check-owner.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -fclangir-lifetime-check="history=all;remarks=all;history_limit=1" -clangir-verify-diagnostics -emit-cir %s -o %t.cir
22

3-
struct [[gsl::Owner(int)]] MyIntOwner {
3+
struct [[gsl::Owner(int)]] MyIntOwner { // expected-remark {{pset => { fn_arg:0 }}}
44
int val;
55
MyIntOwner(int v) : val(v) {}
66
void changeInt(int i);
77
int &operator*();
88
int read() const;
99
};
1010

11-
struct [[gsl::Pointer(int)]] MyIntPointer {
11+
struct [[gsl::Pointer(int)]] MyIntPointer { // expected-remark {{pset => { fn_arg:0 }}}
1212
int *ptr;
1313
MyIntPointer(int *p = nullptr) : ptr(p) {}
1414
MyIntPointer(const MyIntOwner &);
@@ -68,4 +68,4 @@ void yolo4() {
6868
p.read(); // expected-warning {{use of invalid pointer 'p'}}
6969
// expected-remark@-1 {{pset => { invalid }}}
7070
q.read(); // expected-remark {{pset => { o1__1' }}}
71-
}
71+
}

clang/test/CIR/Transforms/lifetime-check-range-for-vector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -mconstructor-aliases -fclangir -clangir-disable-emit-cxx-default -fclangir-lifetime-check="history=all" -fclangir-skip-system-headers -clangir-verify-diagnostics -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -mconstructor-aliases -fclangir -fclangir-lifetime-check="history=all" -fclangir-skip-system-headers -clangir-verify-diagnostics -emit-cir %s -o %t.cir
22

33
#include "std-cxx.h"
44

@@ -25,4 +25,4 @@ void swappy(unsigned c) {
2525
for (unsigned i = 0; i < c; i++) {
2626
images2[i] = {INFO_ENUM_1};
2727
}
28-
}
28+
}

clang/test/CIR/Transforms/lifetime-check-string.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir -clangir-disable-emit-cxx-default -fclangir-lifetime-check="history=all;remarks=all" -clangir-verify-diagnostics -emit-cir %s -o %t.cir
1+
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir -fclangir-lifetime-check="history=all;remarks=all" -clangir-verify-diagnostics -emit-cir %s -o %t.cir
22

33
int strlen(char const *);
44

5-
struct [[gsl::Owner(char *)]] String {
5+
struct [[gsl::Owner(char *)]] String { // expected-remark {{pset => { fn_arg:0 }}}
66
long size;
77
long capacity;
88
const char *storage;
@@ -11,7 +11,7 @@ struct [[gsl::Owner(char *)]] String {
1111
String(char const *s) : size{strlen(s)}, capacity{size}, storage{s} {}
1212
};
1313

14-
struct [[gsl::Pointer(int)]] StringView {
14+
struct [[gsl::Pointer(int)]] StringView { // expected-remark {{pset => { fn_arg:0 }}}
1515
long size;
1616
const char *storage;
1717
char operator[](int);
@@ -84,4 +84,4 @@ void sv3() {
8484
cout << name; // expected-note {{invalidated by non-const use of owner type}}
8585
cout << sv; // expected-warning {{passing invalid pointer 'sv'}}
8686
// expected-remark@-1 {{pset => { invalid }}}
87-
}
87+
}

0 commit comments

Comments
 (0)