diff --git a/clang/include/clang/CIR/CIRGenerator.h b/clang/include/clang/CIR/CIRGenerator.h index f4c30a5e892b..f121d2c453d7 100644 --- a/clang/include/clang/CIR/CIRGenerator.h +++ b/clang/include/clang/CIR/CIRGenerator.h @@ -102,7 +102,6 @@ class CIRGenerator : public clang::ASTConsumer { bool verifyModule(); void emitDeferredDecls(); - void emitDefaultMethods(); }; } // namespace cir diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 095a2d62a58e..6efb43dbe4ea 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -3062,10 +3062,6 @@ def clangir_disable_verifier : Flag<["-"], "clangir-disable-verifier">, Visibility<[ClangOption, CC1Option]>, HelpText<"ClangIR: Disable MLIR module verifier">, MarshallingInfoFlag>; -def clangir_disable_emit_cxx_default : Flag<["-"], "clangir-disable-emit-cxx-default">, - Visibility<[ClangOption, CC1Option]>, - HelpText<"ClangIR: Disable emission of c++ default (compiler implemented) methods.">, - MarshallingInfoFlag>; def clangir_verify_diagnostics : Flag<["-"], "clangir-verify-diagnostics">, Visibility<[ClangOption, CC1Option]>, HelpText<"ClangIR: Enable diagnostic verification in MLIR, similar to clang's -verify">, diff --git a/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h index 64664f41c879..c20744b49136 100644 --- a/clang/include/clang/Frontend/FrontendOptions.h +++ b/clang/include/clang/Frontend/FrontendOptions.h @@ -433,9 +433,6 @@ class FrontendOptions { /// Disable Clang IR (CIR) verifier unsigned ClangIRDisableCIRVerifier : 1; - /// Disable ClangIR emission for CXX default (compiler generated methods). - unsigned ClangIRDisableEmitCXXDefault : 1; - /// Enable diagnostic verification for CIR unsigned ClangIRVerifyDiags : 1; @@ -655,10 +652,9 @@ class FrontendOptions { EmitPrettySymbolGraphs(false), GenReducedBMI(false), UseClangIRPipeline(false), ClangIRDirectLowering(false), ClangIRDisablePasses(false), ClangIRDisableCIRVerifier(false), - ClangIRDisableEmitCXXDefault(false), ClangIRLifetimeCheck(false), - ClangIRIdiomRecognizer(false), ClangIRLibOpt(false), - ClangIRAnalysisOnly(false), TimeTraceGranularity(500), - TimeTraceVerbose(false) {} + ClangIRLifetimeCheck(false), ClangIRIdiomRecognizer(false), + ClangIRLibOpt(false), ClangIRAnalysisOnly(false), + TimeTraceGranularity(500), TimeTraceVerbose(false) {} /// getInputKindForExtension - Return the appropriate input kind for a file /// extension. For example, "c" would return Language::C. diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index 30188ac98dbb..0582a95dc456 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -2786,10 +2786,7 @@ cir::FuncOp CIRGenModule::GetOrCreateCIRFunction( FD = FD->getPreviousDecl()) { if (isa(FD->getLexicalDeclContext())) { if (FD->doesThisDeclarationHaveABody()) { - if (isDefaultedMethod(FD)) - addDefaultMethodsToEmit(GD.getWithDecl(FD)); - else - addDeferredDeclToEmit(GD.getWithDecl(FD)); + addDeferredDeclToEmit(GD.getWithDecl(FD)); break; } } @@ -2939,13 +2936,6 @@ void CIRGenModule::emitDeferred(unsigned recursionLimit) { } } -void CIRGenModule::emitDefaultMethods() { - // Differently from DeferredDeclsToEmit, there's no recurrent use of - // DefaultMethodsToEmit, so use it directly for emission. - for (auto &D : DefaultMethodsToEmit) - emitGlobalDecl(D); -} - mlir::IntegerAttr CIRGenModule::getSize(CharUnits size) { return builder.getSizeFromCharUnits(&getMLIRContext(), size); } diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.h b/clang/lib/CIR/CodeGen/CIRGenModule.h index 61d975491f33..771c90a2bccd 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.h +++ b/clang/lib/CIR/CodeGen/CIRGenModule.h @@ -566,14 +566,6 @@ class CIRGenModule : public CIRGenTypeCache { DeferredDeclsToEmit.emplace_back(GD); } - // After HandleTranslation finishes, differently from DeferredDeclsToEmit, - // DefaultMethodsToEmit is only called after a set of CIR passes run. See - // addDefaultMethodsToEmit usage for examples. - std::vector DefaultMethodsToEmit; - void addDefaultMethodsToEmit(clang::GlobalDecl GD) { - DefaultMethodsToEmit.emplace_back(GD); - } - std::pair getAddrAndTypeOfCXXStructor( clang::GlobalDecl GD, const CIRGenFunctionInfo *FnInfo = nullptr, cir::FuncType FnType = nullptr, bool Dontdefer = false, @@ -718,9 +710,6 @@ class CIRGenModule : public CIRGenTypeCache { /// Helper for `emitDeferred` to apply actual codegen. void emitGlobalDecl(clang::GlobalDecl &D); - /// Build default methods not emitted before this point. - void emitDefaultMethods(); - const llvm::Triple &getTriple() const { return target.getTriple(); } // Finalize CIR code generation. diff --git a/clang/lib/CIR/CodeGen/CIRGenerator.cpp b/clang/lib/CIR/CodeGen/CIRGenerator.cpp index a4c6bd16df52..aefd0842bd9d 100644 --- a/clang/lib/CIR/CodeGen/CIRGenerator.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenerator.cpp @@ -123,8 +123,6 @@ void CIRGenerator::HandleInlineFunctionDefinition(FunctionDecl *D) { CGM->AddDeferredUnusedCoverageMapping(D); } -void CIRGenerator::emitDefaultMethods() { CGM->emitDefaultMethods(); } - void CIRGenerator::emitDeferredDecls() { if (DeferredInlineMemberFuncDefs.empty()) return; diff --git a/clang/lib/CIR/FrontendAction/CIRGenAction.cpp b/clang/lib/CIR/FrontendAction/CIRGenAction.cpp index f5ab7dd3bad8..515e213abbef 100644 --- a/clang/lib/CIR/FrontendAction/CIRGenAction.cpp +++ b/clang/lib/CIR/FrontendAction/CIRGenAction.cpp @@ -261,10 +261,6 @@ class CIRGenConsumer : public clang::ASTConsumer { case CIRGenAction::OutputType::EmitCIR: case CIRGenAction::OutputType::EmitCIRFlat: if (outputStream && mlirMod) { - // Emit remaining defaulted C++ methods - if (!feOptions.ClangIRDisableEmitCXXDefault) - gen->emitDefaultMethods(); - // FIXME: we cannot roundtrip prettyForm=true right now. mlir::OpPrintingFlags flags; flags.enableDebugInfo(/*enable=*/true, /*prettyForm=*/false); diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 03ee2125dc9a..fa6c23d5f0e1 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -3055,9 +3055,6 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, if (Args.hasArg(OPT_clangir_disable_verifier)) Opts.ClangIRDisableCIRVerifier = true; - if (Args.hasArg(OPT_clangir_disable_emit_cxx_default)) - Opts.ClangIRDisableEmitCXXDefault = true; - if (Args.hasArg(OPT_clangir_verify_diagnostics)) Opts.ClangIRVerifyDiags = true; diff --git a/clang/test/CIR/CodeGen/assign-operator.cpp b/clang/test/CIR/CodeGen/assign-operator.cpp index e814a649c728..47a815407874 100644 --- a/clang/test/CIR/CodeGen/assign-operator.cpp +++ b/clang/test/CIR/CodeGen/assign-operator.cpp @@ -1,9 +1,6 @@ // RUN: %clang_cc1 -std=c++17 -mconstructor-aliases -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s -// 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 -// RUN: FileCheck --input-file=%t-disable.cir %s --check-prefix=DISABLE - int strlen(char const *); struct String { @@ -40,9 +37,6 @@ struct String { // CHECK: cir.return // CHECK: } - // DISABLE: cir.func linkonce_odr @_ZN10StringViewC2ERK6String - // DISABLE-NEXT: %0 = cir.alloca !cir.ptr, !cir.ptr>, ["this", init] {alignment = 8 : i64} - // StringView::operator=(StringView&&) // // CHECK: cir.func linkonce_odr @_ZN10StringViewaSEOS_ @@ -61,9 +55,6 @@ struct String { // CHECK: %8 = cir.load %2 : !cir.ptr> // CHECK: cir.return %8 : !cir.ptr // CHECK: } - - // DISABLE: cir.func private @_ZN10StringViewaSEOS_ - // DISABLE-NEXT: cir.func @main() }; struct StringView { @@ -179,8 +170,6 @@ struct Trivial { // CHECK-NEXT: %[[#OTHER_I_CAST:]] = cir.cast(bitcast, %[[#OTHER_I]] : !cir.ptr), !cir.ptr // CHECK-NEXT: cir.libc.memcpy %[[#MEMCPY_SIZE]] bytes from %[[#OTHER_I_CAST]] to %[[#THIS_I_CAST]] // CHECK-NEXT: cir.store %[[#THIS_LOAD]], %[[#RETVAL]] -// CHECK-NEXT: cir.br ^bb1 -// CHECK-NEXT: ^bb1: // CHECK-NEXT: %[[#RETVAL_LOAD:]] = cir.load %[[#RETVAL]] // CHECK-NEXT: cir.return %[[#RETVAL_LOAD]] // CHECK-NEXT: } diff --git a/clang/test/CIR/CodeGen/coro-task.cpp b/clang/test/CIR/CodeGen/coro-task.cpp index acd2818e7a4b..364f0bfc85ce 100644 --- a/clang/test/CIR/CodeGen/coro-task.cpp +++ b/clang/test/CIR/CodeGen/coro-task.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -clangir-disable-emit-cxx-default -emit-cir %s -o %t.cir +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s namespace std { diff --git a/clang/test/CIR/CodeGen/default-methods.cpp b/clang/test/CIR/CodeGen/default-methods.cpp new file mode 100644 index 000000000000..73f7afb1b814 --- /dev/null +++ b/clang/test/CIR/CodeGen/default-methods.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir --check-prefix=CIR %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll +// RUN: FileCheck --input-file=%t.ll --check-prefix=LLVM %s + +// We should emit and call both implicit operator= functions. +struct S { + struct T { + int x; + } t; +}; + +// CIR-LABEL: cir.func linkonce_odr @_ZN1S1TaSERKS0_({{.*}} { +// CIR-LABEL: cir.func linkonce_odr @_ZN1SaSERKS_( +// CIR: cir.call @_ZN1S1TaSERKS0_( +// CIR-LABEL: cir.func @_Z1fR1SS0_( +// CIR: cir.call @_ZN1SaSERKS_( + +// LLVM-LABEL: define linkonce_odr ptr @_ZN1S1TaSERKS0_( +// LLVM-LABEL: define linkonce_odr ptr @_ZN1SaSERKS_( +// LLVM: call ptr @_ZN1S1TaSERKS0_( +// LLVM-LABEL: define dso_local void @_Z1fR1SS0_( +// LLVM: call ptr @_ZN1SaSERKS_( +void f(S &s1, S &s2) { s1 = s2; } diff --git a/clang/test/CIR/CodeGen/delete.cpp b/clang/test/CIR/CodeGen/delete.cpp index b02641ff87b0..d45baa241adc 100644 --- a/clang/test/CIR/CodeGen/delete.cpp +++ b/clang/test/CIR/CodeGen/delete.cpp @@ -1,4 +1,4 @@ -// 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 +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s typedef __typeof(sizeof(int)) size_t; @@ -12,4 +12,4 @@ namespace test1 { // CHECK: %[[CONST:.*]] = cir.const #cir.int<4> : !u64i // CHECK: cir.call @_ZN5test11AdlEPvm({{.*}}, %[[CONST]]) -} \ No newline at end of file +} diff --git a/clang/test/CIR/CodeGen/derived-to-base.cpp b/clang/test/CIR/CodeGen/derived-to-base.cpp index e3a860d99ac3..879d09f58c34 100644 --- a/clang/test/CIR/CodeGen/derived-to-base.cpp +++ b/clang/test/CIR/CodeGen/derived-to-base.cpp @@ -1,4 +1,4 @@ -// 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 +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s typedef enum { diff --git a/clang/test/CIR/CodeGen/dtors-scopes.cpp b/clang/test/CIR/CodeGen/dtors-scopes.cpp index c9bdb1dd2da8..baa1d7666df9 100644 --- a/clang/test/CIR/CodeGen/dtors-scopes.cpp +++ b/clang/test/CIR/CodeGen/dtors-scopes.cpp @@ -1,4 +1,4 @@ -// 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 +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s // RUN: %clang_cc1 -triple arm64-apple-macosx14.0.0 -std=c++20 -fclangir -emit-cir %s -o %t2.cir // RUN: FileCheck --input-file=%t2.cir %s --check-prefix=DTOR_BODY @@ -33,4 +33,4 @@ void dtor1() { // DTOR_BODY: cir.call @_ZN1CD2Ev // DTOR_BODY: cir.return -// DTOR_BODY: } \ No newline at end of file +// DTOR_BODY: } diff --git a/clang/test/CIR/CodeGen/dtors.cpp b/clang/test/CIR/CodeGen/dtors.cpp index 2202d339b76d..60c330d53b78 100644 --- a/clang/test/CIR/CodeGen/dtors.cpp +++ b/clang/test/CIR/CodeGen/dtors.cpp @@ -1,4 +1,4 @@ -// 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 +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s enum class EFMode { Always, Verbose }; diff --git a/clang/test/CIR/CodeGen/libcall.cpp b/clang/test/CIR/CodeGen/libcall.cpp index 17d2e7912833..192b0ff13294 100644 --- a/clang/test/CIR/CodeGen/libcall.cpp +++ b/clang/test/CIR/CodeGen/libcall.cpp @@ -1,4 +1,4 @@ -// 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 +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s typedef __builtin_va_list va_list; diff --git a/clang/test/CIR/CodeGen/move.cpp b/clang/test/CIR/CodeGen/move.cpp index 6e3f317d0615..2a6cbc158b0e 100644 --- a/clang/test/CIR/CodeGen/move.cpp +++ b/clang/test/CIR/CodeGen/move.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -clangir-disable-emit-cxx-default -emit-cir %s -o %t.cir +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s namespace std { diff --git a/clang/test/CIR/CodeGen/new.cpp b/clang/test/CIR/CodeGen/new.cpp index bcce7d566793..6e829dd5de6b 100644 --- a/clang/test/CIR/CodeGen/new.cpp +++ b/clang/test/CIR/CodeGen/new.cpp @@ -1,4 +1,4 @@ -// 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 +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s #include "std-cxx.h" @@ -55,4 +55,4 @@ class B { void t() { B b; b.construct(&b); -} \ No newline at end of file +} diff --git a/clang/test/CIR/CodeGen/nrvo.cpp b/clang/test/CIR/CodeGen/nrvo.cpp index 8edc47aa2c8a..1138e7733667 100644 --- a/clang/test/CIR/CodeGen/nrvo.cpp +++ b/clang/test/CIR/CodeGen/nrvo.cpp @@ -1,4 +1,4 @@ -// 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 +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s #include "std-cxx.h" diff --git a/clang/test/CIR/CodeGen/rangefor.cpp b/clang/test/CIR/CodeGen/rangefor.cpp index 8c63b688cdd0..b9ab633064c3 100644 --- a/clang/test/CIR/CodeGen/rangefor.cpp +++ b/clang/test/CIR/CodeGen/rangefor.cpp @@ -1,4 +1,4 @@ -// 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 +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s #include "std-cxx.h" diff --git a/clang/test/CIR/CodeGen/std-array.cpp b/clang/test/CIR/CodeGen/std-array.cpp index a360a0a37d44..891eb99d8888 100644 --- a/clang/test/CIR/CodeGen/std-array.cpp +++ b/clang/test/CIR/CodeGen/std-array.cpp @@ -1,4 +1,4 @@ -// 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 +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s #include "std-cxx.h" @@ -14,4 +14,4 @@ void t() { // CHECK: {{.*}} = cir.cast(array_to_ptrdecay // CHECK: {{.*}} = cir.const #cir.int<9> : !u32i -// CHECK: cir.call @_ZNSt5arrayIhLj9EE3endEv \ No newline at end of file +// CHECK: cir.call @_ZNSt5arrayIhLj9EE3endEv diff --git a/clang/test/CIR/CodeGen/std-find.cpp b/clang/test/CIR/CodeGen/std-find.cpp index 73494ba8b308..6f4e41a35ca5 100644 --- a/clang/test/CIR/CodeGen/std-find.cpp +++ b/clang/test/CIR/CodeGen/std-find.cpp @@ -1,4 +1,4 @@ -// 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 +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s #include "std-cxx.h" @@ -24,4 +24,4 @@ int test_find(unsigned char n = 3) // CHECK: cir.if %[[neq_cmp]] return num_found; -} \ No newline at end of file +} diff --git a/clang/test/CIR/CodeGen/vector.cpp b/clang/test/CIR/CodeGen/vector.cpp index ad99c6e4fe6a..177b4813b226 100644 --- a/clang/test/CIR/CodeGen/vector.cpp +++ b/clang/test/CIR/CodeGen/vector.cpp @@ -1,4 +1,4 @@ -// 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 +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s #include "std-cxx.h" @@ -32,4 +32,4 @@ void m() { std::vector a; int i = 43; a.resize(i); -} \ No newline at end of file +} diff --git a/clang/test/CIR/CodeGen/vtable-rtti.cpp b/clang/test/CIR/CodeGen/vtable-rtti.cpp index 9e86b41f1d30..e11e80bd5b4f 100644 --- a/clang/test/CIR/CodeGen/vtable-rtti.cpp +++ b/clang/test/CIR/CodeGen/vtable-rtti.cpp @@ -1,6 +1,6 @@ -// 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 +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir // RUN: FileCheck --input-file=%t.cir %s -// 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 +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -fno-rtti -mconstructor-aliases -emit-cir %s -o %t2.cir // RUN: FileCheck --input-file=%t2.cir --check-prefix=RTTI_DISABLED %s class A diff --git a/clang/test/CIR/Transforms/lib-opt-find.cpp b/clang/test/CIR/Transforms/lib-opt-find.cpp index c11daba10f28..0f26ce4175a4 100644 --- a/clang/test/CIR/Transforms/lib-opt-find.cpp +++ b/clang/test/CIR/Transforms/lib-opt-find.cpp @@ -1,4 +1,4 @@ -// 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 +// 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 // RUN: FileCheck --input-file=%t.cir %s #include "std-cxx.h" diff --git a/clang/test/CIR/Transforms/lifetime-check-agg.cpp b/clang/test/CIR/Transforms/lifetime-check-agg.cpp index ebfe00c2ad56..9dc9f98592f8 100644 --- a/clang/test/CIR/Transforms/lifetime-check-agg.cpp +++ b/clang/test/CIR/Transforms/lifetime-check-agg.cpp @@ -1,4 +1,4 @@ -// 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 +// 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 // 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 typedef enum SType { diff --git a/clang/test/CIR/Transforms/lifetime-check-owner.cpp b/clang/test/CIR/Transforms/lifetime-check-owner.cpp index 23643c821884..089bc4886036 100644 --- a/clang/test/CIR/Transforms/lifetime-check-owner.cpp +++ b/clang/test/CIR/Transforms/lifetime-check-owner.cpp @@ -1,6 +1,6 @@ // 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 -struct [[gsl::Owner(int)]] MyIntOwner { +struct [[gsl::Owner(int)]] MyIntOwner { // expected-remark {{pset => { fn_arg:0 }}} int val; MyIntOwner(int v) : val(v) {} void changeInt(int i); @@ -8,7 +8,7 @@ struct [[gsl::Owner(int)]] MyIntOwner { int read() const; }; -struct [[gsl::Pointer(int)]] MyIntPointer { +struct [[gsl::Pointer(int)]] MyIntPointer { // expected-remark {{pset => { fn_arg:0 }}} int *ptr; MyIntPointer(int *p = nullptr) : ptr(p) {} MyIntPointer(const MyIntOwner &); @@ -68,4 +68,4 @@ void yolo4() { p.read(); // expected-warning {{use of invalid pointer 'p'}} // expected-remark@-1 {{pset => { invalid }}} q.read(); // expected-remark {{pset => { o1__1' }}} -} \ No newline at end of file +} diff --git a/clang/test/CIR/Transforms/lifetime-check-range-for-vector.cpp b/clang/test/CIR/Transforms/lifetime-check-range-for-vector.cpp index e9c6d62b6f64..989bbcf91bee 100644 --- a/clang/test/CIR/Transforms/lifetime-check-range-for-vector.cpp +++ b/clang/test/CIR/Transforms/lifetime-check-range-for-vector.cpp @@ -1,4 +1,4 @@ -// 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 +// 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 #include "std-cxx.h" @@ -25,4 +25,4 @@ void swappy(unsigned c) { for (unsigned i = 0; i < c; i++) { images2[i] = {INFO_ENUM_1}; } -} \ No newline at end of file +} diff --git a/clang/test/CIR/Transforms/lifetime-check-string.cpp b/clang/test/CIR/Transforms/lifetime-check-string.cpp index 383f3b5da626..4e5f780aaeee 100644 --- a/clang/test/CIR/Transforms/lifetime-check-string.cpp +++ b/clang/test/CIR/Transforms/lifetime-check-string.cpp @@ -1,8 +1,8 @@ -// 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 +// 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 int strlen(char const *); -struct [[gsl::Owner(char *)]] String { +struct [[gsl::Owner(char *)]] String { // expected-remark {{pset => { fn_arg:0 }}} long size; long capacity; const char *storage; @@ -11,7 +11,7 @@ struct [[gsl::Owner(char *)]] String { String(char const *s) : size{strlen(s)}, capacity{size}, storage{s} {} }; -struct [[gsl::Pointer(int)]] StringView { +struct [[gsl::Pointer(int)]] StringView { // expected-remark {{pset => { fn_arg:0 }}} long size; const char *storage; char operator[](int); @@ -84,4 +84,4 @@ void sv3() { cout << name; // expected-note {{invalidated by non-const use of owner type}} cout << sv; // expected-warning {{passing invalid pointer 'sv'}} // expected-remark@-1 {{pset => { invalid }}} -} \ No newline at end of file +} diff --git a/clang/test/CIR/Transforms/lifetime-fn-args.cpp b/clang/test/CIR/Transforms/lifetime-fn-args.cpp index 6c1b297f1b32..eea6ae863d3c 100644 --- a/clang/test/CIR/Transforms/lifetime-fn-args.cpp +++ b/clang/test/CIR/Transforms/lifetime-fn-args.cpp @@ -1,4 +1,4 @@ -// 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 +// 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 struct A { void* ctx; @@ -9,4 +9,4 @@ void A::setInfo(void** ctxPtr) { if (ctxPtr != nullptr) { *ctxPtr = ctx; // expected-remark {{pset => { fn_arg:1 }}} } -} \ No newline at end of file +} diff --git a/clang/test/CIR/Transforms/lifetime-null-passing.cpp b/clang/test/CIR/Transforms/lifetime-null-passing.cpp index e26210b56234..05c97f8df3b0 100644 --- a/clang/test/CIR/Transforms/lifetime-null-passing.cpp +++ b/clang/test/CIR/Transforms/lifetime-null-passing.cpp @@ -1,4 +1,4 @@ -// 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" -clangir-verify-diagnostics -emit-cir %s -o %t.cir +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir -fclangir-lifetime-check="history=all" -clangir-verify-diagnostics -emit-cir %s -o %t.cir class _j {}; typedef _j* jobj; @@ -20,4 +20,4 @@ struct X { void nullpassing() { jobj o = nullptr; X::e.wildfn(0, &o); -} \ No newline at end of file +} diff --git a/clang/test/CIR/Transforms/lifetime-this.cpp b/clang/test/CIR/Transforms/lifetime-this.cpp index 8e18af8a9e16..78eb7ef3e4eb 100644 --- a/clang/test/CIR/Transforms/lifetime-this.cpp +++ b/clang/test/CIR/Transforms/lifetime-this.cpp @@ -1,4 +1,4 @@ -// 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;remarks=all" -fclangir-skip-system-headers -clangir-verify-diagnostics -emit-cir %s -o %t.cir +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -mconstructor-aliases -fclangir -fclangir-lifetime-check="history=all;remarks=all" -fclangir-skip-system-headers -clangir-verify-diagnostics -emit-cir %s -o %t.cir #include "std-cxx.h" @@ -9,4 +9,4 @@ struct S { void S::f(int a, int b) { std::shared_ptr l = std::make_shared(a, b, this); // expected-remark {{pset => { this }}} -} \ No newline at end of file +}