[clang] 6030a07 - Fix hidden-redecls.m test for some environments

2020-10-16 Thread Konstantin Schwarz via cfe-commits

Author: Konstantin Schwarz
Date: 2020-10-16T09:51:13+02:00
New Revision: 6030a075164c7016b29a67680ed5c9e7c5932109

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

LOG: Fix hidden-redecls.m test for some environments

This test was failing in our CI environment, because Jenkins mounts the 
workspaces into Docker containers using their full path, i.e. 
/home/jenkins/workspaces/llvm-build.
We've seen permission denied errors because /home/jenkins is mounted with root 
permissions and the default cache directory under Linux is $HOME/.cache.

The fix is to explicitly provide the -fmodules-cache-path, which the other 
tests already seem to provide.

Reviewed By: akyrtzi

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

Added: 


Modified: 
clang/test/Index/hidden-redecls.m

Removed: 




diff  --git a/clang/test/Index/hidden-redecls.m 
b/clang/test/Index/hidden-redecls.m
index 1735c0b5e184..ba34e69db85e 100644
--- a/clang/test/Index/hidden-redecls.m
+++ b/clang/test/Index/hidden-redecls.m
@@ -7,6 +7,7 @@ - (void)top_method;
 // p1_method in protocol P1 is hidden since module_redecls.sub hasn't been
 // imported yet. Check it is still indexed.
 
