https://github.com/JustinStitt edited
https://github.com/llvm/llvm-project/pull/148914
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
@@ -359,6 +366,16 @@ class DeclSpec {
LLVM_PREFERRED_TYPE(TQ)
unsigned TypeQualifiers : 5; // Bitwise OR of TQ.
+ // overflow behavior qualifiers
+ LLVM_PREFERRED_TYPE(bool)
JustinStitt wrote:
Sounds good to me. I'll make the change.
https://github.co
https://github.com/JustinStitt edited
https://github.com/llvm/llvm-project/pull/148914
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
@@ -4043,6 +4043,33 @@ def note_cannot_use_trivial_abi_reason : Note<
"it has a __weak field|it has a field of a non-trivial class type|"
"it has an address-discriminated '__ptrauth' field}1">;
+// OverflowBehavior attribute
+def err_overflow_behavior_unknown_ident
+:
https://github.com/JustinStitt edited
https://github.com/llvm/llvm-project/pull/148914
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
@@ -9744,6 +9744,16 @@ static void DiagnoseNarrowingInInitList(Sema &S,
case NK_Constant_Narrowing: {
// A constant value was narrowed.
+
+// Overflow behavior destination types with a 'wrap' kind can elide
JustinStitt wrote:
> Why is that a reasona
https://github.com/JustinStitt edited
https://github.com/llvm/llvm-project/pull/148914
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
@@ -2845,6 +2866,41 @@ bool Sema::IsComplexPromotion(QualType FromType,
QualType ToType) {
ToComplex->getElementType());
}
+bool Sema::IsOverflowBehaviorTypePromotion(QualType FromType, QualType ToType)
{
JustinStitt wrote:
Yes the i
@@ -4043,6 +4043,33 @@ def note_cannot_use_trivial_abi_reason : Note<
"it has a __weak field|it has a field of a non-trivial class type|"
"it has an address-discriminated '__ptrauth' field}1">;
+// OverflowBehavior attribute
+def err_overflow_behavior_unknown_ident
+:
@@ -1146,23 +1161,16 @@ def Parentheses : DiagGroup<"parentheses",
// - conversion warnings for literals are on by default
// - bool-to-pointer conversion warnings are on by default
// - __null-to-integer conversion warnings are on by default
-def Conversion : DiagGroup<"
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -foverflow-behavior-types -std=c++11 -ast-print %s -o - |
FileCheck %s
+
+extern int __attribute__((overflow_behavior(no_wrap))) a;
+extern int __attribute__((overflow_behavior(wrap))) b;
+
+// CHECK: extern __no_wrap int a;
+// CHECK: extern _
@@ -339,6 +389,8 @@ ConvertTypeToDiagnosticString(ASTContext &Context, QualType
Ty,
<< "' " << Values << ")";
return DecoratedString;
}
+
+TryConvertOverflowBehaviorTypeToDiagnosticString(Context, Ty, S);
JustinStitt wrote:
> If you fee
@@ -339,6 +389,8 @@ ConvertTypeToDiagnosticString(ASTContext &Context, QualType
Ty,
<< "' " << Values << ")";
return DecoratedString;
}
+
+TryConvertOverflowBehaviorTypeToDiagnosticString(Context, Ty, S);
JustinStitt wrote:
OK, so shoul
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -foverflow-behavior-types -std=c++11 -ast-print %s -o - |
FileCheck %s
+
+extern int __attribute__((overflow_behavior(no_wrap))) a;
+extern int __attribute__((overflow_behavior(wrap))) b;
+
+// CHECK: extern __no_wrap int a;
+// CHECK: extern _
@@ -2165,6 +2167,26 @@ void TypePrinter::printBTFTagAttributedAfter(const
BTFTagAttributedType *T,
printAfter(T->getWrappedType(), OS);
}
+void TypePrinter::printOverflowBehaviorBefore(const OverflowBehaviorType *T,
+ raw_ostream
@@ -7477,6 +7477,10 @@ void
TypeLocReader::VisitBTFTagAttributedTypeLoc(BTFTagAttributedTypeLoc TL) {
// Nothing to do.
}
+void TypeLocReader::VisitOverflowBehaviorTypeLoc(OverflowBehaviorTypeLoc TL) {
+ // Nothing to do.
+}
JustinStitt wrote:
Right. Done
@@ -112,6 +112,25 @@ class LangOptionsBase {
SOB_Trapping
};
+ // Used by __attribute__((overflow_behavior())) to describe overflow behavior
+ // on a per-type basis.
+ enum OverflowBehaviorKind {
+// Default C standard behavior (type dependent).
+OB_Unset,
+
https://github.com/JustinStitt edited
https://github.com/llvm/llvm-project/pull/148914
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
https://github.com/JustinStitt edited
https://github.com/llvm/llvm-project/pull/148914
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
https://github.com/JustinStitt edited
https://github.com/llvm/llvm-project/pull/148914
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
@@ -112,6 +112,25 @@ class LangOptionsBase {
SOB_Trapping
};
+ // Used by __attribute__((overflow_behavior())) to describe overflow behavior
+ // on a per-type basis.
+ enum OverflowBehaviorKind {
+// Default C standard behavior (type dependent).
+OB_Unset,
+
JustinStitt wrote:
ping.
rebased and fixed tests after `Commit b24769855d97: [Clang] [Sema] Make
-Wincompatible-pointer-types an error by default (#157364)` caused some tests
to fail.
https://github.com/llvm/llvm-project/pull/148914
___
lldb-commits
22 matches
Mail list logo