[clang] [clang][Driver] Add flag for setting SkipFunctionBodies (PR #100135)

2024-07-24 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: > But I'll still ask the question: would it make sense to name this > `-helpful-reproducers` or something more generic so we don't feel tempted to > expose even more internal options this way? This is tricky as some issues reproduce only when we skip function bodies and s

[clang] [clang][Driver] Add flag for setting SkipFunctionBodies (PR #100135)

2024-07-24 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. https://github.com/llvm/llvm-project/pull/100135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Preserve ContainsUnexpandedParameterPack in TransformLambdaExpr (PR #86265)

2024-07-24 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: > This patch resolves it by visiting the body twice (of course, it's > suboptimal), however patch #99882 still crashes because that relies on the > mechanism above, I believe. I have also observed it crashes, but I still think that in principle we don't need to traverse t

[clang] [Sema] Preserve ContainsUnexpandedParameterPack in TransformLambdaExpr (PR #86265)

2024-07-24 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: Looking at the code a bit deeper, I think (not 100% sure) we're not calling `DiagnoseUnexpandedPacks` during substitution. And we probably don't want the logic that produces diagnostics (substitutions cannot create new unexpanded packs in bad places), but we do need the log

[clang] Avoid accessing unset optional, workaround for #100095 (PR #100408)

2024-07-26 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. LGTM, since it now has a test that executes this code path and changes from UB to defined (even if undesired behavior). As mentioned earlier, I'm working on a proper fix for those cases https://github.com/llvm/llvm-project/pull/10040

[clang] Avoid accessing unset optional, workaround for #100095 (PR #100408)

2024-07-26 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/100408 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/100985 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: Thanks for the change! This looks like an improvement, but I suspect we can do even better. See the comments I've left in the code. https://github.com/llvm/llvm-project/pull/100985 ___ cfe-commits mailing li

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
@@ -3747,6 +3747,16 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, Diag(ReturnLoc, diag::err_acc_branch_in_out_compute_construct) << /*return*/ 1 << /*out of */ 0); + // using plain return in a coroutine is not allowed. + FunctionScopeIn

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
@@ -291,6 +294,38 @@ void mixed_coreturn_template2(bool b, T) { return; // expected-error {{not allowed in coroutine}} } +struct promise_handle; + +struct Handle : std::coroutine_handle { // expected-note 2{{candidate constructor (the implicit copy constructor) not viable

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
@@ -3747,6 +3747,16 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, Diag(ReturnLoc, diag::err_acc_branch_in_out_compute_construct) << /*return*/ 1 << /*out of */ 0); + // using plain return in a coroutine is not allowed. + FunctionScopeIn

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
@@ -291,6 +294,38 @@ void mixed_coreturn_template2(bool b, T) { return; // expected-error {{not allowed in coroutine}} } +struct promise_handle; + +struct Handle : std::coroutine_handle { // expected-note 2{{candidate constructor (the implicit copy constructor) not viable

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
@@ -1120,7 +1120,7 @@ void Sema::CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body) { // [stmt.return.coroutine]p1: // A coroutine shall not enclose a return statement ([stmt.return]). - if (Fn->FirstReturnLoc.isValid()) { + if (Fn->FirstReturnLoc.isValid() &&

[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

2024-07-29 Thread Ilya Biryukov via cfe-commits
@@ -291,6 +294,38 @@ void mixed_coreturn_template2(bool b, T) { return; // expected-error {{not allowed in coroutine}} } +struct promise_handle; + +struct Handle : std::coroutine_handle { // expected-note 2{{candidate constructor (the implicit copy constructor) not viable

[clang] [clang] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

2024-07-17 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. LGTM, but I also have one question (either I don't understand something or there might be an error in the comment) https://github.com/llvm/llvm-project/pull/99032 ___ cfe-commits mailing lis

[clang] [clang] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

2024-07-17 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/99032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

2024-07-17 Thread Ilya Biryukov via cfe-commits
@@ -34,6 +34,6 @@ struct basic_string { }; } // namespace std void test(const char* a) { - // verify we're emitting the `-Wdangling-assignment` warning. + // verify we're emitting the `-Wdangling-assignment-gsl` warning. a = std::basic_string().c_str(); // expected-warnin

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-17 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/98320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-17 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: Thanks for adding an optional flag for this. Given that the profiles are 2-3x larger now, this seems very much warranted. Mostly LG, but I did have some questions and suggestions. PTAL. https://github.com/llvm/llvm-project/pull/98320 _

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-17 Thread Ilya Biryukov via cfe-commits
@@ -307,14 +331,25 @@ struct llvm::TimeTraceProfiler { // Minimum time granularity (in microseconds) const unsigned TimeTraceGranularity; + + // Make time trace capture verbose event details (eg. source filenames). This ilya-biryukov wrote: NIT: `e.g. `

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-17 Thread Ilya Biryukov via cfe-commits
@@ -83,16 +83,27 @@ namespace llvm { class raw_pwrite_stream; +struct TimeTraceMetadata { ilya-biryukov wrote: Could we also include the line numbers? I suspect it would be trivial to add that, but we will have an option of pointing at an exact line in the

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-17 Thread Ilya Biryukov via cfe-commits
@@ -60,39 +74,65 @@ bool compileFromString(StringRef Code, StringRef Standard, StringRef FileName) { return Compiler.ExecuteAction(Action); } +std::string GetMetadata(json::Object *Event) { + std::string Metadata = ""; + if (json::Object *Args = Event->getObject("args"))

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-17 Thread Ilya Biryukov via cfe-commits
@@ -83,16 +83,27 @@ namespace llvm { class raw_pwrite_stream; +struct TimeTraceMetadata { + std::string Detail; + // Source file information for the event. + std::string Filename; ilya-biryukov wrote: NIT: Maybe use `File` here and `file` in JSON for brev

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-18 Thread Ilya Biryukov via cfe-commits
@@ -60,39 +74,65 @@ bool compileFromString(StringRef Code, StringRef Standard, StringRef FileName) { return Compiler.ExecuteAction(Action); } +std::string GetMetadata(json::Object *Event) { + std::string Metadata = ""; + if (json::Object *Args = Event->getObject("args"))

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-18 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/98320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-18 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: A few more suggestions, and happy to approve as soon as the question about source events gets resolved. https://github.com/llvm/llvm-project/pull/98320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-18 Thread Ilya Biryukov via cfe-commits
@@ -3426,11 +3426,16 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, return true; llvm::TimeTraceScope TimeScope("InstantiateClass", [&]() { -std::string Name; -llvm::raw_string_ostream OS(Name); +llvm::TimeTraceMetadata M; +llvm::raw_stri

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-18 Thread Ilya Biryukov via cfe-commits
@@ -38,14 +42,24 @@ std::string teardownProfiler() { // Returns true if code compiles successfully. // We only parse AST here. This is enough for constexpr evaluation. -bool compileFromString(StringRef Code, StringRef Standard, StringRef FileName) { +bool compileFromString(St

[clang] [llvm] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-18 Thread Ilya Biryukov via cfe-commits
@@ -3426,11 +3426,16 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, return true; llvm::TimeTraceScope TimeScope("InstantiateClass", [&]() { -std::string Name; -llvm::raw_string_ostream OS(Name); +llvm::TimeTraceMetadata M; +llvm::raw_stri

[clang] [llvm] Reapply "Add source file name for template instantiations in -ftime-trace" (PR #99545)

2024-07-19 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: This still fails on Windows, see the buildkite errors. I believe the `filename(..., style::posix)` does not do what you intend, it actually assumes the inputs are in posix format, which is not the case on Windows. You want to use the native style https://github.com/llvm/ll

[clang] [llvm] Reapply "Add source file name for template instantiations in -ftime-trace" (PR #99545)

2024-07-19 Thread Ilya Biryukov via cfe-commits
@@ -60,13 +75,29 @@ bool compileFromString(StringRef Code, StringRef Standard, StringRef FileName) { return Compiler.ExecuteAction(Action); } +std::string GetMetadata(json::Object *Event) { + std::string Metadata; + llvm::raw_string_ostream OS(Metadata); + if (json::Obje

[clang] [llvm] Reapply "Add source file name for template instantiations in -ftime-trace" (PR #99545)

2024-07-19 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. LGTM, thanks https://github.com/llvm/llvm-project/pull/99545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Default arguments for template parameters affect ContainsUnexpandedPacks (PR #99880)

2024-07-22 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov created https://github.com/llvm/llvm-project/pull/99880 This addresses the FIXME in the code. There are tests for the new behavior in a follow up fix for #99877, which also addresses other bugs that prevent exposing the wrong results of `ContainsUnexpandedPac

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-22 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov created https://github.com/llvm/llvm-project/pull/99882 This addresses a crash in https://github.com/llvm/llvm-project/issues/99877 that happens on nested lambdas that use template parameter packs, see the added test. Before this patch, the code computing the '

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-22 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: This PR also includes changes from #99880, which I separated into another commit to simplify the review as this PR is a bit involved. https://github.com/llvm/llvm-project/pull/99882 ___ cfe-commits mailing list cfe-commits@lists.l

[clang] Record mainfile name in the Frontend time trace (PR #99866)

2024-07-22 Thread Ilya Biryukov via cfe-commits
@@ -81,7 +81,6 @@ std::string GetMetadata(json::Object *Event) { if (json::Object *Args = Event->getObject("args")) { if (auto Detail = Args->getString("detail")) OS << Detail; -// Use only filename to not include os-specific path separators. il

[clang] Record mainfile name in the Frontend time trace (PR #99866)

2024-07-22 Thread Ilya Biryukov via cfe-commits
@@ -152,7 +152,13 @@ void clang::ParseAST(Sema &S, bool PrintStats, bool SkipFunctionBodies) { bool HaveLexer = S.getPreprocessor().getCurrentLexer(); if (HaveLexer) { -llvm::TimeTraceScope TimeScope("Frontend"); +llvm::TimeTraceScope TimeScope("Frontend", [&]() {

[clang] Record mainfile name in the Frontend time trace (PR #99866)

2024-07-22 Thread Ilya Biryukov via cfe-commits
@@ -209,7 +208,7 @@ constexpr int slow_init_list[] = {1, 1, 2, 3, 5, 8, 13, 21}; // 25th line ASSERT_TRUE(compileFromString(Code, "-std=c++20", "test.cc")); std::string Json = teardownProfiler(); ASSERT_EQ(R"( -Frontend +Frontend (, test.cc) ilya-biryuko

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-22 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: > At first glance this seems like a duplicate of #86265 That seems right, I was not aware of the other PR, thanks for pointing this out. I still feel that avoiding the use of the flag from `LambdaScopeInfo` is an overall improvement that makes the code simpler, but the othe

[clang] [Sema] Preserve ContainsUnexpandedParameterPack in TransformLambdaExpr (PR #86265)

2024-07-22 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: Just FYI, I wasn't aware of this PR and have ended up with an alternative approach to tracking the unexpanded packs in #99882. (Thanks @cor3ntin for pointing this out) I'll let the reviewers decide if we should go with this change or mine, also happy to have some combinat

[clang] Record mainfile name in the Frontend time trace (PR #99866)

2024-07-22 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/99866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-22 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: > I think I prefer the approach chosen by @zyn0217. > > The changes are more targeted, and using a visitor for the call operator > avoid a lot of code duplication. In particular, if we want to properly handle > attributes, we might need code in `CollectUnexpandedParameterP

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-22 Thread Ilya Biryukov via cfe-commits
@@ -353,7 +353,11 @@ Sema::DiagnoseUnexpandedParameterPacks(SourceLocation Loc, } if (!EnclosingStmtExpr) { -LSI->ContainsUnexpandedParameterPack = true; +// It is ok to have unexpanded packs in captures, template parameters +// and paramete

[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

2024-07-22 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/99882 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Cleanup IncludeLocMap (PR #106241)

2024-08-28 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/106241 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Cleanup IncludeLocMap (PR #106241)

2024-08-28 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov requested changes to this pull request. This looks good, but I wanted to explore if we could write a unit test for this... https://github.com/llvm/llvm-project/pull/106241 ___ cfe-commits mailing list cfe-commits@lists

[clang] [clang] Cleanup IncludeLocMap (PR #106241)

2024-08-28 Thread Ilya Biryukov via cfe-commits
@@ -350,6 +350,7 @@ void SourceManager::clearIDTables() { LastLineNoContentCache = nullptr; LastFileIDLookup = FileID(); + IncludedLocMap.clear(); ilya-biryukov wrote: Is there a way to write a unit test checking this behavior? SourceManager should be r

[clang] [clang] Properly set file and line info for -ftime-trace (PR #106277)

2024-08-28 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/106277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Properly set file and line info for -ftime-trace (PR #106277)

2024-08-28 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: Suggestion: could we update the PR title to say something like "Output location in separate fields of `-ftime-trace`"? "properly" is open to interpretation and requires reading the full change description. https://github.com/llvm/llvm-project/pull/1

[clang] [clang] Properly set file and line info for -ftime-trace (PR #106277)

2024-08-28 Thread Ilya Biryukov via cfe-commits
@@ -1255,8 +1256,12 @@ Parser::DeclGroupPtrTy Parser::ParseDeclarationOrFunctionDefinition( // Add an enclosing time trace scope for a bunch of small scopes with // "EvaluateAsConstExpr". llvm::TimeTraceScope TimeScope("ParseDeclarationOrFunctionDefinition", [&]() { -

[clang] [clang] Properly set file and line info for -ftime-trace (PR #106277)

2024-08-28 Thread Ilya Biryukov via cfe-commits
@@ -1255,8 +1256,12 @@ Parser::DeclGroupPtrTy Parser::ParseDeclarationOrFunctionDefinition( // Add an enclosing time trace scope for a bunch of small scopes with // "EvaluateAsConstExpr". llvm::TimeTraceScope TimeScope("ParseDeclarationOrFunctionDefinition", [&]() { -

[clang] [clang] Properly set file and line info for -ftime-trace (PR #106277)

2024-08-28 Thread Ilya Biryukov via cfe-commits
@@ -223,15 +223,15 @@ Frontend (test.cc) | | | | EvaluateAsRValue () | | | EvaluateAsBooleanCondition () | | | | EvaluateAsRValue () -| ParseDeclarationOrFunctionDefinition (test.cc:16:1) +| ParseDeclarationOrFunctionDefinition (test.cc:16) | | ParseFunctionDefinition (slow_te

[clang] [clang] Properly set file and line info for -ftime-trace (PR #106277)

2024-08-28 Thread Ilya Biryukov via cfe-commits
@@ -1255,8 +1256,12 @@ Parser::DeclGroupPtrTy Parser::ParseDeclarationOrFunctionDefinition( // Add an enclosing time trace scope for a bunch of small scopes with // "EvaluateAsConstExpr". llvm::TimeTraceScope TimeScope("ParseDeclarationOrFunctionDefinition", [&]() { -

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-08-28 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov requested changes to this pull request. https://github.com/llvm/llvm-project/pull/103039 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-08-28 Thread Ilya Biryukov via cfe-commits
@@ -92,13 +94,17 @@ struct TimeTraceMetadata { bool isEmpty() const { return Detail.empty() && File.empty(); } }; +struct TimeTraceProfilerEntry; ilya-biryukov wrote: The idea of sharing most code and configuring only the relevant bits we need to write for

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-08-29 Thread Ilya Biryukov via cfe-commits
@@ -104,6 +105,23 @@ struct llvm::TimeTraceProfilerEntry { } }; +struct InProgressEntry { + std::unique_ptr Event; ilya-biryukov wrote: Could we store it directly as `TimeTraceProfilerEntry` without unique_ptr? We are already creating `InProgressEntry` in

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-08-29 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: I have left quite a few comments, but they are mostly about the code style. I think this looks really good overall and almost ready to land. Could you split the change to Sema into a separate PR so that we have time profiler changes separately? https

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-08-29 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/103039 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-08-29 Thread Ilya Biryukov via cfe-commits
@@ -75,18 +76,18 @@ struct llvm::TimeTraceProfilerEntry { const std::string Name; TimeTraceMetadata Metadata; - const bool AsyncEvent = false; + TimeTraceEventType EventType; ilya-biryukov wrote: Let's assign the default to avoid accidentally having uni

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-08-29 Thread Ilya Biryukov via cfe-commits
@@ -104,6 +105,23 @@ struct llvm::TimeTraceProfilerEntry { } }; +struct InProgressEntry { + std::unique_ptr Event; + std::vector InstantEvents; + + InProgressEntry(TimePointType &&S, TimePointType &&E, std::string &&N, + std::string &&Dt, TimeTraceEventTy

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-08-29 Thread Ilya Biryukov via cfe-commits
@@ -83,6 +83,8 @@ namespace llvm { class raw_pwrite_stream; +enum class TimeTraceEventType { CompleteEvent, InstantEvent, AsyncEvent }; ilya-biryukov wrote: It would be useful to add a comment explaining what different event types are about (e.g. it would m

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-08-29 Thread Ilya Biryukov via cfe-commits
@@ -104,6 +105,23 @@ struct llvm::TimeTraceProfilerEntry { } }; +struct InProgressEntry { + std::unique_ptr Event; + std::vector InstantEvents; + + InProgressEntry(TimePointType &&S, TimePointType &&E, std::string &&N, ilya-biryukov wrote: Suggestion: re

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-08-29 Thread Ilya Biryukov via cfe-commits
@@ -406,34 +450,50 @@ TimeTraceProfilerEntry *llvm::timeTraceProfilerBegin(StringRef Name, StringRef Detail) { if (TimeTraceProfilerInstance != nullptr) return TimeTraceProfilerInstance->begin( -std::string(Nam

[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

2024-08-29 Thread Ilya Biryukov via cfe-commits
@@ -194,13 +236,15 @@ struct llvm::TimeTraceProfiler { J.attribute("pid", Pid); J.attribute("tid", int64_t(Tid)); J.attribute("ts", StartUs); -if (E.AsyncEvent) { +if (TimeTraceEventType::AsyncEvent == E.EventType) { J.attribut

[clang] [clang] Cleanup IncludeLocMap (PR #106241)

2024-08-30 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/106241 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Cleanup IncludeLocMap (PR #106241)

2024-08-30 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. LGMT with a small suggestion. Thanks for getting the test in! https://github.com/llvm/llvm-project/pull/106241 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [clang] Cleanup IncludeLocMap (PR #106241)

2024-08-30 Thread Ilya Biryukov via cfe-commits
@@ -453,6 +454,61 @@ TEST_F(SourceManagerTest, loadedSLocEntryIsInTheSameTranslationUnit) { #if defined(LLVM_ON_UNIX) +TEST_F(SourceManagerTest, ResetsIncludeLocMap) { ilya-biryukov wrote: Suggestion: add a comment explaining what this aims to test at a mor

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-08-30 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/102040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-08-30 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: I hope folks are ok with me chiming in as a reviewer for this. I've left quite a few comments in the RFC and is also supportive of landing this change and happy to invest into supporting it going forward inside our team. https://github.com/llvm/llvm-

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-08-30 Thread Ilya Biryukov via cfe-commits
@@ -1472,3 +1472,25 @@ template struct Outer { }; }; Outer::Inner outerinner; + +void aggregate() { + struct B { +[[clang::explicit_init]] int f1; + }; + + struct S : B { // expected-warning {{uninitialized}} +int f2; +int f3 [[clang::explicit_init]]; + }; + +

[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)

2024-08-30 Thread Ilya Biryukov via cfe-commits
@@ -1419,6 +1419,28 @@ is not specified. }]; } +def ExplicitInitDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``clang::explicit_init`` attribute indicates that the field must be +initialized explicitly by the caller when the class is construc

[clang-tools-extra] [include-cleaner] Report refs for enum constants used through namespace aliases (PR #106706)

2024-08-30 Thread Ilya Biryukov via cfe-commits
@@ -534,6 +534,8 @@ TEST(WalkAST, Enums) { testWalk(R"(namespace ns { enum E { A = 42 }; } struct S { using ns::E::A; };)", "int e = S::^A;"); + testWalk(R"(namespace ns { enum E { $explicit^A = 42 }; })", + "namespace z = ns; int e = z::^A

[clang-tools-extra] [include-cleaner] Report refs for enum constants used through namespace aliases (PR #106706)

2024-08-30 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/106706 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [include-cleaner] Report refs for enum constants used through namespace aliases (PR #106706)

2024-08-30 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. LGTM. See a small suggestion about adding another test too. https://github.com/llvm/llvm-project/pull/106706 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang] [clang-tools-extra] [Clang] Add __type_list_dedup builtin to deduplicate types in templat… (PR #106730)

2024-08-30 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov created https://github.com/llvm/llvm-project/pull/106730 …e arguments This allows to deduplicate the type lists efficiently in C++. It is possible to achieve the same effect via template metaprogramming, but performance of the resulting code is much lower than

[clang] [clang-tools-extra] [Clang] Add __type_list_dedup builtin to deduplicate types in templat… (PR #106730)

2024-08-30 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov updated https://github.com/llvm/llvm-project/pull/106730 >From 0151fbf9a8cea2d1c60dc399f088258dd94ad562 Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Fri, 23 Aug 2024 17:27:26 +0200 Subject: [PATCH 1/2] [Clang] Add __type_list_dedup builtin to deduplicate

[clang-tools-extra] [include-cleaner] Report refs for enum constants used through namespace aliases (PR #106706)

2024-08-30 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/106706 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [include-cleaner] Report refs for enum constants used through namespace aliases (PR #106706)

2024-08-30 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov approved this pull request. Still LGTM. See one minor comment about the code style, but up to you if you want to apply it or not. https://github.com/llvm/llvm-project/pull/106706 ___ cfe-commits mailing list cfe-commit

[clang-tools-extra] [include-cleaner] Report refs for enum constants used through namespace aliases (PR #106706)

2024-08-30 Thread Ilya Biryukov via cfe-commits
@@ -146,9 +148,24 @@ class ASTWalker : public RecursiveASTVisitor { // // If it's an enum constant, it must be due to prior decl. Report references // to it when qualifier isn't a type. -if (llvm::isa(FD)) { - if (!DRE->getQualifier() || DRE->getQualifier(

[clang-tools-extra] [include-cleaner] Report refs for enum constants used through namespace aliases (PR #106706)

2024-08-30 Thread Ilya Biryukov via cfe-commits
@@ -534,6 +534,8 @@ TEST(WalkAST, Enums) { testWalk(R"(namespace ns { enum E { A = 42 }; } struct S { using ns::E::A; };)", "int e = S::^A;"); + testWalk(R"(namespace ns { enum E { $explicit^A = 42 }; })", + "namespace z = ns; int e = z::^A

[clang-tools-extra] [include-cleaner] Report refs for enum constants used through namespace aliases (PR #106706)

2024-08-30 Thread Ilya Biryukov via cfe-commits
@@ -146,9 +148,24 @@ class ASTWalker : public RecursiveASTVisitor { // // If it's an enum constant, it must be due to prior decl. Report references // to it when qualifier isn't a type. -if (llvm::isa(FD)) { - if (!DRE->getQualifier() || DRE->getQualifier(

[clang] [clang-tools-extra] [Clang] Add __type_list_dedup builtin to deduplicate types in templat… (PR #106730)

2024-08-30 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: RFC for this change: https://discourse.llvm.org/t/rfc-adding-builtin-for-deduplicating-type-lists/80986 https://github.com/llvm/llvm-project/pull/106730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang-tools-extra] [include-cleaner] Report refs for enum constants used through namespace aliases (PR #106706)

2024-09-02 Thread Ilya Biryukov via cfe-commits
@@ -146,9 +148,24 @@ class ASTWalker : public RecursiveASTVisitor { // // If it's an enum constant, it must be due to prior decl. Report references // to it when qualifier isn't a type. -if (llvm::isa(FD)) { - if (!DRE->getQualifier() || DRE->getQualifier(

[clang] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-11 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/98320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-11 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov commented: Are we worried about the increase in the output file sizes? https://github.com/llvm/llvm-project/pull/98320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-11 Thread Ilya Biryukov via cfe-commits
@@ -3430,6 +3430,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, llvm::raw_string_ostream OS(Name); Instantiation->getNameForDiagnostic(OS, getPrintingPolicy(), /*Qualified=*/true); +OS << ", file:" << Source

[clang] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-11 Thread Ilya Biryukov via cfe-commits
@@ -3430,6 +3430,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, llvm::raw_string_ostream OS(Name); ilya-biryukov wrote: Should we do this for other things? Most of the nodes are likely to have a source location they can be attributed to.

[clang] Add source file name for template instantiations in -ftime-trace (PR #98320)

2024-07-11 Thread Ilya Biryukov via cfe-commits
@@ -3430,6 +3430,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, llvm::raw_string_ostream OS(Name); Instantiation->getNameForDiagnostic(OS, getPrintingPolicy(), /*Qualified=*/true); +OS << ", file:" << Source

[clang-tools-extra] [clangd] [C++20] [Modules] Introduce initial support for C++20 Modules (PR #66462)

2024-05-03 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: Adding @kadircet to continue the review where Sam left off. Unfortunately, Sam does not have the capacity to finish this review. https://github.com/llvm/llvm-project/pull/66462 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[clang] [Serialization] Check for stack exhaustion when reading declarations (PR #79875)

2024-05-08 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: Sorry for loosing track of this change. I will go through the comments and try to land this some time next week. https://github.com/llvm/llvm-project/pull/79875 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists

[clang] [clang-tools-extra] Reapply "[Clang][Sema] Diagnose class member access expressions naming non-existent members of the current instantiation prior to instantiation in the absence of dependent

2024-05-13 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: 🤯 amazingly, this only happens when the identifier being called is a lowercase version of the class name: https://gcc.godbolt.org/z/8aoaoPKnT: ```cpp template class Clone { public: Clone(const Clone&); T* operator->() const; T* ptr_; }; template struct F

[clang] [clang-tools-extra] Reapply "[Clang][Sema] Diagnose class member access expressions naming non-existent members of the current instantiation prior to instantiation in the absence of dependent

2024-05-13 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: Heh, of course! Now that you say it, that's quite obvious. Do you think is fix is just around the corner or will it take a long time? This blocks our internal compiler release and there is no workaround we could easily employ. https://github.com/llvm/llvm-project/pull/9015

[clang] [clang-tools-extra] Reapply "[Clang][Sema] Diagnose class member access expressions naming non-existent members of the current instantiation prior to instantiation in the absence of dependent

2024-05-13 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: Awesome, thanks a lot for looking into it! https://github.com/llvm/llvm-project/pull/90152 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement a bitwise_copyable builtin type trait. (PR #86512)

2024-05-14 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: A few comments from me to move this review forward. The major question I have is about the tests and how reference members should affect the results of that trait. https://github.com/llvm/llvm-project/pull/86512 ___ cfe-commits ma

[clang] [clang] Implement a bitwise_copyable builtin type trait. (PR #86512)

2024-05-14 Thread Ilya Biryukov via cfe-commits
@@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s + +// Scalar types are bitwise clonable. +static_assert(__is_bitwise_cloneable(int)); +static_assert(__is_bitwise_cloneable(int*)); +// array +static_assert(__is_bitwise_cloneable(int[10])); + +// non-scalar

[clang] [clang] Implement a bitwise_copyable builtin type trait. (PR #86512)

2024-05-14 Thread Ilya Biryukov via cfe-commits
@@ -3958,6 +3958,50 @@ Note that the `size` argument must be a compile time constant. Note that this intrinsic cannot yet be called in a ``constexpr`` context. +``__is_bitwise_cloneable`` +- + +A type trait is used to check whether a type can be safel

[clang] [clang] Implement a bitwise_copyable builtin type trait. (PR #86512)

2024-05-14 Thread Ilya Biryukov via cfe-commits
@@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s + +// Scalar types are bitwise clonable. +static_assert(__is_bitwise_cloneable(int)); +static_assert(__is_bitwise_cloneable(int*)); +// array +static_assert(__is_bitwise_cloneable(int[10])); + +// non-scalar

[clang] [clang] Implement a bitwise_copyable builtin type trait. (PR #86512)

2024-05-14 Thread Ilya Biryukov via cfe-commits
@@ -2718,6 +2718,36 @@ bool QualType::isTriviallyCopyableType(const ASTContext &Context) const { /*IsCopyConstructible=*/false); } +bool QualType::isBitwiseCloneableType(const ASTContext & Context) const { + QualType CanonicalType = getCa

[clang] [clang] Implement a bitwise_copyable builtin type trait. (PR #86512)

2024-05-14 Thread Ilya Biryukov via cfe-commits
@@ -2718,6 +2718,36 @@ bool QualType::isTriviallyCopyableType(const ASTContext &Context) const { /*IsCopyConstructible=*/false); } +bool QualType::isBitwiseCloneableType(const ASTContext & Context) const { + QualType CanonicalType = getCa

[clang] [clang] Implement a bitwise_copyable builtin type trait. (PR #86512)

2024-05-14 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov edited https://github.com/llvm/llvm-project/pull/86512 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    5   6   7   8   9   10   11   12   13   14   >