-// RUN: c-index-test -index-file-full %s -isystem %S/Inputs -fmodules -target 
x86_64-apple-macosx10.7 | FileCheck %s
+// RUN: rm -rf %t
+// RUN: c-index-test -index-file-full %s -isystem %S/Inputs -fmodules 
-fmodules-cache-path=%t -target x86_64-apple-macosx10.7 | FileCheck %s
 // CHECK: [indexDeclaration]: kind: objc-instance-method | name: p1_method | 
{{.*}} | loc: {{.*}}hidden-redecls-sub.h:2:9 | {{.*}} | isRedecl: 0
 // CHECK: [indexDeclaration]: kind: objc-instance-method | name: p1_method | 
{{.*}} | loc: {{.*}}hidden-redecls-sub.h:3:9 | {{.*}} | isRedecl: 1



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AArch64][ARM] Treat __bf16 as vendor extension type for C++ name mangling substitution (PR #115956)

2024-11-12 Thread Konstantin Schwarz via cfe-commits

https://github.com/konstantinschwarz created 
https://github.com/llvm/llvm-project/pull/115956

This attempts to fix 
[#115521](https://github.com/llvm/llvm-project/issues/115521).

According to the Itanium C++ mangling rules, vendor extended builtin types are 
considered substitution candidates.
However, enabling this behavior on AArch64 and ARM is an ABI breaking change, 
and I'm not sure how problematic that is.

Note that gcc implements the same wrong behavior https://godbolt.org/z/1h4EcYrET
An alternative could be to detect the "u6__bf16" mangling in the demangler and 
specifically disable the substitution for this type.

>From 40ca031c0fd1b3e9997b2a2e0ed455233f781a9c Mon Sep 17 00:00:00 2001
From: Konstantin Schwarz 
Date: Tue, 12 Nov 2024 21:47:33 +
Subject: [PATCH 1/2] [AArch64][ARM] Pre-commit mangling test for wrong __bf16
 substitution behavior

---
 clang/test/CodeGen/arm-mangle-bf16.cpp | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/clang/test/CodeGen/arm-mangle-bf16.cpp 
b/clang/test/CodeGen/arm-mangle-bf16.cpp
index 1d85c7b2733ac8..267fc5270f9387 100644
--- a/clang/test/CodeGen/arm-mangle-bf16.cpp
+++ b/clang/test/CodeGen/arm-mangle-bf16.cpp
@@ -2,6 +2,18 @@
 // RUN: %clang_cc1 -triple aarch64 -target-feature -bf16 -emit-llvm -o - %s | 
FileCheck %s
 // RUN: %clang_cc1 -triple arm-arm-none-eabi -target-feature +bf16 -mfloat-abi 
hard -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple arm-arm-none-eabi -target-feature +bf16 -mfloat-abi 
softfp -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64 -target-feature +bf16 -emit-llvm -o - %s | 
llvm-cxxfilt -n | FileCheck %s --check-prefix=DEMANGLE
+// RUN: %clang_cc1 -triple aarch64 -target-feature -bf16 -emit-llvm -o - %s | 
llvm-cxxfilt -n | FileCheck %s --check-prefix=DEMANGLE
+// RUN: %clang_cc1 -triple arm-arm-none-eabi -target-feature +bf16 -mfloat-abi 
hard -emit-llvm -o - %s | llvm-cxxfilt -n | FileCheck %s --check-prefix=DEMANGLE
+// RUN: %clang_cc1 -triple arm-arm-none-eabi -target-feature +bf16 -mfloat-abi 
softfp -emit-llvm -o - %s | llvm-cxxfilt -n | FileCheck %s 
--check-prefix=DEMANGLE
 
-// CHECK: define {{.*}}void @_Z3foou6__bf16(bfloat noundef %b)
+// CHECK:define {{.*}}void @_Z3foou6__bf16(bfloat noundef %b)
+// DEMANGLE: define {{.*}}void @foo(__bf16)
 void foo(__bf16 b) {}
+
+struct bar;
+
+// CHECK:define {{.*}}void @_Z10substituteu6__bf16R3barS0_
+// DEMANGLE: define {{.*}}void @substitute(__bf16, bar&, bar)
+void substitute(__bf16 a, bar &b, bar &c) {
+}

>From 68609247bcd3cce8521337ad6a69acc4aa5f1a3b Mon Sep 17 00:00:00 2001
From: Konstantin Schwarz 
Date: Tue, 12 Nov 2024 22:29:49 +
Subject: [PATCH 2/2] [AArch64][ARM] Treat __bf16 as vendor extension type for
 C++ name mangling substitution

On AArch64 and ARM targets, __bf16 is mangled as "u6__bf16", which makes the 
type a vendor extended type.
According to the Itanium C++ mangling rules, such types are considered 
substitution candidates:

>From https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-compression:

"There are two exceptions that appear to be substitution candidates from the 
grammar, but are explicitly excluded:

-  other than vendor extended types
- function and operator names other than extern "C" functions."

This attempts to fix #115521
---
 clang/include/clang/Basic/TargetInfo.h   | 4 
 clang/lib/AST/ItaniumMangle.cpp  | 9 +
 clang/lib/Basic/Targets/AArch64.h| 3 +++
 clang/lib/Basic/Targets/ARM.h| 2 ++
 .../AArch64/sve-intrinsics/acle_sve_dupq-bfloat.c| 2 +-
 .../AArch64/sve2-intrinsics/acle_sve2_whilerw-bfloat.c   | 2 +-
 .../AArch64/sve2-intrinsics/acle_sve2_whilewr-bfloat.c   | 2 +-
 clang/test/CodeGen/arm-mangle-bf16.cpp   | 4 ++--
 8 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index 25eda907d20a7b..d4456c83a0eefa 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -810,6 +810,10 @@ class TargetInfo : public TransferrableTargetInfo,
   /// Return the mangled code of bfloat.
   virtual const char *getBFloat16Mangling() const { return "DF16b"; }
 
+  /// Returns whether to treat bfloat as a vendor extension type for the 
purpose
+  /// of Itanium C++ name mangling compression rules
+  virtual bool treatBFloat16AsVendorType() const { return false; }
+
   /// Return the value for the C99 FLT_EVAL_METHOD macro.
   virtual LangOptions::FPEvalMethodKind getFPEvalMethod() const {
 return LangOptions::FPEvalMethodKind::FEM_Source;
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 14bc260d0245fb..30164ad5ebbd7f 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -2923,6 +2923,15 @@ static bool isTypeSubstitutable(Qualifiers Quals