llvm-project/clang/lib/AST
Erich Keane fc3dfd3e35 Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.
As reported here https://bugs.llvm.org/show_bug.cgi?id=42000, it was
possible to get the constexpr version of __builtin_*_overflow to give
the wrong answer.

This was because when extending the operands to fit the largest type (so
that the math could be done), the decision on whether to sign/zero
extend the operands was based on the result signedness, not on the
operands signedness.

In the reported case, (unsigned char)255 - (int)100 needed
to have each extended to the int in order to do the math.  However, when
extending the first operand to 'int', we incorrectly sign extended it
instead of zero extending.  Thus, the result didnt fit back into the
unsigned char.

The fix for this was simply to choose zero/sign extension based on the
sign of the operand itself.

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

llvm-svn: 362157
2019-05-30 21:35:32 +00:00
..
APValue.cpp Refactor: split Uninitialized state on APValue into an "Absent" state 2019-05-21 23:15:18 +00:00
ASTConsumer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ASTContext.cpp Add Attribute NoThrow as an Exception Specifier Type 2019-05-30 17:31:54 +00:00
ASTDiagnostic.cpp Recommit r359859 "[Attribute/Diagnostics] Print macro if definition is an attribute declaration" 2019-05-07 03:20:17 +00:00
ASTDumper.cpp When dumping the AST to JSON, dump the type information from a typeid expression with a type operand. 2019-05-27 14:34:31 +00:00
ASTImporter.cpp Revert "clang support gnu asm goto." 2019-05-30 15:38:02 +00:00
ASTImporterLookupTable.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ASTStructuralEquivalence.cpp [c++20] Add support for explicit(bool), as described in P0892R2. 2019-05-09 03:59:21 +00:00
ASTTypeTraits.cpp [OPENMP]Initial support for 'allocate' clause. 2019-03-27 14:14:31 +00:00
AttrImpl.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CMakeLists.txt Introduce the ability to dump the AST to JSON. 2019-05-13 21:39:55 +00:00
CXXABI.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CXXInheritance.cpp Range-style std::find{,_if} -> llvm::find{,_if}. NFC 2019-03-31 08:48:19 +00:00
Comment.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CommentBriefParser.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CommentCommandTraits.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CommentLexer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CommentParser.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CommentSema.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ComparisonCategories.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DataCollection.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Decl.cpp Refactor: split Uninitialized state on APValue into an "Absent" state 2019-05-21 23:15:18 +00:00
DeclBase.cpp [c++20] P0780R2: Support pack-expansion of init-captures. 2019-05-21 20:10:50 +00:00
DeclCXX.cpp Permit static local structured bindings to be named from arbitrary scopes inside their declaring scope. 2019-05-25 01:04:17 +00:00
DeclFriend.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DeclGroup.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DeclObjC.cpp Use llvm::stable_sort 2019-04-24 14:43:05 +00:00
DeclOpenMP.cpp [OPENMP 5.0]Initial support for 'allocator' clause. 2019-03-12 18:52:33 +00:00
DeclPrinter.cpp [c++20] Add support for explicit(bool), as described in P0892R2. 2019-05-09 03:59:21 +00:00
DeclTemplate.cpp Replace ad-hoc tracking of pattern for an instantiated class-scope 2019-05-02 00:49:14 +00:00
DeclarationName.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Expr.cpp Added an assertion to constant evaluation enty points that prohibits dependent expressions 2019-05-17 17:16:53 +00:00
ExprCXX.cpp [c++20] P0780R2: Support pack-expansion of init-captures. 2019-05-21 20:10:50 +00:00
ExprClassification.cpp Implement __builtin_LINE() et. al. to support source location capture. 2019-05-16 21:04:15 +00:00
ExprConstant.cpp Fix constexpr __builtin_*_overflow issue when unsigned->signed operand. 2019-05-30 21:35:32 +00:00
ExprObjC.cpp [AST][NFC] Add const children() accessors to all AST nodes 2019-04-12 15:36:02 +00:00
ExternalASTMerger.cpp [ASTImporter] Use llvm::Expected and Error in the importer API 2019-05-15 10:29:48 +00:00
ExternalASTSource.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
FormatString.cpp OpenCL: Use length modifier for warning on vector printf arguments 2019-01-29 20:49:54 +00:00
FormatStringParsing.h OpenCL: Improve vector printf warnings 2018-12-01 22:16:27 +00:00
InheritViz.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ItaniumCXXABI.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ItaniumMangle.cpp Add curley brackets to case statement that declares a variable. 2019-05-29 17:04:48 +00:00
JSONNodeDumper.cpp Add Attribute NoThrow as an Exception Specifier Type 2019-05-30 17:31:54 +00:00
Linkage.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Mangle.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MicrosoftCXXABI.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MicrosoftMangle.cpp clang-cl: Fix mangling of catchable types with names longer than 4kiB 2019-05-29 13:48:19 +00:00
NSAPI.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
NestedNameSpecifier.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ODRHash.cpp [c++20] Implement P0846R0: allow (ADL-only) calls to template-ids whose 2019-05-09 03:31:27 +00:00
OSLog.cpp os_log: Allow specifying mask type in format string. 2018-11-06 07:05:14 +00:00
OpenMPClause.cpp [OPENMP]Initial support for 'allocate' clause. 2019-03-27 14:14:31 +00:00
ParentMap.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
PrintfFormatString.cpp OpenCL: Use length modifier for warning on vector printf arguments 2019-01-29 20:49:54 +00:00
QualTypeNames.cpp Make getFullyQualifiedName qualify both the pointee and class type for member ptr types 2019-03-15 11:09:41 +00:00
RawCommentList.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RecordLayout.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RecordLayoutBuilder.cpp Use llvm::stable_sort 2019-04-24 14:43:05 +00:00
ScanfFormatString.cpp OpenCL: Use length modifier for warning on vector printf arguments 2019-01-29 20:49:54 +00:00
SelectorLocationsKind.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Stmt.cpp Revert "clang support gnu asm goto." 2019-05-30 15:38:02 +00:00
StmtCXX.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StmtIterator.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StmtObjC.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StmtOpenMP.cpp [clang][OpeMP] Model OpenMP structured-block in AST (PR40563) 2019-03-20 16:32:36 +00:00
StmtPrinter.cpp Revert "clang support gnu asm goto." 2019-05-30 15:38:02 +00:00
StmtProfile.cpp Revert "clang support gnu asm goto." 2019-05-30 15:38:02 +00:00
StmtViz.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TemplateBase.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TemplateName.cpp [c++20] Implement P0846R0: allow (ADL-only) calls to template-ids whose 2019-05-09 03:31:27 +00:00
TextNodeDumper.cpp [c++20] P0780R2: Support pack-expansion of init-captures. 2019-05-21 20:10:50 +00:00
Type.cpp Add Attribute NoThrow as an Exception Specifier Type 2019-05-30 17:31:54 +00:00
TypeLoc.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TypePrinter.cpp Recommit r359859 "[Attribute/Diagnostics] Print macro if definition is an attribute declaration" 2019-05-07 03:20:17 +00:00
VTTBuilder.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
VTableBuilder.cpp Use llvm::stable_sort 2019-04-24 14:43:05 +00:00