summaryrefslogtreecommitdiffstats
path: root/clang/test
Commit message (Collapse)AuthorAgeFilesLines
* Revert "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand."Daniel Jasper2016-12-203-42/+0
| | | | | | | | | | This reverts commit r290171. It triggers a bunch of warnings, because the new enumerator isn't handled in all switches. We want a warning-free build. Replied on the commit with more details. llvm-svn: 290173
* Fix for clang_Cursor_getSpellingNameRange()Kevin Funk2016-12-201-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Fixes spelling name ranges for user-defined string literal operators. Example: constexpr int operator""_toint(unsigned long long val) { return int(val); } Before this patch the spelling name range on consisted of 'operator'. After this patch: 'operator""_toint'. Related to http://reviews.llvm.org/D5041, which fixes the function for other cursor kinds. Reviewers: akyrtzi, craigt, skalinichev, klimek, milianw, bkramer Subscribers: cfe-commits Tags: #clang-c Differential Revision: https://reviews.llvm.org/D18462 llvm-svn: 290172
* [OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand.Egor Churaev2016-12-203-0/+42
| | | | | | | | | | | | Summary: Enabling the compression of CLK_NULL_QUEUE to variable of type queue_t. Reviewers: Anastasia Subscribers: cfe-commits, yaxunl, bader Differential Revision: https://reviews.llvm.org/D27569 llvm-svn: 290171
* Revert r290149: Add the alloc_size attribute to clang.Chandler Carruth2016-12-207-460/+20
| | | | | | | | | | | | | | | This commit fails MSan when running test/CodeGen/object-size.c in a confusing way. After some discussion with George, it isn't really clear what is going on here. We can make the MSan failure go away by testing for the invalid bit, but *why* things are invalid isn't clear. And yet, other code in the surrounding area is doing precisely this and testing for invalid. George is going to take a closer look at this to better understand the nature of the failure and recommit it, for now backing it out to clean up MSan builds. llvm-svn: 290169
* Add test for DR692.Richard Smith2016-12-201-0/+63
| | | | llvm-svn: 290166
* Fix the spelling of 'bitfield' in diagnostics to be consistently 'bit-field'.Chandler Carruth2016-12-205-16/+16
| | | | | | | | The latter agrees with most existing diagnostics and the C and C++ standards. Differential Revision: https://reviews.llvm.org/D26530 llvm-svn: 290159
* [Parser] Correct typo after lambda capture initializer is parsed.Akira Hatanaka2016-12-201-0/+15
| | | | | | | | | | | | | | | | This patch fixes an assertion that is triggered when RecordLayoutBuilder tries to compute the size of a field (for capture "name" in the test case) whose type hasn't been deduced. The patch fixes the bug by correcting the typo of the capture initializer after the initializer is parsed and before setting the expression for the annotation token. Fixes PR30566. rdar://problem/23380132 Differential Revision: https://reviews.llvm.org/D25206 llvm-svn: 290156
* Update for LLVM global variable debug info API change.Adrian Prantl2016-12-2012-41/+65
| | | | | | This reapplies r289921. llvm-svn: 290155
* Add the alloc_size attribute to clang.George Burgess IV2016-12-207-20/+460
| | | | | | | | | | | | | | | | | | | | This patch does three things: - Gives us the alloc_size attribute in clang, which lets us infer the number of bytes handed back to us by malloc/realloc/calloc/any user functions that act in a similar manner. - Teaches our constexpr evaluator that evaluating some `const` variables is OK sometimes. This is why we have a change in test/SemaCXX/constant-expression-cxx11.cpp and other seemingly unrelated tests. Richard Smith okay'ed this idea some time ago in person. - Uniques some Blocks in CodeGen, which was reviewed separately at D26410. Lack of uniquing only really shows up as a problem when combined with our new eagerness in the face of const. Differential Revision: https://reviews.llvm.org/D14274 llvm-svn: 290149
* Fix completely bogus types for some builtins:Richard Smith2016-12-193-5/+16
| | | | | | | | | | | | | | | | | | | | | * In C++, never create a FunctionNoProtoType for a builtin (fixes C++1z crasher from r289754). * Fix type of __sync_synchronize to be a no-parameter function rather than a varargs function. This matches GCC. * Fix type of vfprintf to match its actual type. We gave it a wrong type due to PR4290 (apparently autoconf generates invalid code and expects compilers to choke it down or it miscompiles the program; the relevant error in clang was downgraded to a warning in r122744 to fix other occurrences of this autoconf brokenness, so we don't need this workaround any more). * Turn off vararg argument checking for __noop, since it's not *really* a varargs function. Alternatively we could add custom type checking for it and synthesize parameter types matching the actual arguments in each call, but that seemed like overkill. llvm-svn: 290146
* Make another test insensitive to the default C++ dialect.Paul Robinson2016-12-191-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D27955 llvm-svn: 290145
* [analyzer] Add checker modeling gtest APIs.Devin Coughlin2016-12-192-0/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gtest is a widely-used unit-testing API. It provides macros for unit test assertions: ASSERT_TRUE(p != nullptr); that expand into an if statement that constructs an object representing the result of the assertion and returns when the assertion is false: if (AssertionResult gtest_ar_ = AssertionResult(p == nullptr)) ; else return ...; Unfortunately, the analyzer does not model the effect of the constructor precisely because (1) the copy constructor implementation is missing from the the header (so it can't be inlined) and (2) the boolean-argument constructor is constructed into a temporary (so the analyzer decides not to inline it since it doesn't reliably call temporary destructors right now). This results in false positives because the analyzer does not realize that the the assertion must hold along the non-return path. This commit addresses the false positives by explicitly modeling the effects of the two un-inlined constructors on the AssertionResult state. I've added a new package, "apiModeling", for these kinds of checkers that model APIs but don't emit any diagnostics. I envision all the checkers in this package always being on by default. This addresses the false positives reported in PR30936. Differential Revision: https://reviews.llvm.org/D27773 rdar://problem/22705813 llvm-svn: 290143
* Don't try to emit nullability fix-its within/around macros.Jordan Rose2016-12-192-0/+14
| | | | | | | | | | | | | | The newly-added notes from r290132 are too noisy even when the fix-it is valid. For the existing warning from r286521, it's probably the right decision 95% of the time to put the change outside the macro if the array is outside the macro and inside otherwise, but I don't want to overthink it right now. Caught by the ASan bot! More rdar://problem/29524992 llvm-svn: 290141
* [analyzer] Add sink after construction of temporary with no-return destructor.Devin Coughlin2016-12-191-0/+26
| | | | | | | | | | | | | | | | | | | The analyzer's CFG currently doesn't have nodes for calls to temporary destructors. This causes the analyzer to explore infeasible paths in which a no-return destructor would have stopped exploration and so results in false positives when no-return destructors are used to implement assertions. To mitigate these false positives, this patch stops generates a sink after evaluating a constructor on a temporary object that has a no-return destructor. This results in a loss of coverage because the time at which the destructor is called may be after the time of construction (especially for lifetime-extended temporaries). This addresses PR15599. rdar://problem/29131566 llvm-svn: 290140
* Add fix-it notes to the nullability consistency warning.Jordan Rose2016-12-1913-33/+161
| | | | | | | | | | | | | | | | | | | | | This is especially important for arrays, since no one knows the proper syntax for putting qualifiers in arrays. nullability.h:3:26: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) void arrayParameter(int x[]); ^ nullability.h:3:26: note: insert '_Nullable' if the array parameter may be null void arrayParameter(int x[]); ^ _Nullable nullability.h:3:26: note: insert '_Nonnull' if the array parameter should never be null void arrayParameter(int x[]); ^ _Nonnull rdar://problem/29524992 llvm-svn: 290132
* Reverting r290004, r290006, r290010 pending review.Sean Callanan2016-12-1910-37/+0
| | | | llvm-svn: 290130
* Make a few OpenMP tests "C++11 clean."Paul Robinson2016-12-193-6/+72
| | | | | | | This time trying to commit just the relevant 3 tests! Reviewed by abataev (in D27794) llvm-svn: 290128
* Undo accidental comitPaul Robinson2016-12-1912-244/+91
| | | | llvm-svn: 290121
* Make a few OpenMP tests "C++11 clean."Paul Robinson2016-12-1912-91/+244
| | | | | | Reviewed by abataev (in D27794) llvm-svn: 290120
* [ARM] Add missing -backend-option for -arm-execute-onlyPrakhar Bahuguna2016-12-191-2/+2
| | | | llvm-svn: 290110
* Revert "[c++1z] P0195R2: Support pack-expansion of using-declarations."Daniel Jasper2016-12-193-272/+2
| | | | | | | This reverts commit r290080 as it leads to many Clang crashes, e.g.: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/1814 llvm-svn: 290092
* Add __cpp_structured_bindings feature test macro for structured bindings, perRichard Smith2016-12-191-1/+5
| | | | | | latest (provisional) draft of SD-6. llvm-svn: 290082
* [c++1z] cxx_status: mark p0195r2 as done.Richard Smith2016-12-191-2/+5
| | | | llvm-svn: 290081
* [c++1z] P0195R2: Support pack-expansion of using-declarations.Richard Smith2016-12-193-2/+272
| | | | | | | | | | | This change introduces UsingPackDecl as a marker for the set of UsingDecls produced by pack expansion of a single (unresolved) using declaration. This is not strictly necessary (we just need to be able to map from the original using declaration to its expansions somehow), but it's useful to maintain the invariant that each declaration reference instantiates to refer to one declaration. llvm-svn: 290080
* Add a lit test for PR31374Yaxun Liu2016-12-191-0/+22
| | | | | | Differential Revision: https://reviews.llvm.org/D27909 llvm-svn: 290075
* Fix name hiding and redeclaration checking for dependent localRichard Smith2016-12-181-20/+19
| | | | | | using-declarations. llvm-svn: 290072
* Fix some interactions between C++11 and C++14 features and using-declarations:Richard Smith2016-12-181-4/+154
| | | | | | | | | | | * a dependent non-type using-declaration within a function template can be valid, as it can refer to an enumerator, so don't reject it in the template definition * we can partially substitute into a dependent using-declaration if it appears within a (local class in a) generic lambda within a function template, which means an UnresolvedUsing*Decl doesn't necessarily instantiate to a UsingDecl. llvm-svn: 290071
* Fix a lit test issue exposed by r290056Yaxun Liu2016-12-181-3/+3
| | | | | | | | | | The test requests a target which supports cl_khr_gl_msaa_sharing since in test/PCH/ocl_types.h it tries to enable cl_khr_gl_msaa_sharing. Therefore this test fails on targets not supporting cl_khr_gl_msaa_sharing, e.g. ppc64, etc. The fix is to add triple spir-unknown-unknown which supports cl_khr_gl_msaa_sharing. llvm-svn: 290059
* Recommit r289979 [OpenCL] Allow disabling types and declarations associated ↵Yaxun Liu2016-12-185-12/+94
| | | | | | | | with extensions Fixed undefined behavior due to cast integer to bool in initializer list. llvm-svn: 290056
* [OpenMP] Sema and parsing for 'target teams' pragmaKelvin Li2016-12-1718-12/+3059
| | | | | | | | This patch is to implement sema and parsing for 'target teams' pragma. Differential Revision: https://reviews.llvm.org/D27818 llvm-svn: 290038
* [analyzer] UnixAPIChecker: Don't diagnose for functions in C++ namespacesDevin Coughlin2016-12-171-0/+62
| | | | | | | | | | Update the UnixAPIChecker to not diagnose for calls to functions that are declared in C++ namespaces. This avoids false positives when a namespaced function has the same name as a Unix API. This address PR28331. llvm-svn: 290023
* Add explicit triple to test to fix arm bots.Peter Collingbourne2016-12-161-1/+1
| | | | llvm-svn: 290008
* [analyzer] Extend UnixAPIChecker open() checks to handle openat().Devin Coughlin2016-12-162-1820/+2063
| | | | | | | | | The openat() API has similar constraints to the open() API -- it just takes an extra parameter. rdar://problem/29526458 llvm-svn: 290005
* Testbed and skeleton of a new expression parserSean Callanan2016-12-1610-0/+37
| | | | | | | | | | | | | | | | | | | | LLVM's JIT is now the foundation of dynamic-compilation features for many languages. Clang also has low-level support for dynamic compilation (ASTImporter and ExternalASTSource, notably). How the compiler is set up for dynamic parsing is generally left up to individual clients, for example LLDB's C/C++/Objective-C expression parser and the ROOT project. Although this arrangement offers external clients the flexibility to implement dynamic features as they see fit, the lack of an in-tree client means that subtle bugs can be introduced that cause regressions in the external clients but aren't caught by tests (or users) until much later. LLDB for example regularly encounters complicated ODR violation scenarios where it is not immediately clear who is at fault. Other external clients (notably, Cling) rely on similar functionality, and another goal is to break this functionality up into composable parts so that any client can be built easily on top of Clang without requiring extensive additional code. I propose that the parts required to build a simple expression parser be added to Clang. Initially, I aim to have the following features: - A piece that looks up external declarations from a variety of sources (e.g., from previous dynamic compilations, from modules, or from DWARF) and uses clear conflict resolution rules to reconcile differences, with easily understood errors. This functionality will be supported by in-tree tests. - A piece that works hand in hand with the LLVM JIT to resolve the locations of external declarations so that e.g. variables can be redeclared and (for high-performance applications like DTrace) external variables can be accessed directly from the registers where they reside. This commit adds a tester that parses a sequence of source files and then uses them as source data for an expression. External references are resolved using an ExternalASTSource that responds to name queries using an ASTImporter. This is the setup that LLDB uses, and the motivating reason for MinimalImport in ASTImporter. When complete, this tester will implement the first of the above goals. Differential Revision: https://reviews.llvm.org/D27180 llvm-svn: 290004
* IRGen: Fix assertion failure when creating debug info for an integer ↵Peter Collingbourne2016-12-161-0/+8
| | | | | | constant wider than 64 bits. llvm-svn: 289996
* [libclang] Restore the CXXRecordDecl path for ↵Argyrios Kyrtzidis2016-12-162-5/+23
| | | | | | | | | clang_Type_getNumTemplateArguments and clang_Type_getTemplateArgumentAsType Patch by Emilio Cobos Álvarez! See https://reviews.llvm.org/D26907 llvm-svn: 289995
* Revert r289979 due to regressionsYaxun Liu2016-12-165-94/+12
| | | | llvm-svn: 289991
* [Sema] Transform the default arguments of a lambda expression when theAkira Hatanaka2016-12-161-1/+19
| | | | | | | | | | | | | | | | lambda expression is instantiated. Rather than waiting until Sema::CheckCXXDefaultArgExpr tries to transform the default arguments (which fails because it can't get the template arguments that are used), transform the default arguments earlier when the lambda expression is transformed in TransformLambdaExpr. rdar://problem/27535319 Differential Revision: https://reviews.llvm.org/D23096 llvm-svn: 289990
* [OpenMP] support the 'is_device_ptr' clause with 'target parallel' pragmaKelvin Li2016-12-162-0/+562
| | | | | | | | This patch is to add support of the 'is_device_ptr' clause in the 'target parallel' pragma. Differential Revision: https://reviews.llvm.org/D27821 llvm-svn: 289989
* Remove the temporary fix to the RUN line that was committed in r289924.Akira Hatanaka2016-12-161-5/+21
| | | | | | | Also, dump the AST and run FileCheck to make sure the expected nodes are created in the AST. llvm-svn: 289986
* Revert "Update for LLVM global variable debug info API change."Adrian Prantl2016-12-1612-65/+41
| | | | | | This reverts commit r289921. llvm-svn: 289984
* [OpenCL] Allow disabling types and declarations associated with extensionsYaxun Liu2016-12-165-12/+94
| | | | | | | | | | | | | | | | | | Added a map to associate types and declarations with extensions. Refactored existing diagnostic for disabled types associated with extensions and extended it to declarations for generic situation. Fixed some bugs for types associated with extensions. Allow users to use pragma to declare types and functions for supported extensions, e.g. #pragma OPENCL EXTENSION the_new_extension_name : begin // declare types and functions associated with the extension here #pragma OPENCL EXTENSION the_new_extension_name : end Differential Revision: https://reviews.llvm.org/D21698 llvm-svn: 289979
* [analyzer] Fix crash in MallocChecker.Devin Coughlin2016-12-161-0/+6
| | | | | | | | | | | | | Fix a crash in the MallocChecker when the extent size for the argument to new[] is not known. A patch by Abramo Bagnara and Dániel Krupp! https://reviews.llvm.org/D27849 Differential Revision: https://reviews.llvm.org/D27849 llvm-svn: 289970
* [analyzer] Add another exception for Qt in MallocCheckerArtem Dergachev2016-12-162-1/+24
| | | | | | | | | | Treat pointers passed to QObject::connectImpl() as escaping. rdar://problem/29550440 Differential Revision: https://reviews.llvm.org/D27717 llvm-svn: 289939
* attempt to fix bots after r289914/r289919Nico Weber2016-12-161-1/+5
| | | | llvm-svn: 289924
* Update for LLVM global variable debug info API change.Adrian Prantl2016-12-1612-41/+65
| | | | llvm-svn: 289921
* Remove "-disable-llvm-optzns -verify" from the RUN line.Akira Hatanaka2016-12-161-1/+1
| | | | llvm-svn: 289919
* [Sema] Fix handling of enumerators used as default arguments of lambdaAkira Hatanaka2016-12-161-0/+35
| | | | | | | | | | | | | | | | | expressions in a function or class template. This patch makes the following changes: - Create a DependentScopeDeclRefExpr for the default argument instead of a CXXDependentScopeMemberExpr. - Pass CombineWithOuterScope=true so that the outer scope in which the enum is declared is searched for the instantiation of the enum. This is the first part of https://reviews.llvm.org/D23096. Fixes PR28795 rdar://problem/27535319 llvm-svn: 289914
* Revert "Update for LLVM global variable debug info API change."Adrian Prantl2016-12-1612-65/+41
| | | | | | This reverts commit 289901 while investigating bot breakage. llvm-svn: 289908
* [c++1z] P0195R2: Allow multiple using-declarators in a single using-declaration.Richard Smith2016-12-162-1/+31
| | | | llvm-svn: 289905
OpenPOWER on IntegriCloud