[llvm-branch-commits] [lld] 525ffb0 - [ELF] Support --package-metadata

2022-08-10 Thread Tobias Hieta via llvm-branch-commits

Author: Alex Brachet
Date: 2022-08-10T10:49:39+02:00
New Revision: 525ffb05aa2c070f01a2760370c76a53a62cfd78

URL: 
https://github.com/llvm/llvm-project/commit/525ffb05aa2c070f01a2760370c76a53a62cfd78
DIFF: 
https://github.com/llvm/llvm-project/commit/525ffb05aa2c070f01a2760370c76a53a62cfd78.diff

LOG: [ELF] Support --package-metadata

This was recently introduced in GNU linkers and it makes sense for
ld.lld to have the same support. This implementation omits checking if
the input string is valid json to reduce size bloat.

Differential Revision: https://reviews.llvm.org/D131439

(cherry picked from commit dbd04b853b680b0a383e5f58edf3643364f67bdf)

Added: 
lld/test/ELF/package-metadata.s

Modified: 
lld/ELF/Config.h
lld/ELF/Driver.cpp
lld/ELF/Options.td
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h
lld/ELF/Writer.cpp
lld/docs/ReleaseNotes.rst
llvm/include/llvm/BinaryFormat/ELF.h

Removed: 




diff  --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index 39723f092784..af976e39147d 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -290,6 +290,7 @@ struct Configuration {
   StringRef thinLTOJobs;
   unsigned timeTraceGranularity;
   int32_t splitStackAdjustSize;
+  StringRef packageMetadata;
 
   // The following config options do not directly correspond to any
   // particular command line options.

diff  --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index dc2d4ada450d..296fb4220012 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1145,6 +1145,7 @@ static void readConfigs(opt::InputArgList &args) {
   config->optimize = args::getInteger(args, OPT_O, 1);
   config->orphanHandling = getOrphanHandling(args);
   config->outputFile = args.getLastArgValue(OPT_o);
+  config->packageMetadata = args.getLastArgValue(OPT_package_metadata);
   config->pie = args.hasFlag(OPT_pie, OPT_no_pie, false);
   config->printIcfSections =
   args.hasFlag(OPT_print_icf_sections, OPT_no_print_icf_sections, false);

diff  --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index 80c0ff9fe1b8..d9266e595887 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -503,6 +503,8 @@ def z: JoinedOrSeparate<["-"], "z">, 
MetaVarName<"">,
 def visual_studio_diagnostics_format : FF<"vs-diagnostics">,
 HelpText<"Format diagnostics for Visual Studio compatibility">;
 
+def package_metadata: JJ<"package-metadata=">, HelpText<"Emit package metadata 
note">;
+
 // Aliases
 def: Separate<["-"], "f">, Alias, HelpText<"Alias for --auxiliary">;
 def: F<"call_shared">, Alias, HelpText<"Alias for --Bdynamic">;

diff  --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index aa5e8675dd31..b359c2e7bcea 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -3887,6 +3887,20 @@ size_t MemtagAndroidNote::getSize() const {
  /*descsz=*/sizeof(uint32_t);
 }
 
+void PackageMetadataNote::writeTo(uint8_t *buf) {
+  write32(buf, 4);
+  write32(buf + 4, config->packageMetadata.size() + 1);
+  write32(buf + 8, FDO_PACKAGING_METADATA);
+  memcpy(buf + 12, "FDO", 4);
+  memcpy(buf + 16, config->packageMetadata.data(),
+ config->packageMetadata.size());
+}
+
+size_t PackageMetadataNote::getSize() const {
+  return sizeof(llvm::ELF::Elf64_Nhdr) + 4 +
+ alignTo(config->packageMetadata.size() + 1, 4);
+}
+
 InStruct elf::in;
 
 std::vector elf::partitions;

diff  --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index 9e95d3f3f65a..987c0461ec07 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -1199,6 +1199,15 @@ class MemtagAndroidNote : public SyntheticSection {
   size_t getSize() const override;
 };
 
+class PackageMetadataNote : public SyntheticSection {
+public:
+  PackageMetadataNote()
+  : SyntheticSection(llvm::ELF::SHF_ALLOC, llvm::ELF::SHT_NOTE,
+ /*alignment=*/4, ".note.package") {}
+  void writeTo(uint8_t *buf) override;
+  size_t getSize() const override;
+};
+
 InputSection *createInterpSection();
 MergeInputSection *createCommentSection();
 template  void splitSections();
@@ -1230,6 +1239,7 @@ struct Partition {
   std::unique_ptr gnuHashTab;
   std::unique_ptr hashTab;
   std::unique_ptr memtagAndroidNote;
+  std::unique_ptr packageMetadataNote;
   std::unique_ptr relaDyn;
   std::unique_ptr relrDyn;
   std::unique_ptr verDef;

diff  --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index c9345d812270..ad80d4344e36 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -425,6 +425,11 @@ template  void elf::createSyntheticSections() {
   part.armExidx = std::make_unique();
   add(*part.armExidx);
 }
+
+if (!config->packageMetadata.empty()) {
+  part.packageMetadataNote = std::make_unique();
+  add(*part.packageMetadataNote);
+}
   }
 
   if (partitions.size() != 1) {

diff  --git a/lld/docs/ReleaseNotes.rst b/lld/docs/ReleaseNotes.rst
inde

[llvm-branch-commits] [clang] 13e4d9e - [SPIR-V] Disable opaque pointers in relese 15

2022-08-10 Thread Tobias Hieta via llvm-branch-commits

Author: Tom Stellard
Date: 2022-08-10T10:58:31+02:00
New Revision: 13e4d9eab61ee985bf25cdf53b29bc7db55333a2

URL: 
https://github.com/llvm/llvm-project/commit/13e4d9eab61ee985bf25cdf53b29bc7db55333a2
DIFF: 
https://github.com/llvm/llvm-project/commit/13e4d9eab61ee985bf25cdf53b29bc7db55333a2.diff

LOG: [SPIR-V] Disable opaque pointers in relese 15

As discussed on RFC mapping into SPIR-V requires pointer being preserved in 
some cases: 
https://discourse.llvm.org/t/rfc-better-support-for-typed-pointers-in-an-opaque-pointer-world/63339/23?u=anastasiastulova

As the work is still unfinished the best approach is to continue using pointer 
types.

Note that this change is only planned to be committed in release 15 branch.

This fixing PR56660.

Reviewed By: jcranmer-intel

Differential Revision: https://reviews.llvm.org/D130766

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/spirv-toolchain.cl

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3587326e0e58..3704ed858668 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4622,8 +4622,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
   TC.addClangWarningOptions(CmdArgs);
 
   // FIXME: Subclass ToolChain for SPIR and move this to 
addClangWarningOptions.
-  if (Triple.isSPIR() || Triple.isSPIRV())
+  if (Triple.isSPIR() || Triple.isSPIRV()) {
 CmdArgs.push_back("-Wspir-compat");
+// SPIR-V support still needs pointer types in some cases as recovering
+// type from pointer uses is not always possible e.g. for extern functions
+// (see PR56660).
+CmdArgs.push_back("-no-opaque-pointers");
+  }
 
   // Select the appropriate action.
   RewriteKind rewriteKind = RK_None;

diff  --git a/clang/test/Driver/spirv-toolchain.cl 
b/clang/test/Driver/spirv-toolchain.cl
index db3ee4d3fe02..8bec46b44044 100644
--- a/clang/test/Driver/spirv-toolchain.cl
+++ b/clang/test/Driver/spirv-toolchain.cl
@@ -6,6 +6,7 @@
 // RUN: %clang -### --target=spirv64 -x c -c %s 2>&1 | FileCheck 
--check-prefix=SPV64 %s
 
 // SPV64: "-cc1" "-triple" "spirv64"
+// SPV64-SAME: "-no-opaque-pointers"
 // SPV64-SAME: "-o" [[BC:".*bc"]]
 // SPV64: {{llvm-spirv.*"}} [[BC]] "-o" {{".*o"}}
 
@@ -16,6 +17,7 @@
 // RUN: %clang -### --target=spirv32 -x c -c %s 2>&1 | FileCheck 
--check-prefix=SPV32 %s
 
 // SPV32: "-cc1" "-triple" "spirv32"
+// SPV32-SAME: "-no-opaque-pointers"
 // SPV32-SAME: "-o" [[BC:".*bc"]]
 // SPV32: {{llvm-spirv.*"}} [[BC]] "-o" {{".*o"}}
 



___
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] [compiler-rt] 40c0ae9 - [scudo] Try to fix standalone build on armv7

2022-08-10 Thread Tobias Hieta via llvm-branch-commits

Author: Diana Picus
Date: 2022-08-10T10:58:42+02:00
New Revision: 40c0ae95cb571c6e07e9d16fe96002ca622d4c2a

URL: 
https://github.com/llvm/llvm-project/commit/40c0ae95cb571c6e07e9d16fe96002ca622d4c2a
DIFF: 
https://github.com/llvm/llvm-project/commit/40c0ae95cb571c6e07e9d16fe96002ca622d4c2a.diff

LOG: [scudo] Try to fix standalone build on armv7

When linking scudo standalone on armv7, it can't find symbols related to
unwinding (e.g. __aeabi_unwind_cpp_pr0). This is because it is passing
--unwindlib=none. This patch hacks around the issue by adding
COMPILER_RT_UNWINDER_LINK_LIBS to the link line.

I don't know anything about scudo, so I'm not sure what the original
intention was.

See also https://github.com/llvm/llvm-project/issues/56900

Differential Revision: https://reviews.llvm.org/D131250

(cherry picked from commit 8342ea6eac85bd20c56be0ab71b4ebbccd134c67)

Added: 


Modified: 
compiler-rt/lib/scudo/standalone/CMakeLists.txt

Removed: 




diff  --git a/compiler-rt/lib/scudo/standalone/CMakeLists.txt 
b/compiler-rt/lib/scudo/standalone/CMakeLists.txt
index f439f6f9d2d6..4b586bc662b4 100644
--- a/compiler-rt/lib/scudo/standalone/CMakeLists.txt
+++ b/compiler-rt/lib/scudo/standalone/CMakeLists.txt
@@ -135,7 +135,7 @@ if (COMPILER_RT_HAS_GWP_ASAN)
 
 endif()
 
-set(SCUDO_LINK_LIBS)
+set(SCUDO_LINK_LIBS ${COMPILER_RT_UNWINDER_LINK_LIBS})
 
 append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread SCUDO_LINK_FLAGS)
 



___
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] [llvm] b914b21 - [ARM] Regenerate vector_store.ll tests. NFC

