summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* Revert "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand."Daniel Jasper2016-12-2014-124/+1
| | | | | | | | | | 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-202-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-2014-1/+124
| | | | | | | | | | | | 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-2016-1079/+205
| | | | | | | | | | | | | | | 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-207-20/+20
| | | | | | | | 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-202-0/+17
| | | | | | | | | | | | | | | | 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-2014-61/+93
| | | | | | This reapplies r289921. llvm-svn: 290155
* Add the alloc_size attribute to clang.George Burgess IV2016-12-2016-205/+1079
| | | | | | | | | | | | | | | | | | | | 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-197-16/+30
| | | | | | | | | | | | | | | | | | | | | * 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-196-0/+452
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-193-22/+48
| | | | | | | | | | | | | | 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-192-0/+50
| | | | | | | | | | | | | | | | | | | 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
* [Format] Remove dead code.Benjamin Kramer2016-12-194-31/+0
| | | | | | No functionality change. llvm-svn: 290135
* [ASTReader] Sort RawComments before mergingBruno Cardoso Lopes2016-12-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | `RawComments` are sorted by comparing underlying `SourceLocation`'s. This is done by comparing `FileID` and `Offset`; when the `FileID` is the same it means the locations are within the same TU and the `Offset` is used. FileID, from the source code: "A mostly-opaque identifier, where 0 is "invalid", >0 is this module, and <-1 is something loaded from another module.". That said, when de-serializing SourceLocations, FileID's from RawComments loaded from other modules get negative IDs where previously they were positive. This makes imported RawComments unsorted, leading to a wrong merge with other comments from the current TU. Fix that by sorting RawComments properly after de-serialization and before merge. This fixes an assertion in `ASTContext::getRawCommentForDeclNoCache`, which fires only in a debug build of clang. Differential Revision: https://reviews.llvm.org/D27546 rdar://problem/29287314 llvm-svn: 290134
* Add fix-it notes to the nullability consistency warning.Jordan Rose2016-12-1915-58/+220
| | | | | | | | | | | | | | | | | | | | | 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-1913-384/+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
* Revert another accidental bitPaul Robinson2016-12-191-2/+0
| | | | llvm-svn: 290125
* Undo accidental comitPaul Robinson2016-12-1913-244/+93
| | | | 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
* [libclang] Revert part of r290025, "Remove the 'extern "C"' blocks from the ↵NAKAMURA Takumi2016-12-192-0/+7
| | | | | | | | | | | | | | | | | | | | implementation files." mingw32-ld complains missing symbols in exports, Cannot export clang_findIncludesInFileWithBlock: symbol not defined Cannot export clang_findReferencesInFileWithBlock: symbol not defined Cannot export clang_visitChildrenWithBlock: symbol not defined They are excluded conditionally in header along has_blocks. We should do either; 1. Exclude also function bodies conditionally, and introduce "optional" exporter. 2. Give dummy function bodies for them. 3. Implement functions w/o blocks. llvm-svn: 290113
* [ARM] Add missing -backend-option for -arm-execute-onlyPrakhar Bahuguna2016-12-192-2/+3
| | | | llvm-svn: 290110
* clang-format: Slightly tweak the behavior of <<-wrapping.Daniel Jasper2016-12-193-3/+11
| | | | | | | | | | | | | | | Before: SomeLongLoggingStatementOrMacro() << "Some long text " << some_variable << "\n"; Before: SomeLongLoggingStatementOrMacro() << "Some long text " << some_variable << "\n"; Short logging statements are already special cased in a different part of the code. llvm-svn: 290094
* [clang-format] revert an unintended change in r288493 and add a test case.Eric Liu2016-12-192-1/+14
| | | | llvm-svn: 290093
* Revert "[c++1z] P0195R2: Support pack-expansion of using-declarations."Daniel Jasper2016-12-1926-793/+247
| | | | | | | 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
* clang-format: Fix regression introduced in r290084.Daniel Jasper2016-12-192-1/+9
| | | | | | | | | | | | | | | | | | | We still want to try in linewrap within single elements of a 1-column list. After: Type *Params[] = {PointerType::getUnqual(FunctionType::get( Builder.getVoidTy(), Builder.getInt8PtrTy(), false)), Builder.getInt8PtrTy(), Builder.getInt32Ty(), LongType, LongType, LongType}; Before: No line break in the first element, so column limit violation. llvm-svn: 290090
* clang-format: Allow "single column" list layout even if that violates theDaniel Jasper2016-12-192-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | column limit. Single-column layout basically means that we format the list with one element per line. Not doing that when there is a column limit violation doesn't change the fact that there is an item that doesn't fit within the column limit. Before (with a column limit of 30): std::vector<int> a = { aaaaaaaa, aaaaaaaa, aaaaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaa}; After: std::vector<int> a = { aaaaaaaa, aaaaaaaa, aaaaaaaa, aaaaaaaa, aaaaaaaaaa, aaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaa}; (and previously we would have formatted like "After" it wasn't for the one item that is too long) llvm-svn: 290084
* Add __cpp_structured_bindings feature test macro for structured bindings, perRichard Smith2016-12-192-1/+6
| | | | | | latest (provisional) draft of SD-6. llvm-svn: 290082
* [c++1z] cxx_status: mark p0195r2 as done.Richard Smith2016-12-193-3/+7
| | | | llvm-svn: 290081
* [c++1z] P0195R2: Support pack-expansion of using-declarations.Richard Smith2016-12-1926-247/+793
| | | | | | | | | | | 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-183-39/+49
| | | | | | using-declarations. llvm-svn: 290072
* Fix some interactions between C++11 and C++14 features and using-declarations:Richard Smith2016-12-187-47/+244
| | | | | | | | | | | * 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
* Wdocumentation fixSimon Pilgrim2016-12-181-1/+1
| | | | llvm-svn: 290063
* 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
* Attempt to fix build failure and regressions due to r290056Yaxun Liu2016-12-183-11/+11
| | | | | | | Add llvm:: namespace to StringRef. Make conversion between bool and uint64_t explicit. llvm-svn: 290058
* Recommit r289979 [OpenCL] Allow disabling types and declarations associated ↵Yaxun Liu2016-12-1829-275/+666
| | | | | | | | 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-1741-35/+3323
| | | | | | | | This patch is to implement sema and parsing for 'target teams' pragma. Differential Revision: https://reviews.llvm.org/D27818 llvm-svn: 290038
* [libclang] Remove the 'extern "C"' blocks from the implementation files.Argyrios Kyrtzidis2016-12-1716-119/+3
| | | | | | | These are unnecessary, the declarations already carry the 'extern C' property, and if there is mismatch between declaration and definition then we will get linker errors via libclang.exports. llvm-svn: 290025
* [analyzer] UnixAPIChecker: Don't diagnose for functions in C++ namespacesDevin Coughlin2016-12-172-0/+68
| | | | | | | | | | 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
* Added clangLex to the dependencies for clang-import-test.Sean Callanan2016-12-161-0/+1
| | | | | | This is part of the effort to get the i686-mingw32-RA-on-linux bot to like clang-import-test. llvm-svn: 290010
* Fix MSVC build of libclang after r288438Reid Kleckner2016-12-161-39/+39
| | | | llvm-svn: 290009
* Add explicit triple to test to fix arm bots.Peter Collingbourne2016-12-161-1/+1
| | | | llvm-svn: 290008
* Fixed library dependencies on clang-import-test to clean up the bots.Sean Callanan2016-12-161-0/+2
| | | | llvm-svn: 290006
* [analyzer] Extend UnixAPIChecker open() checks to handle openat().Devin Coughlin2016-12-163-1831/+2143
| | | | | | | | | 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-1613-0/+381
| | | | | | | | | | | | | | | | | | | | 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
* Really revert all changes from r289979. Apparently conflict resolution failedReid Kleckner2016-12-161-76/+35
| | | | llvm-svn: 289997
* IRGen: Fix assertion failure when creating debug info for an integer ↵Peter Collingbourne2016-12-162-6/+17
| | | | | | constant wider than 64 bits. llvm-svn: 289996
OpenPOWER on IntegriCloud