[Lldb-commits] [PATCH] D126240: [lldb] Tighten the scope of a couple of locks in DataFormatters.
hawkinsw added inline comments. Comment at: lldb/source/DataFormatters/FormatManager.cpp:595 + { +std::lock_guard guard(m_language_categories_mutex); +m_language_categories_map[lang_type] = jgorbe wrote: > hawkinsw wrote: > > Forgive me if I am speaking out of turn, but do we need to check again here > > for whether `lang_type` is in the map? In other words, it seems possible > > that (in some zany situation) while we are doing the memory allocation > > (line 593) someone else has come along and added that category since we > > released the lock on it in 592. > > > > I hope that this is helpful. Please (again) forgive me if I am speaking out > > of turn. > Not at all! Thank you for your comment! :) > > You are absolutely right, I had overlooked this case. Another annoying > consequence is that in this case the racing threads would create multiple > `LanguageCategory` objects. The `LanguageCategory` constructor calls `Enable` > which in turn ends up calling the `Changed` method of the listener, so even > if we check the map before insertion I think we'd still see the listener > receiving multiple notifications that the category was enabled, which is not > ideal. > > I don't know how to properly fix this. I'll give it some more thought. Glad that it was helpful! I will keep an eye on this PR and be ready to help again if you can find a way out of that tricky conundrum!! :-) Will Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126240/new/ https://reviews.llvm.org/D126240 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D126015: [trace][intelpt] Support system-wide tracing [12] - Support multi-core trace load and save
jj10306 added a comment. feeback-v3 - completed review Comment at: lldb/docs/use/intel_pt.rst:168 :: { +"type": "intel-pt", Consider adding a section on the perfTscConversion parameters while we're editing this file as I don't currently see that in this file. Also, it doesn't appear the "cores" section is here either Comment at: lldb/source/Target/Trace.cpp:30-32 struct JSONSimpleTraceSession { - JSONSimplePluginSettings trace; + std::string type; }; do we need this struct or can we just use a string directly since the struct only has a single member? Comment at: lldb/source/Target/Trace.cpp:134 +return None; + std::unordered_map &single_core_data = it->second; + auto single_thread_data_it = single_core_data.find(kind.str()); Comment at: lldb/source/Target/Trace.cpp:135 + std::unordered_map &single_core_data = it->second; + auto single_thread_data_it = single_core_data.find(kind.str()); + if (single_thread_data_it == single_core_data.end()) why is this named thread_data, isn't this the size of the core's buffer? Comment at: lldb/source/Target/Trace.cpp:325 + + std::unordered_map &data_kind_to_file_spec_map = + it->second; Comment at: lldb/unittests/Process/Linux/PerfTests.cpp:9 -#ifdef __x86_64__ - isn't this needed since `readTsc()` uses intel specific assembly instructions? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126015/new/ https://reviews.llvm.org/D126015 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 4969a69 - Use llvm::less_first (NFC)
Author: Kazu Hirata Date: 2022-06-04T21:23:18-07:00 New Revision: 4969a6924dc1644d4fa6cf89a33b598e647f5513 URL: https://github.com/llvm/llvm-project/commit/4969a6924dc1644d4fa6cf89a33b598e647f5513 DIFF: https://github.com/llvm/llvm-project/commit/4969a6924dc1644d4fa6cf89a33b598e647f5513.diff LOG: Use llvm::less_first (NFC) Added: Modified: clang/lib/AST/Interp/Function.cpp clang/lib/Frontend/FrontendAction.cpp clang/lib/Sema/SemaDeclCXX.cpp clang/lib/Sema/SemaStmtAsm.cpp clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp llvm/include/llvm/ExecutionEngine/Orc/Core.h llvm/lib/CodeGen/MIRCanonicalizerPass.cpp llvm/lib/IR/Attributes.cpp llvm/lib/ObjCopy/MachO/MachOWriter.cpp llvm/lib/ObjectYAML/MachOEmitter.cpp llvm/tools/dsymutil/DebugMap.cpp llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp Removed: diff --git a/clang/lib/AST/Interp/Function.cpp b/clang/lib/AST/Interp/Function.cpp index 0ed13a92aa38d..6ba97df1cd30e 100644 --- a/clang/lib/AST/Interp/Function.cpp +++ b/clang/lib/AST/Interp/Function.cpp @@ -34,8 +34,7 @@ Function::ParamDescriptor Function::getParamDescriptor(unsigned Offset) const { SourceInfo Function::getSource(CodePtr PC) const { unsigned Offset = PC - getCodeBegin(); using Elem = std::pair; - auto It = std::lower_bound(SrcMap.begin(), SrcMap.end(), Elem{Offset, {}}, - [](Elem A, Elem B) { return A.first < B.first; }); + auto It = llvm::lower_bound(SrcMap, Elem{Offset, {}}, llvm::less_first()); if (It == SrcMap.end() || It->first != Offset) llvm::report_fatal_error("missing source location"); return It->second; diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 68c70dda12b9e..6b1f6364b13c3 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -413,11 +413,7 @@ static std::error_code collectModuleHeaderIncludes( // Sort header paths and make the header inclusion order deterministic // across diff erent OSs and filesystems. -llvm::sort(Headers.begin(), Headers.end(), []( - const std::pair &LHS, - const std::pair &RHS) { -return LHS.first < RHS.first; -}); +llvm::sort(Headers.begin(), Headers.end(), llvm::less_first()); for (auto &H : Headers) { // Include this header as part of the umbrella directory. Module->addTopHeader(H.second); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index c470a46f58477..569b226da9233 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -5430,8 +5430,7 @@ static void DiagnoseBaseOrMemInitializerOrder( return; // Sort based on the ideal order, first in the pair. - llvm::sort(CorrelatedInitOrder, - [](auto &LHS, auto &RHS) { return LHS.first < RHS.first; }); + llvm::sort(CorrelatedInitOrder, llvm::less_first()); // Introduce a new scope as SemaDiagnosticBuilder needs to be destroyed to // emit the diagnostic before we can try adding notes. diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp index fbca36b1216a8..c147d26b2dff3 100644 --- a/clang/lib/Sema/SemaStmtAsm.cpp +++ b/clang/lib/Sema/SemaStmtAsm.cpp @@ -716,10 +716,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, NamedOperandList.emplace_back( std::make_pair(Names[i]->getName(), Exprs[i])); // Sort NamedOperandList. - std::stable_sort(NamedOperandList.begin(), NamedOperandList.end(), - [](const NamedOperand &LHS, const NamedOperand &RHS) { -return LHS.first < RHS.first; - }); + llvm::stable_sort(NamedOperandList, llvm::less_first()); // Find adjacent duplicate operand. SmallVector::iterator Found = std::adjacent_find(begin(NamedOperandList), end(NamedOperandList), diff --git a/clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp b/clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp index eb6014a0629df..7cd15f0f65954 100644 --- a/clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp +++ b/clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp @@ -101,10 +101,7 @@ USAGE: -analyzer-config #undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE }; - llvm::sort(PrintableOptions, [](const OptionAndDescriptionTy &LHS, - const OptionAndDescriptionTy &RHS) { -return LHS.first < RHS.first; - }); + llvm::sort(PrintableOptions, llvm::less_first()); for (const auto &Pair : PrintableOptions) { AnalyzerOptions::printFormattedEntry(out, Pair, /*InitialPad*/ 2, diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp b/lldb/source/Plugins/Sym
[Lldb-commits] [lldb] 8cc9fa6 - Use static_cast from SmallString to std::string (NFC)
Author: Kazu Hirata Date: 2022-06-04T22:09:27-07:00 New Revision: 8cc9fa6f78237a5771a5f85eb9ef129ea85a54cf URL: https://github.com/llvm/llvm-project/commit/8cc9fa6f78237a5771a5f85eb9ef129ea85a54cf DIFF: https://github.com/llvm/llvm-project/commit/8cc9fa6f78237a5771a5f85eb9ef129ea85a54cf.diff LOG: Use static_cast from SmallString to std::string (NFC) Added: Modified: clang/lib/Driver/Driver.cpp clang/tools/libclang/CIndexer.cpp lldb/source/Utility/FileSpec.cpp Removed: diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 3185ebcd46a4e..8e698a2a7cbef 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -973,7 +973,7 @@ bool Driver::loadConfigFile() { if (llvm::sys::fs::make_absolute(CfgDir).value() != 0) SystemConfigDir.clear(); else - SystemConfigDir = std::string(CfgDir.begin(), CfgDir.end()); + SystemConfigDir = static_cast(CfgDir); } } if (CLOptions->hasArg(options::OPT_config_user_dir_EQ)) { @@ -984,7 +984,7 @@ bool Driver::loadConfigFile() { if (llvm::sys::fs::make_absolute(CfgDir).value() != 0) UserConfigDir.clear(); else - UserConfigDir = std::string(CfgDir.begin(), CfgDir.end()); + UserConfigDir = static_cast(CfgDir); } } } diff --git a/clang/tools/libclang/CIndexer.cpp b/clang/tools/libclang/CIndexer.cpp index dab3fc4e201d0..77da2e4fa5ead 100644 --- a/clang/tools/libclang/CIndexer.cpp +++ b/clang/tools/libclang/CIndexer.cpp @@ -176,7 +176,7 @@ LibclangInvocationReporter::LibclangInvocationReporter( if (llvm::sys::fs::createUniqueFile(TempPath, FD, TempPath, llvm::sys::fs::OF_Text)) return; - File = std::string(TempPath.begin(), TempPath.end()); + File = static_cast(TempPath); llvm::raw_fd_ostream OS(FD, /*ShouldClose=*/true); // Write out the information about the invocation to it. diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp index eed3bbd46026f..c0dbc29bcd1f1 100644 --- a/lldb/source/Utility/FileSpec.cpp +++ b/lldb/source/Utility/FileSpec.cpp @@ -357,7 +357,7 @@ size_t FileSpec::GetPath(char *path, size_t path_max_len, std::string FileSpec::GetPath(bool denormalize) const { llvm::SmallString<64> result; GetPath(result, denormalize); - return std::string(result.begin(), result.end()); + return static_cast(result); } const char *FileSpec::GetCString(bool denormalize) const { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits