hanchenye-llvm-project/clang/test
Chandler Carruth c41c8b3a4a Fix the warning for divide by zero to be a bit more robust. ;]
Previously, it only ever fired for zeros which formed null pointers.
Now, hilariously, in C++98 this was almost anything. Including tricks
like warning on the divisor in this code:

typedef char c3[3];
size_t f(c3* ptr) {
  return (sizeof(ptr) / sizeof(*ptr)) / (size_t)(!(sizeof(ptr) % sizeof(*ptr)));
}

Why the RHS of the outer divide is a null pointer constant is a sordid
tale of sorrow. Anyways, the committee fixed this for C++11 and onward
as part of core isssue 903, and Richard recently implemented this fix
causing the warning to go away here (and elsewhere).

This patch restores the warning here and adds it for numerous other
somewhat obvious gaffes:

int g(int x) {
  return x / (int)(0.0);
}

The patch is essentially just using the full power of our constant
folding in Clang to produce the warning, but insisting that it must fold
to an *integer* which is zero so that we don't get false positives
anywhere.

llvm-svn: 183970
2013-06-14 08:57:18 +00:00
..
ARCMT Point diagnostics that complain about a use of a selector in an objc message, to the selector location. 2013-05-01 00:24:09 +00:00
ASTMerge Extended VerifyDiagnosticConsumer to also verify source file for diagnostic. 2013-04-17 08:06:46 +00:00
Analysis [analyzer; alternate edges] Fix the edge locations in presence of macros. 2013-06-08 00:29:24 +00:00
CXX Fix some confusing diagnostic wording. s/implicit default/implicit/ if we're 2013-06-13 03:34:55 +00:00
CodeCompletion
CodeGen Fix buildbot breakage on PPC64. 2013-06-12 17:31:32 +00:00
CodeGenCUDA Use kernel metadata to differentiate between kernel and device 2013-03-30 14:38:24 +00:00
CodeGenCXX Emit initializers for static-storage-duration temporaries as constants where 2013-06-14 03:07:01 +00:00
CodeGenObjC Correctly handle designated initializers which modify an array initialized 2013-06-11 21:48:11 +00:00
CodeGenObjCXX Followup to r183931 to fix the lambda conversion-to-block-pointer member. 2013-06-13 20:56:27 +00:00
CodeGenOpenCL Use kernel metadata to differentiate between kernel and device 2013-03-30 14:38:24 +00:00
Coverage Objective-C: When using super.prop, property should be 2013-03-11 22:26:33 +00:00
Driver When we're compiling with -pg make sure to link with gcrt1.o on linux. Be 2013-06-07 23:25:01 +00:00
FixIt Add -Wdeprecated warnings and fixits for things deprecated in C++11: 2013-06-13 02:02:51 +00:00
Format Let clang-format move the cursor appropriately. 2013-05-21 12:21:39 +00:00
Frontend Extended VerifyDiagnosticConsumer to also verify source file for diagnostic. 2013-04-17 08:06:46 +00:00
Headers Remove dependence on system headers from this test, to try to make the Windows bots happier. 2013-05-09 22:45:27 +00:00
Index [libclang] Allow building a precompiled preamble with compiler errors 2013-06-11 00:36:55 +00:00
Lexer Introducing -Wheader-guard, a warning that checks header guards actually work 2013-06-12 21:20:57 +00:00
Misc Warn on va_start() when called with a reference parameter. 2013-05-24 23:31:57 +00:00
Modules Suffixing #pragma comment(lib) library names with .lib if necessary. This matches MSVC behavior, as well as allows us to properly link libraries such as the ones provided by the MSDN examples. 2013-05-24 15:06:56 +00:00
OpenMP OpenMP threadprivate with qualified names. 2013-05-13 04:18:18 +00:00
PCH [PCH] Fix crash with valid code, related to anonymous field initializers. 2013-05-30 23:59:46 +00:00
Parser Recognition of empty structures and unions is moved to semantic stage 2013-06-08 13:29:58 +00:00
Preprocessor Adding support for MSVC #pragma detect_mismatch functionality by emitting a FAILIFMISMATCH linker command into the object file. 2013-06-04 02:07:14 +00:00
Rewriter Define id to the correct type. 2013-06-07 18:41:01 +00:00
Sema Allow clang to build __clear_cache on ARM. 2013-06-13 18:34:17 +00:00
SemaCUDA
SemaCXX Fix the warning for divide by zero to be a bit more robust. ;] 2013-06-14 08:57:18 +00:00
SemaObjC Objective-C: Another case of issuing warning about misusing 2013-06-07 20:26:51 +00:00
SemaObjCXX Fix some confusing diagnostic wording. s/implicit default/implicit/ if we're 2013-06-13 03:34:55 +00:00
SemaOpenCL Add an error to check that all program scope variables are in the constant address space in OpenCL. 2013-04-05 20:14:50 +00:00
SemaTemplate Fix some confusing diagnostic wording. s/implicit default/implicit/ if we're 2013-06-13 03:34:55 +00:00
TableGen
Tooling Add support for static analysis to clang-check 2013-06-06 12:35:43 +00:00
Unit Propagate path to ASan/MSan symbolizer into test environment to produce useful reports on errors. 2013-04-04 07:41:20 +00:00
CMakeLists.txt Re-add clang-format tests to clang/test. 2013-03-25 09:14:25 +00:00
Makefile
TestRunner.sh
cxx-sections.data
lit.cfg Revert r179671 and just pass a triple to the test for a platform with known 2013-04-17 17:27:51 +00:00
lit.site.cfg.in Add asan/msan to the list of available features in LIT test runner. Mark ASan-unfriendly test as XFAIL. 2013-03-26 08:28:18 +00:00
make_test_dirs.pl