summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
Commit message (Collapse)AuthorAgeFilesLines
...
* Disable warning about core features by defaultJan Vesely2016-06-011-1/+1
| | | | | | | | Reviewers: Anastasia, yaxunl Differential Revision: http://reviews.llvm.org/D20744 llvm-svn: 271414
* [Parser] Fix look ahead after EOF while parsing objc message and lambdasBruno Cardoso Lopes2016-05-311-0/+11
| | | | | | | | | | | | | If a closing ')' isn't found for a macro instantiation inside a '[', the next token is EOF, this leads to crashes if we try to look ahead of that. This could be triggered whenever trying to parse lambdas or objs message expressions. Differential Revision: http://reviews.llvm.org/D20451 rdar://problem/25662647 llvm-svn: 271314
* [OpenCL] Add supported OpenCL extensions to target info.Yaxun Liu2016-05-164-15/+17
| | | | | | | | | | Add supported OpenCL extensions to target info. It serves as default values to save the users of the burden setting each supported extensions and optional core features in command line. Re-commit after fixing build error due to missing override attribute. Differential Revision: http://reviews.llvm.org/D19484 llvm-svn: 269670
* Warn when a reference is bound to an empty l-value (dereferenced null pointer).Nick Lewycky2016-05-141-1/+1
| | | | llvm-svn: 269572
* Revert "[OpenCL] Add supported OpenCL extensions to target info."Yaxun Liu2016-05-134-17/+15
| | | | | | | | | Revert r269431 due to build failure caused by warning msg: llvm/tools/clang/lib/Basic/Targets.cpp:2090:9: error: 'setSupportedOpenCLOpts' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override] void setSupportedOpenCLOpts() { llvm-svn: 269435
* [OpenCL] Add supported OpenCL extensions to target info.Yaxun Liu2016-05-134-15/+17
| | | | | | | | Add supported OpenCL extensions to target info. It serves as default values to save the users of the burden setting each supported extensions and optional core features in command line. Differential Revision: http://reviews.llvm.org/D19484 llvm-svn: 269431
* [OpenCL] Output OpenCL version in diagnostics.Anastasia Stulova2016-05-122-10/+10
| | | | | | | | | | | | | | Diagnostics should note version dependent issues by giving a hint about current version being compiled for. This patch changes diagnostics of static storage class specifier and generic type qualifier to specify OpenCL version as well as converts other diagnostics to match the style. Patch by Vedran Miletic! Review: http://reviews.llvm.org/D19780 llvm-svn: 269305
* Expose cxx constructor and method properties through libclang and python ↵Jonathan Coe2016-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | bindings. Summary: I have exposed the following function through libclang and the clang.cindex python bindings: clang_CXXConstructor_isConvertingConstructor, clang_CXXConstructor_isCopyConstructor, clang_CXXConstructor_isDefaultConstructor, clang_CXXConstructor_isMoveConstructor, clang_CXXMethod_isDefaulted I need (some of) these methods for a C++ code model I am building in Python to drive a code generator. Reviewers: compnerd, skalinichev Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15469 llvm-svn: 267706
* Add a test case to check a member's default constructor is also run.Akira Hatanaka2016-04-191-0/+4
| | | | | | This is a follow-up to r266645. llvm-svn: 266706
* [Parser][ObjC] Make sure c++11 in-class initialization is done when theAkira Hatanaka2016-04-181-0/+17
| | | | | | | | | | | | | | | | | | | | constructor's definition is in an implementation block. Without this commit, ptr doesn't get initialized to null in the following code: struct S { S(); void *ptr = nullptr; }; @implementation I S::S() {} @end rdar://problem/25693624 llvm-svn: 266645
* Lit C++11 Compatibility Patch #8Charles Li2016-04-143-20/+113
| | | | | | 24 tests have been updated for C++11 compatibility. llvm-svn: 266387
* ObjC class properties: add diagnostics for unimplemented class properties.Manman Ren2016-04-121-1/+0
| | | | | | rdar://24711047 llvm-svn: 266146
* Diagnose missing macro argument following charize operator.Andy Gibbs2016-04-011-0/+3
| | | | | | | For completeness, add a test-case for the equivalent stringize operator diagnostic too. llvm-svn: 265177
* [Cxx1z-constexpr-lambda-P0170R1] Support parsing of constexpr specifier ↵Faisal Vali2016-03-261-0/+31
| | | | | | | | | | | | | | | | | | | | | | (and its inference) on lambda expressions Support the constexpr specifier on lambda expressions - and support its inference from the lambda call operator's body. i.e. auto L = [] () constexpr { return 5; }; static_assert(L() == 5); // OK auto Implicit = [] (auto a) { return a; }; static_assert(Implicit(5) == 5); We do not support evaluation of lambda's within constant expressions just yet. Implementation Strategy: - teach ParseLambdaExpressionAfterIntroducer to expect a constexpr specifier and mark the invented function call operator's declarator's decl-specifier with it; Have it emit fixits for multiple decl-specifiers (mutable or constexpr) in this location. - for cases where constexpr is not explicitly specified, have buildLambdaExpr check whether the invented function call operator satisfies the requirements of a constexpr function, by calling CheckConstexprFunctionDecl/Body. Much obliged to Richard Smith for his patience and his care, in ensuring the code is clang-worthy. llvm-svn: 264513
* The time when -faltivec (or, on clang only, -maltivec) will magicallyEric Christopher2016-03-241-0/+1
| | | | | | | | | include altivec.h has come and gone. Rationale: This causes modules, rewrite-includes, etc to be sad and people should just include altivec.h in their source. llvm-svn: 264235
* clang-cl: support __cdecl-on-struct anachronismReid Kleckner2016-03-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | Summary: The Microsoft compiler emits warning C4229: anachronism used : modifiers on data are ignored for struct {} __cdecl s; but ICU's gendict can generate such (and does when building LibreOffice), so accepting this in clang-cl too would be useful. Reviewers: rnk Patch by Stephan Bergmann Differential Revision: http://reviews.llvm.org/D16628 llvm-svn: 263947
* Silence duplicate diagnostics because parsing of a standards-based attribute ↵Aaron Ballman2016-03-081-1/+0
| | | | | | triggers parsing diagnostics that may also be picked up during semantic analysis. llvm-svn: 262960
* P0188R1: add support for standard [[fallthrough]] attribute. This is almostRichard Smith2016-03-081-1/+13
| | | | | | | | | | | | | | exactly the same as clang's existing [[clang::fallthrough]] attribute, which has been updated to have the same semantics. The one significant difference is that [[fallthrough]] is ill-formed if it's not used immediately before a switch label (even when -Wimplicit-fallthrough is disabled). To support that, we now build a CFG of any function that uses a '[[fallthrough]];' statement to check. In passing, fix some bugs with our support for statement attributes -- in particular, diagnose their use on declarations, rather than asserting. llvm-svn: 262881
* [ms-inline-asm][AVX512] Add ability to use k registers in MS inline asm + ↵Marina Yatsina2016-03-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | fix bag with curly braces Until now curly braces could only be used in MS inline assembly to mark block start/end. All curly braces were removed completely at a very early stage. This approach caused bugs like: "m{o}v eax, ebx" turned into "mov eax, ebx" without any error. In addition, AVX-512 added special operands (e.g., k registers), which are also surrounded by curly braces that mark them as such. Now, we need to keep the curly braces and identify at a later stage if they are marking block start/end (if so, ignore them), or surrounding special AVX-512 operands (if so, parse them as such). This patch fixes the bug described above and enables the use of AVX-512 special operands. This commit is the the clang part of the patch. The clang part of the review is: http://reviews.llvm.org/D17766 The llvm part of the review is: http://reviews.llvm.org/D17767 Differential Revision: http://reviews.llvm.org/D17766 llvm-svn: 262842
* [OpenCL] Improve diagnostics of address spaces for variables in functionAnastasia Stulova2016-03-031-2/+2
| | | | | | | | | - Prevent local variables to be declared in global AS - Diagnose AS of local variables with an extern storage class as if they would be in a program scope Review: http://reviews.llvm.org/D17345 llvm-svn: 262641
* [OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttrXiuli Pan2016-02-261-2/+7
| | | | | | | | | | | | | | | Summary: OpenCL access qualifiers are now not only used for image types, refine it to avoid misleading, Add semacheck for OpenCL access qualifier as well as test caees. Reviewers: pekka.jaaskelainen, Anastasia, aaron.ballman Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D16040 llvm-svn: 261961
* [ms-inline-asm] Fixing bug in single asm statement supportMarina Yatsina2016-02-231-1/+1
| | | | | | | | | | | | | | Fixing a crash caused by trying to merge a single-line asm statement with an asm block that follows it, e.g: asm int 4 asm { int 5 } Now, only adjacent single-line asm statements that are not surrounded by braces will be merged into one asm call. Differential Revision: http://reviews.llvm.org/D17496 llvm-svn: 261618
* [OpenCL] Generate metadata for opencl_unroll_hint attributeAnastasia Stulova2016-02-191-0/+8
| | | | | | | | | | | | | | | Add support for opencl_unroll_hint attribute from OpenCL v2.0 s6.11.5. Reusing most of metadata generation from CGLoopInfo helper class. The code is based on Khronos OpenCL compiler: https://github.com/KhronosGroup/SPIR/tree/spirv-1.0 Patch by Liu Yaxun (Sam)! Differential Revision: http://reviews.llvm.org/D16686 llvm-svn: 261350
* [Parser] Perform CachedTokens update dependent on token consumptionBruno Cardoso Lopes2016-02-051-0/+15
| | | | | | | | | | | | | | In the context where we break one tok::greatergreater into two tok::greater in order to correctly update the cached tokens; update the CachedTokens with two tok::greater only if ParseGreaterThanInTemplateList clients asks to consume the last token. Otherwise we only need to add one because the second is already added later on, as a not yet cached token. Differential Revision: http://reviews.llvm.org/D16906 rdar://problem/24488367 llvm-svn: 259910
* PR23057: fix use-after-free due to local token buffer in ↵Alexey Bataev2016-02-041-0/+9
| | | | | | | | | | ParseCXXAmbiguousParenExpression, by Dmitry Polukhin Differential Revision: http://reviews.llvm.org/D16572 A test/Parser/cxx-ambig-paren-expr-asan.cpp M lib/Parse/ParseExprCXX.cpp llvm-svn: 259750
* Fix regression from r259622: the operand of an increment that is the operand ofRichard Smith2016-02-031-0/+1
| | | | | | | a cast expression is not the operand of a cast expression itself, so if it's parenthesized we need to form a ParenExpr not a ParenListExpr. llvm-svn: 259677
* Fix miscompile and rejects-valids when disambiguating after an ambiguousRichard Smith2016-02-031-2/+7
| | | | | | | C-style-cast to function/array type or parenthesized function-style cast/array indexing. llvm-svn: 259622
* Fix rejects-valid when forming a pointer-to-member with 'decltype(expr)::*'.Richard Smith2016-02-021-0/+2
| | | | llvm-svn: 259604
* PR23057: Fix assertion `Val && "isa<> used on a null pointer"' on invalid ↵Denis Zobnin2016-02-021-0/+18
| | | | | | | | | | | for-range expression. Fix the issue discovered by fuzzing (PR23057, comment 18) by handling nullptr in Sema::ActOnCXXForRangeDecl and correct delayed typos in for-range expression before calling Sema::ActOnCXXForRangeStmt. Also fixes PR26288. Differential Revision: http://reviews.llvm.org/D16630 llvm-svn: 259532
* [Parser] Update CachedTokens while parsing ObjectiveC template argument listBruno Cardoso Lopes2016-01-311-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider the following ObjC++ snippet: -- @protocol PA; @protocol PB; @class NSArray<ObjectType>; typedef int some_t; id<PA> FA(NSArray<id<PB>> *h, some_t group); -- This would hit an assertion in the parser after generating an annotation token while trying to update the token cache: Assertion failed: (CachedTokens[CachedLexPos-1].getLastLoc() == Tok.getAnnotationEndLoc() && "The annotation should be until the most recent cached token") ... 7 clang::Preprocessor::AnnotatePreviousCachedTokens(clang::Token const&) + 494 8 clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(bool, bool, clang::CXXScopeSpec&, bool) + 1163 9 clang::Parser::TryAnnotateTypeOrScopeToken(bool, bool) + 361 10 clang::Parser::isCXXDeclarationSpecifier(clang::Parser::TPResult, bool*) + 598 ... The cached preprocessor token in this case is: greatergreater '>>' Loc=<testcase.mm:7:24> while the annotation ("NSArray<id<PB>>") ends at "testcase.mm:7:25", hence the assertion. Properly update the CachedTokens during template parsing to contain two greater tokens instead of a greatergreater. Differential Revision: http://reviews.llvm.org/D15173 rdar://problem/23494277 llvm-svn: 259311
* Class Property: parse property attribute (class).Manman Ren2016-01-261-0/+30
| | | | | | | | | This is the third patch in a series of patches to support class properties in addition to instance properties in objective-c. rdar://23891898 llvm-svn: 258834
* Fix infinite loop when ::new or ::delete are found in member initializer ↵Alexey Bataev2016-01-201-0/+42
| | | | | | | | | list, by Denis Zobnin Fix for an infinite loop on parsing ::new or ::delete in member initializer list, found by fuzzing PR23057, comment #33. Skip the rest of the member initializers if the previous initializer was invalid. Differential Revision: http://reviews.llvm.org/D16216 llvm-svn: 258290
* Fix several accidental DOS line endings in source filesDimitry Andric2016-01-031-14/+14
| | | | | | | | | | | | | | | Summary: There are a number of files in the tree which have been accidentally checked in with DOS line endings. Convert these to native line endings. There are also a few files which have DOS line endings on purpose, and I have set the svn:eol-style property to 'CRLF' on those. Reviewers: joerg, aaron.ballman Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D15849 llvm-svn: 256704
* Fix crash-on-invalid if a :: is followed by two or more open parentheses ↵Richard Smith2015-12-191-5/+5
| | | | | | (and then something else). llvm-svn: 256080
* [Lit Test] Updated 20 Lit tests to be C++11 compatible.Charles Li2015-12-106-25/+111
| | | | | | | | This is the 5th Lit test patch. Expanded expected diagnostics to vary by C++ dialect. Expanded RUN line to: default, C++98/03 and C++11. llvm-svn: 255196
* [coroutines] Factor out co_await representation into common base class for ↵Richard Smith2015-11-221-1/+1
| | | | | | co_await and co_yield, and use it to hold await_* calls. llvm-svn: 253811
* N3922: direct-list-initialization of an auto-typed variable no longer deduces aRichard Smith2015-11-112-2/+2
| | | | | | | | | | | | | | | | | | | std::initializer_list<T> type. Instead, the list must contain a single element and the type is deduced from that. In Clang 3.7, we warned by default on all the cases that would change meaning due to this change. In Clang 3.8, we will support only the new rules -- per the request in N3922, this change is applied as a Defect Report against earlier versions of the C++ standard. This change is not entirely trivial, because for lambda init-captures we previously did not track the difference between direct-list-initialization and copy-list-initialization. The difference was not previously observable, because the two forms of initialization always did the same thing (the elements of the initializer list were always copy-initialized regardless of the initialization style used for the init-capture). llvm-svn: 252688
* [coroutines] Creation of promise object, lookup of operator co_await, buildingRichard Smith2015-10-271-1/+1
| | | | | | of await_* calls, and AST representation for same. llvm-svn: 251387
* [coroutines] Add overloaded unary 'operator co_await'.Richard Smith2015-10-221-0/+14
| | | | llvm-svn: 250991
* [coroutines] Add parsing support for co_await expression, co_yield expression,Richard Smith2015-10-221-0/+21
| | | | | | co_await modifier on range-based for loop, co_return statement. llvm-svn: 250985
* [Sema] Tweak incomplete enum types on MSVC ABI targetsDavid Majnemer2015-10-081-1/+1
| | | | | | | | | Enums without an explicit, fixed, underlying type are implicitly given a fixed 'int' type for ABI compatibility with MSVC. However, we can enforce the standard-mandated rules on these types as-if we didn't know this fact if the tag is not part of a definition. llvm-svn: 249667
* Update tests touched by r249656David Majnemer2015-10-081-1/+1
| | | | | | | | | These test updates almost exclusively around the change in behavior around enum: enums without a definition are considered incomplete except when targeting MSVC ABIs. Since these tests are interested in the 'incomplete-enum' behavior, restrict them to %itanium_abi_triple. llvm-svn: 249660
* When pretty-printing a C++11 literal operator, don't insert whitespace betweenRichard Smith2015-10-081-7/+7
| | | | | | | the "" and the suffix; that breaks names such as 'operator""if'. For symmetry, also remove the space between the 'operator' and the '""'. llvm-svn: 249641
* [OpenCL 2.0] Enable program scope variables, Section 6.5.1.Anastasia Stulova2015-09-301-1/+1
| | | | | | | | | | | | | | | | | | - Remove virtual SC_OpenCLWorkGroupLocal storage type specifier as it conflicts with static local variables now and prevents diagnosing static local address space variables correctly. - Allow static local and global variables (OpenCL2.0 s6.8 and s6.5.1). - Improve diagnostics of allowed ASes for variables in different scopes: (i) Global or static local variables have to be in global or constant ASes (OpenCL1.2 s6.5, OpenCL2.0 s6.5.1); (ii) Non-kernel function variables can't be declared in local or constant ASes (OpenCL1.1 s6.5.2 and s6.5.3). http://reviews.llvm.org/D13105 llvm-svn: 248906
* [OpenCL 2.0] This change adds extra diagnostics to atomic typesAnastasia Stulova2015-09-301-0/+13
| | | | | | | | | Applied restrictions from OpenCL v2.0 s6.13.11.8 that mainly disallow operations on atomic types (except for taking their address - &). The patch is taken from SPIR2.0 provisional branch, contributed by Guy Benyei! llvm-svn: 248896
* [OpenCL 2.0] Fix wrong atomic type detection in the diagnostics of allowed typesAnastasia Stulova2015-09-301-3/+3
| | | | llvm-svn: 248891
* Windows ARM: ignore calling conventions as described on MSDNMartell Malone2015-08-142-3/+11
| | | | | | | | | | | | | | | | | | Summary: MSDN says that fastcall, stdcall, thiscall, and vectorcall are all accepted but ignored on ARM and X64. https://msdn.microsoft.com/en-us/library/984x0h58.aspx MSDN also says cdecl is also accepted and typically ignored This patch brings ARM in line with how we ignore them for X64 Reviewers: rnk Subscribers: compnerd, cfe-commits Differential Revision: http://reviews.llvm.org/D12034 llvm-svn: 245076
* Add new llvm.loop.unroll.enable metadata for use with "#pragma unroll".Mark Heffernan2015-08-103-5/+11
| | | | | | | | | | | | | | | | | | | | | | This change adds the new unroll metadata "llvm.loop.unroll.enable" which directs the optimizer to unroll a loop fully if the trip count is known at compile time, and unroll partially if the trip count is not known at compile time. This differs from "llvm.loop.unroll.full" which explicitly does not unroll a loop if the trip count is not known at compile time With this change "#pragma unroll" generates "llvm.loop.unroll.enable" rather than "llvm.loop.unroll.full" metadata. This changes the semantics of "#pragma unroll" slightly to mean "unroll aggressively (fully or partially)" rather than "unroll fully or not at all". The motivating example for this change was some internal code with a loop marked with "#pragma unroll" which only sometimes had a compile-time trip count depending on template magic. When the trip count was a compile-time constant, everything works as expected and the loop is fully unrolled. However, when the trip count was not a compile-time constant the "#pragma unroll" explicitly disabled unrolling of the loop(!). Removing "#pragma unroll" caused the loop to be unrolled partially which was desirable from a performance perspective. llvm-svn: 244467
* [Concepts] Add diagnostic: non template declarationHubert Tong2015-07-301-3/+1
| | | | | | | | | | | | | | | | Summary: Adding diagnostic for concepts declared as non template (function or variable) Reviewers: faisalv, fraggamuffin, rsmith, hubert.reinterpretcast Subscribers: nwilson, cfe-commits Differential Revision: http://reviews.llvm.org/D11490 Patch by Nathan Wilson! llvm-svn: 243690
* Fix crash-on-invalid: don't look ahead past an unknown token, it might be EOF.Richard Smith2015-07-211-0/+4
| | | | llvm-svn: 242744
OpenPOWER on IntegriCloud