summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* PR19748: Make sure we don't lose colon protection after the parenthesized ↵Richard Smith2014-05-151-10/+7
| | | | | | type-id in a cast-expression. llvm-svn: 208843
* Wrap a few lines at 80 columns, change a confusing indent. No behavior change.Nico Weber2014-05-031-3/+5
| | | | llvm-svn: 207921
* Add support for MSVC's __FUNCSIG__Reid Kleckner2014-04-081-0/+1
| | | | | | | | | | | It is very similar to GCC's __PRETTY_FUNCTION__, except it prints the calling convention. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D3311 llvm-svn: 205780
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-1/+1
| | | | | | class. llvm-svn: 203641
* [cleanup] Re-sort includes with llvm/utils/sort_includes.py and fixChandler Carruth2014-03-041-1/+1
| | | | | | | | | | | | a missing include from CLog.h. CLog.h referenced most of the core libclang types but never directly included Index.h that provides them. Previously it got lucky and other headers were always included first but with the sorting it ended up first in one case and stopped compiling. Adding the Index.h include fixes it right up. llvm-svn: 202810
* Fix for PR9812: warn about bool instead of _Bool.Erik Verbruggen2014-01-151-2/+5
| | | | llvm-svn: 199311
* Fixed error recovery if sizeof is used without parenthesisSerge Pavlov2014-01-151-2/+1
| | | | | | | | | | | Changes made in r192200 fixed PR16992, which requested fixit suggesting parenthesis if sizeof is followed by type-id. However expression in form T() followed by ')' was incorrectly considered as a type-id if 'T' is typedef name. This change fixes this case. Differential Revision: http://llvm-reviews.chandlerc.com/D2440 llvm-svn: 199284
* Use token kind instead of '%select{.|->}0' in diagnosticAlp Toker2014-01-061-2/+2
| | | | llvm-svn: 198599
* ExpectAndConsume: Diagnose errors automaticallyAlp Toker2014-01-011-19/+27
| | | | | | | | | | | | | | 1) Teach ExpectAndConsume() to emit expected and expected-after diagnostics using the generic diagnostic descriptions added in r197972, eliminating another set of trivial err_expected_* variations while maintaining existing behaviour. 2) Lift SkipUntil() recovery out of ExpectAndConsume(). The Expect/Consume family of functions are primitive parser operations that now have the well-defined property of operating on single tokens. Factoring out recovery exposes opportunities for more consistent and tailored error recover at the call sites instead of just relying on a bottled SkipUntil formula. llvm-svn: 198270
* Switch over more of the parser to err_expectedAlp Toker2013-12-301-3/+3
| | | | | | | Includes a fix for a missing highlight range caused by a ',' typo in the PP diagnostics. llvm-svn: 198252
* Support and use token kinds as diagnostic argumentsAlp Toker2013-12-241-13/+14
| | | | | | | | | | | | | | | | | | | Introduce proper facilities to render token spellings using the diagnostic formatter. Replaces most of the hard-coded diagnostic messages related to expected tokens, which all shared the same semantics but had to be multiply defined due to variations in token order or quote marks. The associated parser changes are largely mechanical but they expose commonality in whole chunks of the parser that can now be factored away. This commit uses C++11 typed enums along with a speculative legacy fallback until the transition is complete. Requires corresponding changes in LLVM r197895. llvm-svn: 197972
* Remove OpenCL-specific type keywords and specifiersAlp Toker2013-12-181-9/+1
| | | | | | | | | | | | | | | This commit kills off custom type specifier and keyword handling of OpenCL C data types. Although the OpenCL spec describes them as keywords, we can handle them more elegantly as predefined types. This should provide better error correction and code completion as well as simplifying the implementation. The primary intention is however to simplify the C/C++ parser and save some packed bits on AST structures that had been extended in r170432 just for OpenCL. llvm-svn: 197578
* Refactor and micro-optimize ConsumeToken()Alp Toker2013-12-171-13/+5
| | | | | | | | | | | | 1) Introduce TryConsumeToken() to handle the common test-and-consume pattern. This brings about readability improvements in the parser and optimizes to avoid redundant checks in the common case. 2) Eliminate the ConsumeCodeCompletionTok special case from ConsumeToken(). This was used by only one caller which has been switched over to the more appropriate ConsumeCodeCompletionToken() function. llvm-svn: 197497
* Simplify RevertibleTypeTraits as a form of contextual keywordAlp Toker2013-12-171-42/+5
| | | | | | | | | | | Now that we emit diagnostics for keyword-as-identifier hacks (-Wkeyword-compat) we can go ahead and simplify some of the old revertible keyword support. This commit adds a TryIdentKeywordUpgrade() function to mirror the recently added TryKeywordIdentFallback() and uses it to replace the hard-coded list of REVERTIBLE_TYPE_TRAITs. llvm-svn: 197496
* Unify type trait parsingAlp Toker2013-12-121-59/+3
| | | | | | | | | | | | | | | | | Type trait parsing is all over the place at the moment with unary, binary and n-ary C++11 type traits that were developed independently at different points in clang's history. There's no good reason to handle them separately -- there are three parsers, three AST nodes and lots of duplicated handling code with slightly different implementations and diags for each kind. This commit unifies parsing of type traits and sets the stage for further consolidation. No change in behaviour other than more consistent error recovery. llvm-svn: 197179
* Fix code typos spotted while working on type traitsAlp Toker2013-12-061-23/+23
| | | | llvm-svn: 196587
* Replaced bool parameters in SkipUntil function with single bit-based parameter.Alexey Bataev2013-11-181-22/+22
| | | | llvm-svn: 194994
* [-fms-extensions] Add support for __FUNCDNAME__David Majnemer2013-11-061-0/+3
| | | | | | | | | | | | | | | | Summary: Similar to __FUNCTION__, MSVC exposes the name of the enclosing mangled function name via __FUNCDNAME__. This implementation is very naive and unoptimized, it is expected that __FUNCDNAME__ would be used rarely in practice. Reviewers: rnk, rsmith, thakis CC: cfe-commits, silvas Differential Revision: http://llvm-reviews.chandlerc.com/D2109 llvm-svn: 194181
* Revert "Try to correct a mistyped "-" or ">" to "->" for some C++ cases."Kaelyn Uhrain2013-11-051-40/+0
| | | | | | | Revert this patch until cases of rejected valid code (e.g. identifiers that require ADL to be resolved properly) are fixed. llvm-svn: 194088
* Try to correct a mistyped "-" or ">" to "->" for some C++ cases.Kaelyn Uhrain2013-11-041-0/+40
| | | | | | | | | | | | Similar C code isn't caught as it seems to hit a different code path. Also, as the check is only done for record pointers, cases involving an overloaded operator-> are not handled either. Note that the reason this check is done in the parser instead of Sema is not related to having enough knowledge about the current state as it is about being able to fix up the parser's state to be able to recover and traverse the correct code paths. llvm-svn: 194002
* sizeof... a parameter pack should be an unevaluated context.Faisal Vali2013-10-311-0/+3
| | | | | | | | | - can't think of a way to test this without generic lambda captures, but will include a test once that patch is made commit-ready. patch was ok'd by Doug. http://llvm-reviews.chandlerc.com/D2029 llvm-svn: 193757
* [-fms-extensions] Permit 'override' in C++98 and 'sealed' as a synonym for ↵David Majnemer2013-10-181-0/+2
| | | | | | | | | | | | | | 'final' Summary: Some MS headers use these features. Reviewers: rnk, rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1948 llvm-svn: 192936
* Parser: Avoid a crash-on-invalid when trying to diagnose function calls with ↵Benjamin Kramer2013-10-101-2/+1
| | | | | | | | -> in it. Use the existing convenience function. llvm-svn: 192347
* Make wording for certain invalid unary expressions more consistent.David Majnemer2013-10-091-1/+1
| | | | | | | | | | An invalid decltype expression like 'decltype int' gives: error: expected '(' after 'decltype' This makes it so 'sizeof int' gives a similar one: error: expected parentheses around type name in sizeof expression llvm-svn: 192258
* Fixed grammar. Thanks to Jordan Rose.Serge Pavlov2013-10-081-1/+1
| | | | llvm-svn: 192204
* Add fixits suggesting parenthesis around type name in expressions like sizeof.Serge Pavlov2013-10-081-0/+22
| | | | | | This fixes PR16992 - Fixit missing when "sizeof type" found. llvm-svn: 192200
* Parse: Move simple-type-specifier sanity check earlierDavid Majnemer2013-09-221-4/+5
| | | | | | No functional change, just makes the error handling a bit more obvious. llvm-svn: 191162
* Parse: Don't crash during parsing if we lack a simple-type-specifierDavid Majnemer2013-09-221-0/+5
| | | | | | | | | | | | | | | | | Summary: Parsing cast expressions during error recovery can put us in a bad state. Check to see if the token for a simple-type-specifier makes sense before further parsing. Fixes PR17255. Reviewers: rsmith, doug.gregor, CornedBee, eli.friedman CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1696 llvm-svn: 191159
* Add the intrinsic __builtin_convertvectorHal Finkel2013-09-181-0/+29
| | | | | | | | | | | | | | | | | | LLVM supports applying conversion instructions to vectors of the same number of elements (fptrunc, fptosi, etc.) but there had been no way for a Clang user to cause such instructions to be generated when using builtin vector types. C-style casting on vectors is already defined in terms of bitcasts, and so cannot be used for these conversions as well (without leading to a very confusing set of semantics). As a result, this adds a __builtin_convertvector intrinsic (patterned after the OpenCL __builtin_astype intrinsic). This is intended to aid the creation of vector intrinsic headers that create generic IR instead of target-dependent intrinsics (in other words, this is a generic _mm_cvtepi32_ps). As noted in the documentation, the action of __builtin_convertvector is defined in terms of the action of a C-style cast on each vector element. llvm-svn: 190915
* Fix Altivec vector literal parser hack for C++11.Eli Friedman2013-08-131-2/+28
| | | | | | | It doesn't make any sense to accept "..." in the argument to a C-style cast, so use a separate expression list parsing routine which rejects it. PR16874. llvm-svn: 188330
* Fix misindentation.Richard Smith2013-08-121-11/+11
| | | | llvm-svn: 188151
* Change cxx0x to cxx11 in diagnostic name.Craig Topper2013-07-141-1/+1
| | | | llvm-svn: 186286
* Provide a better diagnostic and a fixit for a '.' or '->' before the left parenKaelyn Uhrain2013-07-121-1/+13
| | | | | | | | of a function call. This fixes PR5898 and means we now have a better diagnostic here than GCC. llvm-svn: 186208
* Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko2013-05-051-2/+1
| | | | | | | | constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
* Implement C++1y decltype(auto).Richard Smith2013-04-261-1/+7
| | | | llvm-svn: 180610
* Objective-C arc [qui]. Don't issue the bridge castFariborz Jahanian2013-04-021-6/+10
| | | | | | | | warning when doing a __bride cast in non-arc mode (which has no retain count effect). // rdar://13514210 llvm-svn: 178592
* Implement compiler intrinsics needed for compatibility with MSVC 2012 ↵Joao Matos2013-03-271-0/+3
| | | | | | | | <type_traits>. Patch by me and Ryan Molden. llvm-svn: 178111
* Add OpenCL samplers as Clang builtin types and check sampler related ↵Guy Benyei2013-02-071-0/+1
| | | | | | restrictions. llvm-svn: 174601
* Micro change: moved '{' for better readability (+don't confuse ↵Alexander Kornienko2013-02-011-5/+5
| | | | | | -Wimplicit-fallthrough) llvm-svn: 174202
* Produce a diagnostic if alignas is applied to an expression. Neither C11 norRichard Smith2013-01-291-3/+6
| | | | | | C++11 allows that. llvm-svn: 173789
* Implement OpenCL event_t as Clang builtin type, including event_t related ↵Guy Benyei2013-01-201-0/+1
| | | | | | OpenCL restrictions (OpenCL 1.2 spec 6.9) llvm-svn: 172973
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-5/+5
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-8/+8
| | | | llvm-svn: 171367
* Move operator precedence calculation to new headerDaniel Jasper2012-12-201-61/+0
| | | | | | | Thereby, it can be reused by clang-format and others. Review: http://llvm-reviews.chandlerc.com/D229 llvm-svn: 170757
* Re-commit r170428 changes with Linux style file endings.Guy Benyei2012-12-181-1/+7
| | | | | | Add OpenCL images as clang builtin types. llvm-svn: 170432
* Revert changes from r170428, as I accidentally changed the line endings of ↵Guy Benyei2012-12-181-7/+1
| | | | | | these files to Windows style. llvm-svn: 170431
* Add OpenCL images as clang builtin types.Guy Benyei2012-12-181-1/+7
| | | | llvm-svn: 170428
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-4/+4
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Fixed FunctionTypeLoc source range.Abramo Bagnara2012-10-041-12/+22
| | | | llvm-svn: 165259
* Fix an edge case of mangling involving the combination of a lambda and typeid.Eli Friedman2012-09-261-1/+2
| | | | | | | | | | | | | typeid (and a couple other non-standard places where we can transform an unevaluated expression into an evaluated expression) is special because it introduces an an expression evaluation context, which conflicts with the mechanism to compute the current lambda mangling context. PR12123. I would appreciate if someone would double-check that we get the mangling correct with this patch. llvm-svn: 164658
OpenPOWER on IntegriCloud