[llvm-branch-commits] [clang] c332445 - [clang] Add -fprofile-prefix-map
Author: Keith Smiley Date: 2021-01-25T10:14:04-08:00 New Revision: c3324450b204392169d4ec7172cb32f74c03e376 URL: https://github.com/llvm/llvm-project/commit/c3324450b204392169d4ec7172cb32f74c03e376 DIFF: https://github.com/llvm/llvm-project/commit/c3324450b204392169d4ec7172cb32f74c03e376.diff LOG: [clang] Add -fprofile-prefix-map This flag allows you to re-write absolute paths in coverage data analogous to -fdebug-prefix-map. This flag is also implied by -ffile-prefix-map. Added: clang/test/Profile/profile-prefix-map.c Modified: clang/include/clang/Basic/CodeGenOptions.h clang/include/clang/Driver/Options.td clang/lib/CodeGen/CoverageMappingGen.cpp clang/lib/CodeGen/CoverageMappingGen.h clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/test/Driver/debug-prefix-map.c Removed: diff --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h index ef4fa31256cd..5a37569be409 100644 --- a/clang/include/clang/Basic/CodeGenOptions.h +++ b/clang/include/clang/Basic/CodeGenOptions.h @@ -169,6 +169,7 @@ class CodeGenOptions : public CodeGenOptionsBase { std::string RecordCommandLine; std::map DebugPrefixMap; + std::map ProfilePrefixMap; /// The ABI to use for passing floating point arguments. std::string FloatABI; diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index dd7978435ff1..0a23fb18d3a6 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2601,6 +2601,10 @@ def fdebug_prefix_map_EQ : Joined<["-"], "fdebug-prefix-map=">, Group, Flags<[CC1Option,CC1AsOption]>, HelpText<"remap file source paths in debug info">; +def fprofile_prefix_map_EQ + : Joined<["-"], "fprofile-prefix-map=">, Group, +Flags<[CC1Option]>, +HelpText<"remap file source paths in coverage info">; def ffile_prefix_map_EQ : Joined<["-"], "ffile-prefix-map=">, Group, HelpText<"remap file source paths in debug info and predefined preprocessor macros">; diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index c474546d4abf..5c25c204cc0b 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -1544,13 +1544,6 @@ struct CounterCoverageMappingBuilder } }; -std::string normalizeFilename(StringRef Filename) { - llvm::SmallString<256> Path(Filename); - llvm::sys::fs::make_absolute(Path); - llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true); - return std::string(Path); -} - } // end anonymous namespace static void dump(llvm::raw_ostream &OS, StringRef FunctionName, @@ -1592,6 +1585,23 @@ static void dump(llvm::raw_ostream &OS, StringRef FunctionName, } } +CoverageMappingModuleGen::CoverageMappingModuleGen( +CodeGenModule &CGM, CoverageSourceInfo &SourceInfo) +: CGM(CGM), SourceInfo(SourceInfo) { + ProfilePrefixMap = CGM.getCodeGenOpts().ProfilePrefixMap; +} + +std::string CoverageMappingModuleGen::normalizeFilename(StringRef Filename) { + llvm::SmallString<256> Path(Filename); + llvm::sys::fs::make_absolute(Path); + llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true); + for (const auto &Entry : ProfilePrefixMap) { +if (llvm::sys::path::replace_path_prefix(Path, Entry.first, Entry.second)) + break; + } + return Path.str().str(); +} + static std::string getInstrProfSection(const CodeGenModule &CGM, llvm::InstrProfSectKind SK) { return llvm::getInstrProfSectionName( diff --git a/clang/lib/CodeGen/CoverageMappingGen.h b/clang/lib/CodeGen/CoverageMappingGen.h index 9d0aa3b9cad1..b26f79be5316 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.h +++ b/clang/lib/CodeGen/CoverageMappingGen.h @@ -93,6 +93,9 @@ class CoverageMappingModuleGen { llvm::SmallDenseMap FileEntries; std::vector FunctionNames; std::vector FunctionRecords; + std::map ProfilePrefixMap; + + std::string normalizeFilename(StringRef Filename); /// Emit a function record. void emitFunctionMappingRecord(const FunctionInfo &Info, @@ -101,8 +104,7 @@ class CoverageMappingModuleGen { public: static CoverageSourceInfo *setUpCoverageCallbacks(Preprocessor &PP); - CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo) - : CGM(CGM), SourceInfo(SourceInfo) {} + CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo); CoverageSourceInfo &getSourceInfo() const { return SourceInfo; diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 7ae0de21317d..8530ac765332 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -656,6 +656,21 @@ static void addMacroPrefixMapArg(const Driver &D, const ArgList &Ar
[llvm-branch-commits] [clang-tools-extra] 9d9ceb3 - Revert "[clangd][NFC] Simplify handing on methods with no params"
Author: Keith Smiley Date: 2021-01-25T11:56:18-08:00 New Revision: 9d9ceb37453ffe0186d04f4e9e4ba9fb41200b57 URL: https://github.com/llvm/llvm-project/commit/9d9ceb37453ffe0186d04f4e9e4ba9fb41200b57 DIFF: https://github.com/llvm/llvm-project/commit/9d9ceb37453ffe0186d04f4e9e4ba9fb41200b57.diff LOG: Revert "[clangd][NFC] Simplify handing on methods with no params" This broke the build http://lab.llvm.org:8011/#/builders/7/builds/1405 This reverts commit f05b492aae4d4a741ec59f19518df91a3012824c. Differential Revision: https://reviews.llvm.org/D95385 Added: Modified: clang-tools-extra/clangd/ClangdLSPServer.cpp clang-tools-extra/clangd/ClangdLSPServer.h clang-tools-extra/clangd/Protocol.h Removed: diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp index 930cc3f6c5d9..24d3a3509ca8 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.cpp +++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp @@ -258,15 +258,6 @@ class ClangdLSPServer::MessageHandler : public Transport::MessageHandler { }; } - template - void bind(const char *Method, -void (ClangdLSPServer::*Handler)(Callback)) { -Calls[Method] = [Handler, this](llvm::json::Value RawParams, -ReplyOnce Reply) { - (Server.*Handler)(std::move(Reply)); -}; - } - // Bind a reply callback to a request. The callback will be invoked when // clangd receives the reply from the LSP client. // Return a call id of the request. @@ -310,20 +301,6 @@ class ClangdLSPServer::MessageHandler : public Transport::MessageHandler { }; } - void bind(const char *Method, void (ClangdLSPServer::*Handler)()) { -Notifications[Method] = [Handler, this](llvm::json::Value RawParams) { - (Server.*Handler)(); -}; - } - - template <> - void bind(const char *Method, - void (ClangdLSPServer::*Handler)(const NoParams &)) { -Notifications[Method] = [Handler, this](llvm::json::Value RawParams) { - (Server.*Handler)(NoParams{}); -}; - } - private: // Function object to reply to an LSP call. // Each instance must be called exactly once, otherwise: @@ -670,7 +647,8 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params, void ClangdLSPServer::onInitialized(const InitializedParams &Params) {} -void ClangdLSPServer::onShutdown(Callback Reply) { +void ClangdLSPServer::onShutdown(const ShutdownParams &Params, + Callback Reply) { // Do essentially nothing, just say we're ready to exit. ShutdownRequestReceived = true; Reply(nullptr); @@ -678,7 +656,8 @@ void ClangdLSPServer::onShutdown(Callback Reply) { // sync is a clangd extension: it blocks until all background work completes. // It blocks the calling thread, so no messages are processed until it returns! -void ClangdLSPServer::onSync(Callback Reply) { +void ClangdLSPServer::onSync(const NoParams &Params, + Callback Reply) { if (Server->blockUntilIdleForTest(/*TimeoutSeconds=*/60)) Reply(nullptr); else @@ -1466,7 +1445,8 @@ void ClangdLSPServer::onSemanticTokensDelta( }); } -void ClangdLSPServer::onMemoryUsage(Callback Reply) { +void ClangdLSPServer::onMemoryUsage(const NoParams &, +Callback Reply) { llvm::BumpPtrAllocator DetailAlloc; MemoryTree MT(&DetailAlloc); profile(MT); diff --git a/clang-tools-extra/clangd/ClangdLSPServer.h b/clang-tools-extra/clangd/ClangdLSPServer.h index d8ce2dbe53db..3a46bd7b1bea 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.h +++ b/clang-tools-extra/clangd/ClangdLSPServer.h @@ -93,8 +93,8 @@ class ClangdLSPServer : private ClangdServer::Callbacks { // Calls have signature void(const Params&, Callback). void onInitialize(const InitializeParams &, Callback); void onInitialized(const InitializedParams &); - void onShutdown(Callback); - void onSync(Callback); + void onShutdown(const ShutdownParams &, Callback); + void onSync(const NoParams &, Callback); void onDocumentDidOpen(const DidOpenTextDocumentParams &); void onDocumentDidChange(const DidChangeTextDocumentParams &); void onDocumentDidClose(const DidCloseTextDocumentParams &); @@ -161,7 +161,7 @@ class ClangdLSPServer : private ClangdServer::Callbacks { Callback); /// This is a clangd extension. Provides a json tree representing memory usage /// hierarchy. - void onMemoryUsage(Callback); + void onMemoryUsage(const NoParams &, Callback); std::vector getFixes(StringRef File, const clangd::Diagnostic &D); diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h index 43c95686868b..9f0e50fe863f 100644 --- a/clang-tools-extra/clangd/Protocol.h +++ b/clang-tools-extra/clangd/Protocol.h @@ -265,6 +
[llvm-branch-commits] [clang] workflows/release-binaries: Use static ZSTD on macOS (PR #110701)
https://github.com/keith created https://github.com/llvm/llvm-project/pull/110701 On macOS the shared zstd library points to a homebrew install that isn't very stable for users. (cherry picked from commit 748f5404ccdf28d4beef37efdaeba7a1701ab425) >From 303522ffc4552eb9182c07c5881a905bad071991 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 1 Oct 2024 10:02:20 -0700 Subject: [PATCH] workflows/release-binaries: Use static ZSTD on macOS On macOS the shared zstd library points to a homebrew install that isn't very stable for users. (cherry picked from commit 748f5404ccdf28d4beef37efdaeba7a1701ab425) --- clang/cmake/caches/Release.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake index 6d5f75ca0074ee..c4947bf453872b 100644 --- a/clang/cmake/caches/Release.cmake +++ b/clang/cmake/caches/Release.cmake @@ -101,3 +101,6 @@ set_final_stage_var(LLVM_ENABLE_PROJECTS "${LLVM_RELEASE_ENABLE_PROJECTS}" STRIN set_final_stage_var(CPACK_GENERATOR "TXZ" STRING) set_final_stage_var(CPACK_ARCHIVE_THREADS "0" STRING) +if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin") + set_final_stage_var(LLVM_USE_STATIC_ZSTD "ON" BOOL) +endif() ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] workflows/release-binaries: Use static ZSTD on macOS (PR #110701)
keith wrote: Is the process for this that you will merge it at some point? Mainly wondering if I need to keep following it to make sure it makes it for the next one https://github.com/llvm/llvm-project/pull/110701 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] workflows/release-binaries: Use static ZSTD on macOS (PR #110701)
keith wrote: Thanks! https://github.com/llvm/llvm-project/pull/110701 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/20.x: [CMake][Release] Statically link ZSTD on all OSes (#128554) (PR #128793)
keith wrote: Seems good to me! https://github.com/llvm/llvm-project/pull/128793 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits