@@ -3424,6 +3445,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
dwblaikie wrote:
Eh, I'm not too
dwblaikie wrote:
Hmm, do other builtins actually end up as symbol names? I think most of them
lower to an instruction or two - I guess this one doesn't lower to an actual
symbol, only a DWARF symbol - but maybe that's still different enough it should
use an llvm or clang in the name...
@@ -172,6 +172,27 @@ static bool checkArgCount(Sema , CallExpr *Call,
unsigned DesiredArgCount) {
<< /*is non object*/ 0 << Call->getArg(1)->getSourceRange();
}
+static bool checkBuiltinVerboseTrap(CallExpr *Call, Sema ) {
ahatanak wrote:
clang
@@ -172,6 +172,27 @@ static bool checkArgCount(Sema , CallExpr *Call,
unsigned DesiredArgCount) {
<< /*is non object*/ 0 << Call->getArg(1)->getSourceRange();
}
+static bool checkBuiltinVerboseTrap(CallExpr *Call, Sema ) {
delcypher wrote:
@@ -27,6 +27,9 @@ namespace llvm {
}
}
+// Prefix for __builtin_verbose_trap.
+#define CLANG_VERBOSE_TRAP_PREFIX "__llvm_verbose_trap"
ahatanak wrote:
I can make it a C++ constant if that's preferable.
https://github.com/llvm/llvm-project/pull/79230
@@ -27,6 +27,9 @@ namespace llvm {
}
}
+// Prefix for __builtin_verbose_trap.
+#define CLANG_VERBOSE_TRAP_PREFIX "__llvm_verbose_trap"
dwblaikie wrote:
& not sure it being a compile time constant regex is super important - the
regex compilation probably
@@ -27,6 +27,9 @@ namespace llvm {
}
}
+// Prefix for __builtin_verbose_trap.
+#define CLANG_VERBOSE_TRAP_PREFIX "__llvm_verbose_trap"
dwblaikie wrote:
I think we usually use some llvm or clang prefix in these sort of things, to
reduce the chance of
@@ -172,6 +172,27 @@ static bool checkArgCount(Sema , CallExpr *Call,
unsigned DesiredArgCount) {
<< /*is non object*/ 0 << Call->getArg(1)->getSourceRange();
}
+static bool checkBuiltinVerboseTrap(CallExpr *Call, Sema ) {
+ bool HasError = false;
+
+ for (int I =
https://github.com/adrian-prantl approved this pull request.
https://github.com/llvm/llvm-project/pull/79230
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -29,7 +29,9 @@
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Support/Allocator.h"
+#include
adrian-prantl wrote:
This seems to not belong to this commit?
https://github.com/llvm/llvm-project/pull/79230
https://github.com/adrian-prantl edited
https://github.com/llvm/llvm-project/pull/79230
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
ahatanak wrote:
We could use the function name without the prefix as the key when searching for
the subprogram in `CGDebugInfo::createInlinedTrapSubprogram`.
https://github.com/llvm/llvm-project/pull/79230
___
cfe-commits mailing list
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 95200f3bb3859738981240a9d8c503a13ede9601 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 01/15] Add support for builtin_verbose_trap
The builtin causes
@@ -27,6 +27,9 @@ namespace llvm {
}
}
+// Prefix for __builtin_verbose_trap.
+#define CLANG_VERBOSE_TRAP_PREFIX "__llvm_verbose_trap"
ahatanak wrote:
@delcypher I don't think it has to mention `llvm`. Can we make it even shorter,
e.g., `__trap_msg`?
@@ -27,6 +27,9 @@ namespace llvm {
}
}
+// Prefix for __builtin_verbose_trap.
+#define CLANG_VERBOSE_TRAP_PREFIX "__llvm_verbose_trap"
ahatanak wrote:
If we used a C++ constant, wouldn't it be harder to make a compile time
constant string (e.g.,
@@ -27,6 +27,9 @@ namespace llvm {
}
}
+// Prefix for __builtin_verbose_trap.
+#define CLANG_VERBOSE_TRAP_PREFIX "__llvm_verbose_trap"
adrian-prantl wrote:
Does this have to be a macro or could it be a C++ constant?
@@ -27,6 +27,9 @@ namespace llvm {
}
}
+// Prefix for __builtin_verbose_trap.
+#define CLANG_VERBOSE_TRAP_PREFIX "__llvm_verbose_trap"
delcypher wrote:
@ahatanak Nit: Why does the macro name mention `CLANG` but the string mentions
`llvm` instead of Clang?
@@ -27,6 +27,9 @@ namespace llvm {
}
}
+// Prefix for __builtin_verbose_trap.
delcypher wrote:
@ahatanak Does this comment need updating? The prefix isn’t just for
__builtin_verbose_trap anymore.
https://github.com/llvm/llvm-project/pull/79230
ahatanak wrote:
I'll merge this in a day or two if there are no objections.
https://github.com/llvm/llvm-project/pull/79230
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
ahatanak wrote:
@dwblaikie any
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 95200f3bb3859738981240a9d8c503a13ede9601 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 01/14] Add support for builtin_verbose_trap
The builtin causes
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
ahatanaka wrote:
I've updated
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 95200f3bb3859738981240a9d8c503a13ede9601 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 01/13] Add support for builtin_verbose_trap
The builtin causes
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
ahatanak wrote:
@dwblaikie 's
@@ -3379,6 +3379,60 @@ Query for this feature with
``__has_builtin(__builtin_debugtrap)``.
Query for this feature with ``__has_builtin(__builtin_trap)``.
+``__builtin_verbose_trap``
dwblaikie wrote:
Ah, OK - that seems like more reason the prefix should be
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s
+
+#if !__has_builtin(__builtin_verbose_trap)
+#error
+#endif
+
+constexpr char const* constMsg1 = "hello";
+char const* const constMsg2 = "hello";
+char const constMsg3[] = "hello";
+
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
ahatanaka wrote:
OK, I'll make
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
dwblaikie wrote:
I think I agree
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 95200f3bb3859738981240a9d8c503a13ede9601 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 01/12] Add support for builtin_verbose_trap
The builtin causes
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
ahatanak wrote:
@dwblaikie any
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 44813fefa59b442abcc6cb23c2ac8d3f78e44efc Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 01/12] Add support for builtin_verbose_trap
The builtin causes
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 44813fefa59b442abcc6cb23c2ac8d3f78e44efc Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 01/11] Add support for builtin_verbose_trap
The builtin causes
@@ -3379,6 +3379,60 @@ Query for this feature with
``__has_builtin(__builtin_debugtrap)``.
Query for this feature with ``__has_builtin(__builtin_trap)``.
+``__builtin_verbose_trap``
ahatanak wrote:
It doesn't look like the existing builtins are in
@@ -3379,6 +3379,60 @@ Query for this feature with
``__has_builtin(__builtin_debugtrap)``.
Query for this feature with ``__has_builtin(__builtin_trap)``.
+``__builtin_verbose_trap``
delcypher wrote:
@ahatanak Is this in the wrong place in the document?
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
ahatanak wrote:
@dwblaikie what
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
ahatanak wrote:
In that case, we can use `-disable-llvm-passes` or `-disable-llvm-optzns` to
avoid running the llvm optimization
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 678cd8ea37f1d02c70fd09b7107542c8301c3bd2 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 01/12] Add support for builtin_verbose_trap
The builtin causes
https://github.com/delcypher edited
https://github.com/llvm/llvm-project/pull/79230
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
delcypher wrote:
@pogo59 @ahatanak Thanks for the explanation.
A slight issue with that is some cases Clang will generate
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 678cd8ea37f1d02c70fd09b7107542c8301c3bd2 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 01/11] Add support for builtin_verbose_trap
The builtin causes
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
ahatanak wrote:
https://llvm.org/docs/TestingGuide.html#best-practices-for-regression-tests
recommends we run a minimal set of
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
pogo59 wrote:
If you want to test optimization behavior, that would be an LLVM test starting
from IR. Clang itself does not
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
delcypher wrote:
@dwblaikie We
https://github.com/delcypher deleted
https://github.com/llvm/llvm-project/pull/79230
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
delcypher wrote:
@ahatanak Any follow up?
https://github.com/llvm/llvm-project/pull/79230
@@ -602,6 +613,19 @@ class CGDebugInfo {
return CoroutineParameterMappings;
}
+ // Create a debug location from `TrapLocation` that adds an artificial inline
+ // frame where the frame name is
+ //
+ // * `: ` if `` is not empty.
+ // * `` if `` is empty. Note ``
@@ -346,6 +348,15 @@ class CGDebugInfo {
const FieldDecl *BitFieldDecl, const llvm::DIDerivedType *BitFieldDI,
llvm::ArrayRef PreviousFieldsDI, const RecordDecl *RD);
+ // A cache that maps artificial inlined function names used for
+ // __builtin_verbose_trap
@@ -346,6 +348,15 @@ class CGDebugInfo {
const FieldDecl *BitFieldDecl, const llvm::DIDerivedType *BitFieldDI,
llvm::ArrayRef PreviousFieldsDI, const RecordDecl *RD);
+ // A cache that maps artificial inlined function names used for
+ // __builtin_verbose_trap
@@ -3379,6 +3379,54 @@ Query for this feature with
``__has_builtin(__builtin_debugtrap)``.
Query for this feature with ``__has_builtin(__builtin_trap)``.
+``__builtin_verbose_trap``
+--
+
+``__builtin_verbose_trap`` causes the program to stop its
@@ -3379,6 +3379,60 @@ Query for this feature with
``__has_builtin(__builtin_debugtrap)``.
Query for this feature with ``__has_builtin(__builtin_trap)``.
+``__builtin_verbose_trap``
+--
+
+``__builtin_verbose_trap`` causes the program to stop its
@@ -3379,6 +3379,57 @@ Query for this feature with
``__has_builtin(__builtin_debugtrap)``.
Query for this feature with ``__has_builtin(__builtin_trap)``.
+``__builtin_verbose_trap``
+--
+
+``__builtin_verbose_trap`` causes the program to stop its
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s
+
+#if !__has_builtin(__builtin_verbose_trap)
+#error
+#endif
+
+constexpr char const* constMsg1 = "hello";
+char const* const constMsg2 = "hello";
+char const constMsg3[] = "hello";
+
https://github.com/delcypher edited
https://github.com/llvm/llvm-project/pull/79230
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/delcypher requested changes to this pull request.
It looks like there are still some unresolved discussions in this PR.
https://github.com/llvm/llvm-project/pull/79230
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -3424,6 +3447,24 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *
+CGDebugInfo::CreateTrapFailureMessageFor(llvm::DebugLoc TrapLocation,
+
@@ -3452,6 +3452,18 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl
GD, unsigned BuiltinID,
case Builtin::BI__builtin_trap:
EmitTrapCall(Intrinsic::trap);
return RValue::get(nullptr);
+ case Builtin::BI__builtin_verbose_trap: {
+llvm::DILocation
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
delcypher wrote:
Really? We don't test the generated IR in an optimized build? That seems like a
bad idea given that code built
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
delcypher wrote:
Really? We don't test the generated IR in an optimized build? That seems like a
bad idea given that code built
https://github.com/PeimingLiu updated
https://github.com/llvm/llvm-project/pull/79230
>From 678cd8ea37f1d02c70fd09b7107542c8301c3bd2 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 01/10] Add support for builtin_verbose_trap
The builtin
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 678cd8ea37f1d02c70fd09b7107542c8301c3bd2 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 1/9] Add support for builtin_verbose_trap
The builtin causes
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
+
+// CHECK-LABEL: define void @_Z2f0v()
+// CHECK: call void @llvm.trap(), !dbg ![[LOC17:.*]]
+
+// CHECK-LABEL: define void @_Z2f1v()
+// CHECK:
@@ -3452,6 +3452,18 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl
GD, unsigned BuiltinID,
case Builtin::BI__builtin_trap:
EmitTrapCall(Intrinsic::trap);
return RValue::get(nullptr);
+ case Builtin::BI__builtin_verbose_trap: {
+llvm::DILocation
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
ahatanak wrote:
Do we want to add a clang test? I thought we generally don't enable
optimization in clang CodeGen tests because
@@ -3424,6 +3443,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *
+CGDebugInfo::CreateTrapFailureMessageFor(llvm::DebugLoc TrapLocation,
+
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s
+
+#if !__has_builtin(__builtin_verbose_trap)
+#error
+#endif
+
+constexpr char const* constMsg1 = "hello";
+char const* const constMsg2 = "hello";
+char const constMsg3[] = "hello";
+
@@ -3424,6 +3443,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *
+CGDebugInfo::CreateTrapFailureMessageFor(llvm::DebugLoc TrapLocation,
+
@@ -346,6 +348,15 @@ class CGDebugInfo {
const FieldDecl *BitFieldDecl, const llvm::DIDerivedType *BitFieldDI,
llvm::ArrayRef PreviousFieldsDI, const RecordDecl *RD);
+ // A cache that maps artificial inlined function names used for
+ // __builtin_verbose_trap
@@ -3416,6 +3437,27 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
+llvm::DebugLoc TrapLocation, StringRef
@@ -3416,6 +3437,27 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
+llvm::DebugLoc TrapLocation, StringRef
@@ -346,6 +348,15 @@ class CGDebugInfo {
const FieldDecl *BitFieldDecl, const llvm::DIDerivedType *BitFieldDI,
llvm::ArrayRef PreviousFieldsDI, const RecordDecl *RD);
+ // A cache that maps artificial inlined function names used for
+ // __builtin_verbose_trap
@@ -3424,6 +3443,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *
+CGDebugInfo::CreateTrapFailureMessageFor(llvm::DebugLoc TrapLocation,
+
@@ -3424,6 +3443,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *
+CGDebugInfo::CreateTrapFailureMessageFor(llvm::DebugLoc TrapLocation,
+
@@ -3416,6 +3437,27 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
+llvm::DebugLoc TrapLocation, StringRef
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
+
+// CHECK-LABEL: define void @_Z2f0v()
+// CHECK: call void @llvm.trap(), !dbg ![[LOC17:.*]]
+
+// CHECK-LABEL: define void @_Z2f1v()
+// CHECK:
@@ -3424,6 +3443,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *
+CGDebugInfo::CreateTrapFailureMessageFor(llvm::DebugLoc TrapLocation,
+
https://github.com/delcypher requested changes to this pull request.
Looks pretty good. I have a few minor comments. Some things I suggest we may
want to do in a follow up patch.
https://github.com/llvm/llvm-project/pull/79230
___
cfe-commits mailing
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fcxx-exceptions -verify %s
+
+#if !__has_builtin(__builtin_verbose_trap)
+#error
+#endif
+
+constexpr char const* constMsg1 = "hello";
+char
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s
+
+#if !__has_builtin(__builtin_verbose_trap)
+#error
+#endif
+
+constexpr char const* constMsg1 = "hello";
+char const* const constMsg2 = "hello";
+char const constMsg3[] = "hello";
+
@@ -3379,6 +3379,57 @@ Query for this feature with
``__has_builtin(__builtin_debugtrap)``.
Query for this feature with ``__has_builtin(__builtin_trap)``.
+``__builtin_verbose_trap``
+--
+
+``__builtin_verbose_trap`` causes the program to stop its
@@ -3452,6 +3452,18 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl
GD, unsigned BuiltinID,
case Builtin::BI__builtin_trap:
EmitTrapCall(Intrinsic::trap);
return RValue::get(nullptr);
+ case Builtin::BI__builtin_verbose_trap: {
+llvm::DILocation
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
delcypher wrote:
Could we add a separate test that tests the trap merging behavior in optimized
code?
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
+
+// CHECK-LABEL: define void @_Z2f0v()
+// CHECK: call void @llvm.trap(), !dbg ![[LOC17:.*]]
+
+// CHECK-LABEL: define void @_Z2f1v()
+// CHECK:
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm
-debug-info-kind=limited %s -o - | FileCheck %s
+
+// CHECK-LABEL: define void @_Z2f0v()
+// CHECK: call void @llvm.trap(), !dbg ![[LOC17:.*]]
+
+// CHECK-LABEL: define void @_Z2f1v()
+// CHECK:
@@ -775,6 +775,11 @@ class Expr : public ValueStmt {
const Expr *PtrExpression, ASTContext ,
EvalResult ) const;
+ /// If the current Expr can be evaluated to a pointer to a null-terminated
+ /// constant
@@ -1628,6 +1628,25 @@ llvm::DIType *CGDebugInfo::createFieldType(
offsetInBits, flags, debugType,
Annotations);
}
+llvm::DISubprogram *
+CGDebugInfo::createInlinedTrapSubprogram(StringRef FuncName,
+
https://github.com/delcypher edited
https://github.com/llvm/llvm-project/pull/79230
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -346,6 +348,15 @@ class CGDebugInfo {
const FieldDecl *BitFieldDecl, const llvm::DIDerivedType *BitFieldDI,
llvm::ArrayRef PreviousFieldsDI, const RecordDecl *RD);
+ // A cache that maps artificial inlined function names used for
+ // __builtin_verbose_trap
@@ -346,6 +348,15 @@ class CGDebugInfo {
const FieldDecl *BitFieldDecl, const llvm::DIDerivedType *BitFieldDI,
llvm::ArrayRef PreviousFieldsDI, const RecordDecl *RD);
+ // A cache that maps artificial inlined function names used for
+ // __builtin_verbose_trap
@@ -602,6 +613,19 @@ class CGDebugInfo {
return CoroutineParameterMappings;
}
+ // Create a debug location from `TrapLocation` that adds an artificial inline
+ // frame where the frame name is
+ //
+ // * `: ` if `` is not empty.
+ // * `` if `` is empty. Note ``
@@ -3424,6 +3443,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *
+CGDebugInfo::CreateTrapFailureMessageFor(llvm::DebugLoc TrapLocation,
+
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 678cd8ea37f1d02c70fd09b7107542c8301c3bd2 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 1/8] Add support for builtin_verbose_trap
The builtin causes
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 678cd8ea37f1d02c70fd09b7107542c8301c3bd2 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 1/7] Add support for builtin_verbose_trap
The builtin causes
@@ -346,6 +346,14 @@ class CGDebugInfo {
const FieldDecl *BitFieldDecl, const llvm::DIDerivedType *BitFieldDI,
llvm::ArrayRef PreviousFieldsDI, const RecordDecl *RD);
+ // A cache that maps artificial inlined function names used for
+ // __builtin_verbose_trap
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
dwblaikie wrote:
There's
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
return DBuilder.createTempMacroFile(Parent, Line, FName);
}
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
+llvm::DebugLoc TrapLocation, StringRef
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 678cd8ea37f1d02c70fd09b7107542c8301c3bd2 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 1/6] Add support for builtin_verbose_trap
The builtin causes
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s
+
+#if !__has_builtin(__builtin_verbose_trap)
+#error
+#endif
+
+constexpr char const* constMsg1 = "hello";
+char const* const constMsg2 = "hello";
+char const constMsg3[] = "hello";
+
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s
+
+#if !__has_builtin(__builtin_verbose_trap)
+#error
+#endif
+
+constexpr char const* constMsg1 = "hello";
+char const* const constMsg2 = "hello";
+char const constMsg3[] = "hello";
+
https://github.com/ahatanak updated
https://github.com/llvm/llvm-project/pull/79230
>From 678cd8ea37f1d02c70fd09b7107542c8301c3bd2 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka
Date: Tue, 16 Jan 2024 13:18:09 -0800
Subject: [PATCH 1/5] Add support for builtin_verbose_trap
The builtin causes
https://github.com/var-const approved this pull request.
LGTM from the libc++ perspective, thanks a lot for working on this!
https://github.com/llvm/llvm-project/pull/79230
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
1 - 100 of 144 matches
Mail list logo