2022-08-10 Thread Tobias Hieta via llvm-branch-commits

Author: David Green
Date: 2022-08-10T10:58:53+02:00
New Revision: b914b21ad19180da3c34ab39918fffcb51590cb7

URL: 
https://github.com/llvm/llvm-project/commit/b914b21ad19180da3c34ab39918fffcb51590cb7
DIFF: 
https://github.com/llvm/llvm-project/commit/b914b21ad19180da3c34ab39918fffcb51590cb7.diff

LOG: [ARM] Regenerate vector_store.ll tests. NFC

(cherry picked from commit f8d976171f2a1b7bf9268929f77904973edb0378)

Added: 


Modified: 
llvm/test/CodeGen/ARM/vector-store.ll

Removed: 




diff  --git a/llvm/test/CodeGen/ARM/vector-store.ll 
b/llvm/test/CodeGen/ARM/vector-store.ll
index e8c1a78a9113..30e2dddac06b 100644
--- a/llvm/test/CodeGen/ARM/vector-store.ll
+++ b/llvm/test/CodeGen/ARM/vector-store.ll
@@ -1,19 +1,29 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s | FileCheck %s
 
 target datalayout = 
"e-m:o-p:32:32-i1:8:32-i8:8:32-i16:16:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
-target triple = "thumbv7s-apple-ios8.0.0"
+target triple = "thumbv7-none-eabi"
 
 define void @store_v8i8(<8 x i8>** %ptr, <8 x i8> %val) {
-;CHECK-LABEL: store_v8i8:
-;CHECK: str r1, [r0]
+; CHECK-LABEL: store_v8i8:
+; CHECK:   @ %bb.0:
+; CHECK-NEXT:ldr r0, [r0]
+; CHECK-NEXT:str r3, [r0, #4]
+; CHECK-NEXT:str r2, [r0]
+; CHECK-NEXT:bx lr
%A = load <8 x i8>*, <8 x i8>** %ptr
store  <8 x i8> %val, <8 x i8>* %A, align 1
ret void
 }
 
 define void @store_v8i8_update(<8 x i8>** %ptr, <8 x i8> %val) {
-;CHECK-LABEL: store_v8i8_update:
-;CHECK: vst1.8 {{{d[0-9]+}}}, [{{r[0-9]+}}]!
+; CHECK-LABEL: store_v8i8_update:
+; CHECK:   @ %bb.0:
+; CHECK-NEXT:ldr r1, [r0]
+; CHECK-NEXT:vmov d16, r2, r3
+; CHECK-NEXT:vst1.8 {d16}, [r1]!
+; CHECK-NEXT:str r1, [r0]
+; CHECK-NEXT:bx lr
%A = load <8 x i8>*, <8 x i8>** %ptr
store  <8 x i8> %val, <8 x i8>* %A, align 1
%inc = getelementptr <8 x i8>, <8 x i8>* %A, i38 1
@@ -22,16 +32,25 @@ define void @store_v8i8_update(<8 x i8>** %ptr, <8 x i8> 
%val) {
 }
 
 define void @store_v4i16(<4 x i16>** %ptr, <4 x i16> %val) {
-;CHECK-LABEL: store_v4i16:
-;CHECK: str r1, [r0]
+; CHECK-LABEL: store_v4i16:
+; CHECK:   @ %bb.0:
+; CHECK-NEXT:ldr r0, [r0]
+; CHECK-NEXT:str r3, [r0, #4]
+; CHECK-NEXT:str r2, [r0]
+; CHECK-NEXT:bx lr
%A = load <4 x i16>*, <4 x i16>** %ptr
store  <4 x i16> %val, <4 x i16>* %A, align 1
ret void
 }
 
 define void @store_v4i16_update(<4 x i16>** %ptr, <4 x i16> %val) {
-;CHECK-LABEL: store_v4i16_update:
-;CHECK: vst1.8 {{{d[0-9]+}}}, [{{r[0-9]+}}]!
+; CHECK-LABEL: store_v4i16_update:
+; CHECK:   @ %bb.0:
+; CHECK-NEXT:ldr r1, [r0]
+; CHECK-NEXT:vmov d16, r2, r3
+; CHECK-NEXT:vst1.8 {d16}, [r1]!
+; CHECK-NEXT:str r1, [r0]
+; CHECK-NEXT:bx lr
%A = load <4 x i16>*, <4 x i16>** %ptr
store  <4 x i16> %val, <4 x i16>* %A, align 1
%inc = getelementptr <4 x i16>, <4 x i16>* %A, i34 1
@@ -40,16 +59,25 @@ define void @store_v4i16_update(<4 x i16>** %ptr, <4 x i16> 
%val) {
 }
 
 define void @store_v2i32(<2 x i32>** %ptr, <2 x i32> %val) {
-;CHECK-LABEL: store_v2i32:
-;CHECK: str r1, [r0]
+; CHECK-LABEL: store_v2i32:
+; CHECK:   @ %bb.0:
+; CHECK-NEXT:ldr r0, [r0]
+; CHECK-NEXT:str r3, [r0, #4]
+; CHECK-NEXT:str r2, [r0]
+; CHECK-NEXT:bx lr
%A = load <2 x i32>*, <2 x i32>** %ptr
store  <2 x i32> %val, <2 x i32>* %A, align 1
ret void
 }
 
 define void @store_v2i32_update(<2 x i32>** %ptr, <2 x i32> %val) {
-;CHECK-LABEL: store_v2i32_update:
-;CHECK: vst1.8 {{{d[0-9]+}}}, [{{r[0-9]+}}]!
+; CHECK-LABEL: store_v2i32_update:
+; CHECK:   @ %bb.0:
+; CHECK-NEXT:ldr r1, [r0]
+; CHECK-NEXT:vmov d16, r2, r3
+; CHECK-NEXT:vst1.8 {d16}, [r1]!
+; CHECK-NEXT:str r1, [r0]
+; CHECK-NEXT:bx lr
%A = load <2 x i32>*, <2 x i32>** %ptr
store  <2 x i32> %val, <2 x i32>* %A, align 1
%inc = getelementptr <2 x i32>, <2 x i32>* %A, i32 1
@@ -58,16 +86,25 @@ define void @store_v2i32_update(<2 x i32>** %ptr, <2 x i32> 
%val) {
 }
 
 define void @store_v2f32(<2 x float>** %ptr, <2 x float> %val) {
-;CHECK-LABEL: store_v2f32:
-;CHECK: str r1, [r0]
+; CHECK-LABEL: store_v2f32:
+; CHECK:   @ %bb.0:
+; CHECK-NEXT:ldr r0, [r0]
+; CHECK-NEXT:str r3, [r0, #4]
+; CHECK-NEXT:str r2, [r0]
+; CHECK-NEXT:bx lr
%A = load <2 x float>*, <2 x float>** %ptr
store  <2 x float> %val, <2 x float>* %A, align 1
ret void
 }
 
 define void @store_v2f32_update(<2 x float>** %ptr, <2 x float> %val) {
-;CHECK-LABEL: store_v2f32_update:
-;CHECK: vst1.8 {{{d[0-9]+}}}, [{{r[0-9]+}}]!
+; CHECK-LABEL: store_v2f32_update:
+; CHECK:   @ %bb.0:
+; CHECK-NEXT:ldr r1, [r0]
+; CHECK-NEXT:vmov d16, r2, r3
+; CHECK-NEXT:vst1.8 {d16}, [r1]!
+; CHECK-NEXT:str r1, [r0]
+; CHECK-NEXT

[llvm-branch-commits] [llvm] bcd9043 - [DAG] Ensure Legal BUILD_VECTOR elements types in shuffle->And combine

2022-08-10 Thread Tobias Hieta via llvm-branch-commits

Author: David Green
Date: 2022-08-10T10:58:53+02:00
New Revision: bcd9043ccc96512ff97bb140a1ddc5b8e82902c3

URL: 
https://github.com/llvm/llvm-project/commit/bcd9043ccc96512ff97bb140a1ddc5b8e82902c3
DIFF: 
https://github.com/llvm/llvm-project/commit/bcd9043ccc96512ff97bb140a1ddc5b8e82902c3.diff

LOG: [DAG] Ensure Legal BUILD_VECTOR elements types in shuffle->And combine

D129150 added a combine from shuffles to And that creates a BUILD_VECTOR
of constant elements. We need to ensure that the elements are of a legal
type, to prevent asserts during lowering.

Fixes #56970.

Differential Revision: https://reviews.llvm.org/D131350

(cherry picked from commit 061e0189a3dab6b1831a80d489ff1b15ad93aafb)

Added: 


Modified: 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/ARM/vector-store.ll

Removed: 




diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 154a3ef63613..8d465b9520de 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -22729,6 +22729,7 @@ SDValue DAGCombiner::visitVECTOR_SHUFFLE(SDNode *N) {
   SDLoc DL(N);
   EVT IntVT = VT.changeVectorElementTypeToInteger();
   EVT IntSVT = VT.getVectorElementType().changeTypeToInteger();
+  IntSVT = TLI.getTypeToTransformTo(*DAG.getContext(), IntSVT);
   SDValue ZeroElt = DAG.getConstant(0, DL, IntSVT);
   SDValue AllOnesElt = DAG.getAllOnesConstant(DL, IntSVT);
   SmallVector AndMask(NumElts, DAG.getUNDEF(IntSVT));

diff  --git a/llvm/test/CodeGen/ARM/vector-store.ll 
b/llvm/test/CodeGen/ARM/vector-store.ll
index 30e2dddac06b..d099a9878405 100644
--- a/llvm/test/CodeGen/ARM/vector-store.ll
+++ b/llvm/test/CodeGen/ARM/vector-store.ll
@@ -397,3 +397,25 @@ define <4 x i32>* @test_vst1_1reg(<4 x i32>* %ptr.in, <4 x 
i32>* %ptr.out) {
   %next = getelementptr <4 x i32>, <4 x i32>* %ptr.out, i32 2
   ret <4 x i32>* %next
 }
+
+; PR56970
+define void @v3i8store(<3 x i8> *%p) {
+; CHECK-LABEL: v3i8store:
+; CHECK:   @ %bb.0:
+; CHECK-NEXT:sub sp, #4
+; CHECK-NEXT:vmov.i32 d16, #0xff
+; CHECK-NEXT:mov r1, sp
+; CHECK-NEXT:vmov.i32 d17, #0x0
+; CHECK-NEXT:movs r2, #0
+; CHECK-NEXT:vand d16, d17, d16
+; CHECK-NEXT:vst1.32 {d16[0]}, [r1:32]
+; CHECK-NEXT:vld1.32 {d16[0]}, [r1:32]
+; CHECK-NEXT:vmovl.u16 q8, d16
+; CHECK-NEXT:strb r2, [r0, #2]
+; CHECK-NEXT:vmov.32 r1, d16[0]
+; CHECK-NEXT:strh r1, [r0]
+; CHECK-NEXT:add sp, #4
+; CHECK-NEXT:bx lr
+  store <3 x i8> zeroinitializer, <3 x i8> *%p, align 4
+  ret void
+}



___
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-tools-extra] 10df85d - [clangd] Add release notes

2022-08-10 Thread Kadir Cetinkaya via llvm-branch-commits

Author: Kadir Cetinkaya
Date: 2022-08-10T13:11:46+02:00
New Revision: 10df85da672f698ad573af5e344e27d4effd6c20

URL: 
https://github.com/llvm/llvm-project/commit/10df85da672f698ad573af5e344e27d4effd6c20
DIFF: 
https://github.com/llvm/llvm-project/commit/10df85da672f698ad573af5e344e27d4effd6c20.diff

LOG: [clangd] Add release notes

Added: 


Modified: 
clang-tools-extra/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index 08eacd321d5ea..26a67da974302 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -51,34 +51,67 @@ Improvements to clangd
 Inlay hints
 ^^^
 
+- Provide hints for:
+- Lambda return types.
+- Forwarding functions using the underlying function call.
+- Support for standard LSP 3.17 inlay hints protocol.
+- Designator inlay hints are enabled by default.
+
 Diagnostics
 ^^^
+
 - Improved Fix-its of some clang-tidy checks when applied with clangd.
+- Clangd now produces diagnostics for forwarding functions like make_unique.
+- Include cleaner analysis can be disabled with the 
``Diagnostics.Includes.IgnoreHeader`` config option.
+- Include cleaner doesn’t diagnose exporting headers.
+- clang-tidy and include cleaner diagnostics have links to their documentation.
 
 Semantic Highlighting
 ^
 
-Compile flags
-^
+- Semantic highlighting works for tokens that span multiple lines.
+- Mutable reference parameters in function calls receive 
``usedAsMutableReference`` modifier.
 
 Hover
 ^
 
+- Hover displays desugared types by default now.
+
 Code completion
 ^^^
 
+- Improved ranking/filtering for ObjC method selectors.
+- Support for C++20 concepts and requires expressions.
+
 Signature help
 ^^
 
+- Signature help for function pointers.
+- Provides hints using underlying functions in forwarded calls.
+
 Cross-references
 
 
-Objective-C
-^^^
+Code Actions
+
+
+- New code action to generate ObjC initializers.
+- New code action to generate move/copy constructors/assignments.
+- Extract to function works for methods in addition to free functions.
+- Related diagnostics are attached to code actions response, if any.
+- Extract variable works in C and ObjC files.
+- Fix to define outline when the parameter has a braced initializer.
 
 Miscellaneous
 ^
 
+- Include fixer supports symbols inside macro arguments.
+- Dependent autos are now deduced when there’s a single instantiation.
+- Support for symbols exported with using declarations in all features.
+- Fixed background-indexing priority for M1 chips.
+- Indexing for standard library symbols.
+- ObjC framework includes are spelled properly during include insertion 
operations.
+
 Improvements to clang-doc
 -
 



___
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] [flang] 4b27d95 - [flang][test] Don't require .exe suffix.

2022-08-10 Thread Tobias Hieta via llvm-branch-commits

Author: Michael Kruse
Date: 2022-08-10T17:43:37+02:00
New Revision: 4b27d95d1c7ea83e63668e8e841c5f77c8a2bb03

URL: 
https://github.com/llvm/llvm-project/commit/4b27d95d1c7ea83e63668e8e841c5f77c8a2bb03
DIFF: 
https://github.com/llvm/llvm-project/commit/4b27d95d1c7ea83e63668e8e841c5f77c8a2bb03.diff

LOG: [flang][test] Don't require .exe suffix.

The suffix is only added then the path the (lld-)link.exe is fully
resolved. Otherwise it may stay "link" or "lld-link".

On non-Windows platforms, lld-link also exists as a symbolic link to
lld, such that the full the path to lld-link might also be resolved
without .exe suffix in this case.

Note that CLANG_DEFAULT_LINKER could be set to other linkers such as
mold, in which case the test may still fail. This also applies to the
non-Windows tests that require "ld" in the linker name.

Fixes issue #56955

(cherry picked from commit 8c0979c8f7723306862b33583c6bdb1f4566a969)

Added: 


Modified: 
flang/test/Driver/linker-flags.f90

Removed: 




diff  --git a/flang/test/Driver/linker-flags.f90 
b/flang/test/Driver/linker-flags.f90
index ae0f5b3c8f825..90c4a940c6d5f 100644
--- a/flang/test/Driver/linker-flags.f90
+++ b/flang/test/Driver/linker-flags.f90
@@ -36,8 +36,11 @@
 ! MINGW-SAME: -lFortranRuntime
 ! MINGW-SAME: -lFortranDecimal
 
-! NOTE: This check should also match if the default linker is lld-link.exe
-! MSVC-LABEL: link.exe
+! NOTE: This also matches lld-link (when CLANG_DEFAULT_LINKER=lld) and
+!   any .exe suffix that is added when resolving to the full path of
+!   (lld-)link.exe on Windows platforms. The suffix may not be added
+!   when the executable is not found or on non-Windows platforms.
+! MSVC-LABEL: link
 ! MSVC-SAME: Fortran_main.lib
 ! MSVC-SAME: FortranRuntime.lib
 ! MSVC-SAME: FortranDecimal.lib



___
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] 844e372 - [clang][deps] Always generate module paths

2022-08-10 Thread Jan Svoboda via llvm-branch-commits

Author: Jan Svoboda
Date: 2022-08-10T11:55:17-07:00
New Revision: 844e3728fff59f00f9b4d6552acbcc0de41b6dd0

URL: 
https://github.com/llvm/llvm-project/commit/844e3728fff59f00f9b4d6552acbcc0de41b6dd0
DIFF: 
https://github.com/llvm/llvm-project/commit/844e3728fff59f00f9b4d6552acbcc0de41b6dd0.diff

LOG: [clang][deps] Always generate module paths

Since D129389 (and downstream PR 
https://github.com/apple/llvm-project/pull/4965), the dependency scanner is 
responsible for generating full command-lines, including the modules paths. 
This patch removes the flag that was making this an opt-in behavior in 
clang-scan-deps.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D131420

Added: 


Modified: 
clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
clang/test/ClangScanDeps/diagnostics.c
clang/test/ClangScanDeps/generate-modules-path-args.c
clang/test/ClangScanDeps/modulemap-via-vfs.m
clang/test/ClangScanDeps/modules-context-hash-module-map-path.c
clang/test/ClangScanDeps/modules-context-hash-outputs.c
clang/test/ClangScanDeps/modules-context-hash.c
clang/test/ClangScanDeps/modules-disable-free.c
clang/test/ClangScanDeps/modules-file-path-isolation.c
clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m
clang/test/ClangScanDeps/modules-full.cpp
clang/test/ClangScanDeps/modules-inferred-explicit-build.m
clang/test/ClangScanDeps/modules-inferred.m
clang/test/ClangScanDeps/modules-no-undeclared-includes.c
clang/test/ClangScanDeps/modules-pch-common-submodule.c
clang/test/ClangScanDeps/modules-pch-common-via-submodule.c
clang/test/ClangScanDeps/modules-pch-dangling.c
clang/test/ClangScanDeps/modules-pch.c
clang/test/ClangScanDeps/modules-symlink.c
clang/test/ClangScanDeps/removed-args.c
clang/test/ClangScanDeps/submodule-order.c
clang/tools/clang-scan-deps/ClangScanDeps.cpp

Removed: 




diff  --git 
a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h 
b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
index 0a092a433a22c..77263cd6233b8 100644
--- a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
+++ b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
@@ -53,9 +53,6 @@ struct FullDependencies {
   std::vector getCommandLine(
   llvm::function_ref
   LookupModuleOutput) const;
-
-  /// Get the full command line, excluding -fmodule-file=" arguments.
-  std::vector getCommandLineWithoutModulePaths() const;
 };
 
 struct FullDependenciesResult {

diff  --git 
a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h 
b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
index f4f13a34b1746..18c342ee85c11 100644
--- a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
+++ b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
@@ -138,10 +138,6 @@ struct ModuleDeps {
   std::vector getCanonicalCommandLine(
   llvm::function_ref
   LookupModuleOutput) const;
-
-  /// Gets the canonical command line suitable for passing to clang, excluding
-  /// "-fmodule-file=" and "-o" arguments.
-  std::vector getCanonicalCommandLineWithoutModulePaths() const;
 };
 
 class ModuleDepCollector;

diff  --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp 
b/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
index 411fd9676ffdb..03ad6dcc51b30 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
@@ -16,24 +16,15 @@ using namespace dependencies;
 std::vector FullDependencies::getCommandLine(
 llvm::function_ref
 LookupModuleOutput) const {
-  std::vector Ret = getCommandLineWithoutModulePaths();
-
-  for (ModuleID MID : ClangModuleDeps) {
-auto PCM = LookupModuleOutput(MID, ModuleOutputKind::ModuleFile);
-Ret.push_back("-fmodule-file=" + PCM);
-  }
-
-  return Ret;
-}
-
-std::vector
-FullDependencies::getCommandLineWithoutModulePaths() const {
   std::vector Args = OriginalCommandLine;
 
   Args.push_back("-fno-implicit-modules");
   Args.push_back("-fno-implicit-module-maps");
   for (const PrebuiltModuleDep &PMD : PrebuiltModuleDeps)
 Args.push_back("-fmodule-file=" + PMD.PCMFile);
+  for (ModuleID MID : ClangModuleDeps)
+Args.push_back("-fmodule-file=" +
+   LookupModuleOutput(MID, ModuleOutputKind::ModuleFile));
 
   // These arguments are unused in explicit compiles.
   llvm::erase_if(Args, [](StringRef Arg) {

diff  --git a/clang/lib/Tooling/DependencyScanning/ModuleDe

[llvm-branch-commits] [libcxx] 1324903 - [libc++][format] Exposes basic-format-string

2022-08-10 Thread Tom Stellard via llvm-branch-commits

Author: Mark de Wever
Date: 2022-08-10T17:52:20-07:00
New Revision: 13249036b774e4e5dc346d1f1a348f4ba201537a

URL: 
https://github.com/llvm/llvm-project/commit/13249036b774e4e5dc346d1f1a348f4ba201537a
DIFF: 
https://github.com/llvm/llvm-project/commit/13249036b774e4e5dc346d1f1a348f4ba201537a.diff

LOG: [libc++][format] Exposes basic-format-string

This paper was accepted during the last plenary and is intended to be
backported to LLVM 15. When backporting the release notes in the branch
should be updated too.

Note the feature-test macro isn't updated since this will change; three
papers have updated the same macro in the same plenary.

Implements:
- P2508R1 Exposing std::basic-format-string

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D130643

(cherry picked from commit f712775dafdb221fdf73f38819fa9e618aec6b67)

Added: 
libcxx/test/std/utilities/format/format.fmt.string/ctor.verify.cpp
libcxx/test/std/utilities/format/format.fmt.string/get.pass.cpp
libcxx/test/std/utilities/format/format.fmt.string/types.compile.pass.cpp

Modified: 
libcxx/docs/ReleaseNotes.rst
libcxx/docs/Status/Cxx2bPapers.csv
libcxx/docs/Status/FormatIssues.csv
libcxx/include/format
libcxx/utils/generate_feature_test_macro_components.py

Removed: 




diff  --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst
index c717ea2682b54..6acde0db864bf 100644
--- a/libcxx/docs/ReleaseNotes.rst
+++ b/libcxx/docs/ReleaseNotes.rst
@@ -63,6 +63,7 @@ Implemented Papers
 - P2418R2 - Add support for ``std::generator``-like types to ``std::format``
 - LWG3659 - Consider ``ATOMIC_FLAG_INIT`` undeprecation
 - P1423R3 - ``char8_t`` backward compatibility remediation
+- P2508R1 - Exposing ``std::basic-format-string``
 
 - Marked the following papers as "Complete" (note that some of those might have
   been implemented in a previous release but not marked as such):

diff  --git a/libcxx/docs/Status/Cxx2bPapers.csv 
b/libcxx/docs/Status/Cxx2bPapers.csv
index 4c5dd10db0684..27ff57c92150f 100644
--- a/libcxx/docs/Status/Cxx2bPapers.csv
+++ b/libcxx/docs/Status/Cxx2bPapers.csv
@@ -81,7 +81,7 @@
 "`P2494R2 `__","LWG","Relaxing range adaptors to 
allow for move only types","July 2022","",""
 "`P2499R0 `__","LWG","``string_view`` range 
constructor should be ``explicit``","July 2022","",""
 "`P2502R2 `__","LWG","``std::generator``: 
Synchronous Coroutine Generator for Ranges","July 2022","",""
-"`P2508R1 `__","LWG","Exposing 
``std::basic-format-string``","July 2022","",""
+"`P2508R1 `__","LWG","Exposing 
``std::basic-format-string``","July 2022","|Complete|","15.0"
 "`P2513R4 `__","LWG","``char8_t`` Compatibility and 
Portability Fixes","July 2022","",""
 "`P2517R1 `__","LWG","Add a conditional 
``noexcept`` specification to ``std::apply``","July 2022","",""
 "`P2520R0 `__","LWG","``move_iterator`` should be a 
random access iterator","July 2022","",""

diff  --git a/libcxx/docs/Status/FormatIssues.csv 
b/libcxx/docs/Status/FormatIssues.csv
index 3f7304520c9e9..c3bdf169e82b1 100644
--- a/libcxx/docs/Status/FormatIssues.csv
+++ b/libcxx/docs/Status/FormatIssues.csv
@@ -5,6 +5,7 @@ Number,Name,Assignee,Patch,Status,First released version
 `P1868 `_,"width: clarifying units of width and 
precision in std::format (Implements the unicode support.)",Mark de 
Wever,"`D103413 `__ `D103425 
`__ `D103670 
`__",|Complete|,Clang 14
 `P2216 `_,"std::format improvements",Mark de 
Wever,,|Complete|,Clang 15
 `P2418 `__,"Add support for ``std::generator``-like 
types to ``std::format``",Mark de Wever,`D127570 
`__,|Complete|, Clang 15
+`P2508R1 `__,"Exposing 
``std::basic-format-string``","C++23","Mark de Wever","|Complete|",Clang 15
 
 `P1361 `_,"Integration of chrono with text 
formatting",Mark de Wever,,|In Progress|,
 `P2372 `__,"Fixing locale handling in chrono 
formatters",Mark de Wever,,|In Progress|,

diff  --git a/libcxx/include/format b/libcxx/include/format
index d2ec8fc233634..6b14570bc6272 100644
--- a/libcxx/include/format
+++ b/libcxx/include/format
@@ -23,16 +23,23 @@ namespace std {
   using format_args = basic_format_args;
   using wformat_args = basic_format_args;
 
-  // [format.fmt.string], class template basic-format-string
+  // [format.fmt.string], class template basic_format_string
   template
-struct basic-format-string;   // exposition only
+struct basic_format_string 

[llvm-branch-commits] [llvm] 7b61485 - [llvm-ar] Remove unused parameter. NFC

2022-08-10 Thread Tom Stellard via llvm-branch-commits

Author: Fangrui Song
Date: 2022-08-10T18:03:47-07:00
New Revision: 7b61485d62294272f6432dbc63aa5cd99fe36c83

URL: 
https://github.com/llvm/llvm-project/commit/7b61485d62294272f6432dbc63aa5cd99fe36c83
DIFF: 
https://github.com/llvm/llvm-project/commit/7b61485d62294272f6432dbc63aa5cd99fe36c83.diff

LOG: [llvm-ar] Remove unused parameter. NFC

(cherry picked from commit 350f17ab52ec9df60095f7b7bccd49c429885ef7)

Added: 


Modified: 
llvm/tools/llvm-ar/llvm-ar.cpp

Removed: 




diff  --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp
index 1d4a8e9cd398b..960c7a3d8713e 100644
--- a/llvm/tools/llvm-ar/llvm-ar.cpp
+++ b/llvm/tools/llvm-ar/llvm-ar.cpp
@@ -1125,8 +1125,7 @@ static void performOperation(ArchiveOperation Operation,
   llvm_unreachable("Unknown operation.");
 }
 
-static int performOperation(ArchiveOperation Operation,
-std::vector *NewMembers) {
+static int performOperation(ArchiveOperation Operation) {
   // Create or open the archive object.
   ErrorOr> Buf = MemoryBuffer::getFile(
   ArchiveName, /*IsText=*/false, /*RequiresNullTerminator=*/false);
@@ -1145,7 +1144,7 @@ static int performOperation(ArchiveOperation Operation,
 if (Archive->isThin())
   CompareFullPath = true;
 performOperation(Operation, Archive.get(), std::move(Buf.get()),
- NewMembers);
+ /*NewMembers=*/nullptr);
 return 0;
   }
 
@@ -1160,7 +1159,7 @@ static int performOperation(ArchiveOperation Operation,
 }
   }
 
-  performOperation(Operation, nullptr, nullptr, NewMembers);
+  performOperation(Operation, nullptr, nullptr, /*NewMembers=*/nullptr);
   return 0;
 }
 
@@ -1403,8 +1402,7 @@ static int ar_main(int argc, char **argv) {
 Options += *ArgIt + 1;
   }
 
-  ArchiveOperation Operation = parseCommandLine();
-  return performOperation(Operation, nullptr);
+  return performOperation(parseCommandLine());
 }
 
 static int ranlib_main(int argc, char **argv) {
@@ -1442,7 +1440,7 @@ static int ranlib_main(int argc, char **argv) {
   if (!ArchiveSpecified) {
 badUsage("an archive name must be specified");
   }
-  return performOperation(CreateSymTab, nullptr);
+  return performOperation(CreateSymTab);
 }
 
 int llvm_ar_main(int argc, char **argv) {



___
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] [llvm] 81e46ae - [llvm-ranlib] Support more than one input file

2022-08-10 Thread Tom Stellard via llvm-branch-commits

Author: Fangrui Song
Date: 2022-08-10T18:03:47-07:00
New Revision: 81e46ae2215f371b95289ae30ec7d2502a333cc7

URL: 
https://github.com/llvm/llvm-project/commit/81e46ae2215f371b95289ae30ec7d2502a333cc7
DIFF: 
https://github.com/llvm/llvm-project/commit/81e46ae2215f371b95289ae30ec7d2502a333cc7.diff

LOG: [llvm-ranlib] Support more than one input file

BSD and GNU ranlib support more than one input file. Implement this.

While here, update OVERVIEW (Ranlib => ranlib) since "ranlib" is more common.
Remove "speed access" since the index has nothing to do with performance: it is
mandatory for GNU ld and gold but ignored for ld.lld (D119074).

Close https://github.com/llvm/llvm-project/issues/54565

Differential Revision: https://reviews.llvm.org/D131375

(cherry picked from commit aa173573198e024b065c5f6523ce26bb865781b7)

Added: 
llvm/test/tools/llvm-ranlib/error-opening-permission.test

Modified: 
llvm/docs/CommandGuide/llvm-ranlib.rst
llvm/test/tools/llvm-ranlib/D-flag.test
llvm/tools/llvm-ar/llvm-ar.cpp

Removed: 




diff  --git a/llvm/docs/CommandGuide/llvm-ranlib.rst 
b/llvm/docs/CommandGuide/llvm-ranlib.rst
index ec4a1335c19cf..5cc5a6a839d1c 100644
--- a/llvm/docs/CommandGuide/llvm-ranlib.rst
+++ b/llvm/docs/CommandGuide/llvm-ranlib.rst
@@ -6,13 +6,13 @@ llvm-ranlib - generates an archive index
 SYNOPSIS
 
 
-:program:`llvm-ranlib` [*options*]
+:program:`llvm-ranlib` [*options*] *archive...*
 
 DESCRIPTION
 ---
 
 :program:`llvm-ranlib` is an alias for the :doc:`llvm-ar ` tool that
-generates an index for an archive. It can be used as a replacement for GNU's
+generates an index for one or more archives. It can be used as a replacement 
for GNU's
 :program:`ranlib` tool.
 
 Running :program:`llvm-ranlib` is equivalent to running ``llvm-ar s``.

diff  --git a/llvm/test/tools/llvm-ranlib/D-flag.test 
b/llvm/test/tools/llvm-ranlib/D-flag.test
index f6a3ec9cc272f..49d0bd6ae8110 100644
--- a/llvm/test/tools/llvm-ranlib/D-flag.test
+++ b/llvm/test/tools/llvm-ranlib/D-flag.test
@@ -22,9 +22,11 @@
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -UUD %t.a
 # RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s 
--check-prefix=DETERMINISTIC-VALUES
 
-## Check arguments can be passed before and after the file name
-# RUN: cp %t-no-index.a %t.a && llvm-ranlib -U %t.a -D -U
+## Check multiple archives can be specified and arguments can be specified 
anywhere.
+# RUN: cp %t-no-index.a %t.a && cp %t-no-index.a %t2.a
+# RUN: llvm-ranlib -U %t.a -D %t2.a -U
 # RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s --check-prefix=REAL-VALUES
+# RUN: env TZ=UTC llvm-ar tv %t2.a | FileCheck %s --check-prefix=REAL-VALUES
 
 ## Check that the -D/-U option is only accepted with a single dash. This 
matches
 ## the GNU ranlib behaviour.

diff  --git a/llvm/test/tools/llvm-ranlib/error-opening-permission.test 
b/llvm/test/tools/llvm-ranlib/error-opening-permission.test
new file mode 100644
index 0..1b1bb0def78d7
--- /dev/null
+++ b/llvm/test/tools/llvm-ranlib/error-opening-permission.test
@@ -0,0 +1,41 @@
+## Unsupported on windows as marking files "unreadable" is non-trivial on 
windows.
+# UNSUPPORTED: system-windows
+
+# RUN: rm -rf %t && split-file %s %t && cd %t
+# RUN: yaml2obj 1.yaml -o 1.o
+# RUN: llvm-ar rcS a.a 1.o
+# RUN: cp a.a b.a && cp a.a c.a && cp a.a d.a
+# RUN: chmod 100 c.a
+# RUN: not llvm-ranlib a.a b.a c.a d.a 2>&1 | FileCheck %s 
--check-prefix=NO-PERMISSION -DMSG=%errc_EACCES
+
+# NO-PERMISSION: error: unable to open 'c.a': [[MSG]]
+# NO-PERMISSION-NOT: {{.}}
+
+## The archives before c.a (a.a and b.a) have been processed.
+# RUN: llvm-nm --print-armap a.a | FileCheck %s
+# RUN: cmp a.a b.a
+## The others (c.a and d.a) do not have a symbol table.
+# RUN: chmod 700 c.a
+# RUN: llvm-nm --print-armap c.a | FileCheck %s --check-prefix=NOMAP
+# RUN: cmp c.a d.a
+
+# CHECK:  Archive map
+# CHECK-NEXT: foo in 1.o
+# CHECK-EMPTY:
+
+# NOMAP-NOT: Archive map
+
+#--- 1.yaml
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name: .text
+Type: SHT_PROGBITS
+Symbols:
+  - Name:foo
+Binding: STB_GLOBAL
+Section: .text

diff  --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp
index 960c7a3d8713e..4ffc5cf337a24 100644
--- a/llvm/tools/llvm-ar/llvm-ar.cpp
+++ b/llvm/tools/llvm-ar/llvm-ar.cpp
@@ -68,9 +68,9 @@ static StringRef ToolName;
 static StringRef Stem;
 
 static void printRanLibHelp(StringRef ToolName) {
-  outs() << "OVERVIEW: LLVM Ranlib\n\n"
- << "This program generates an index to speed access to archives\n\n"
- << "USAGE: " + ToolName + " \n\n"
+  outs() << "OVERVIEW: LLVM ranlib\n\n"
+ << "Generate an index for archives\n\n"
+ << "USAGE: " + ToolName + " archive...\n\n"
  << "OPTIONS:\n"
  << "  -h --help - Display availab