summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [c++1z] Support for u8 character literals.Richard Smith2014-11-081-0/+1
| | | | llvm-svn: 221576
* [c++1z] N4295: fold-expressions.Richard Smith2014-11-081-2/+81
| | | | | | | | | | | | | | | | This is a new form of expression of the form: (expr op ... op expr) where one of the exprs is a parameter pack. It expands into (expr1 op (expr2onwards op ... op expr)) (and likewise if the pack is on the right). The non-pack operand can be omitted; in that case, an empty pack gives a fallback value or an error, depending on the operator. llvm-svn: 221573
* Pass around CorrectionCandidateCallbacks as unique_ptrs soKaelyn Takata2014-10-271-4/+4
| | | | | | TypoCorrectionConsumer can keep the callback around as long as needed. llvm-svn: 220693
* Add RestrictQualifierLoc to DeclaratorChunk::FunctionTypeInfoHal Finkel2014-10-201-0/+1
| | | | | | | | | | | | | | Clang supports __restrict__ as a function qualifier, but DeclaratorChunk::FunctionTypeInfo lacked a field to track the qualifier's source location (as we do with volatile, etc.). This was the subject of a FIXME in GetFullTypeForDeclarator (in SemaType.cpp). This should also prove useful as we add more warnings regarding questionable uses of the restrict qualifier. There is no significant functional change (except for an improved source range associated with the err_invalid_qualified_function_type diagnostic fixit generated by GetFullTypeForDeclarator). llvm-svn: 220215
* -ms-extensions: Implement __super scope specifier (PR13236).Nikola Smiljanic2014-09-261-1/+2
| | | | | | | | | We build a NestedNameSpecifier that records the CXXRecordDecl in which __super appeared. Name lookup is performed in all base classes of the recorded CXXRecordDecl. Use of __super is allowed only inside class and member function scope. llvm-svn: 218484
* Follow-up to r218292: Add more REVERTIBLE_TYPE_TRAITs.Nico Weber2014-09-241-0/+33
| | | | | | | | | r218292 reverted r197496 because it broke things. In addition to breaking things, r197496 also made all traits starting with __is_ revertible. Reinstantiate that part of r197496 because code out there (e.g. libc++) depends on this behavior. Fixes PR21045. llvm-svn: 218365
* Revert r197496, as it broke REVERTIBLE_TYPE_TRAITs from PCH files.Nico Weber2014-09-231-5/+42
| | | | | | Also add a test to make sure that this doesn't break again. Fixes PR21036. llvm-svn: 218292
* PR19751: (T())++ is not a cast-expression.Richard Smith2014-07-151-1/+6
| | | | llvm-svn: 213022
* Continue parsing an expression list even after an error is encountered.Kaelyn Takata2014-07-141-5/+8
| | | | | | | | | Otherwise, multiple errors such as having unknown identifiers for two arguments won't be diagnosed properly (e.g. only the first one would have a diagnostic message if typo correction fails even though both would be diagnosed if typo correction suggests a replacement). llvm-svn: 213003
* Convert StringLiteralParser constructor to use ArrayRef instead of a pointer ↵Craig Topper2014-06-261-1/+1
| | | | | | and count. llvm-svn: 211763
* Propagate isAddressOfMember into typo correction so that we don't correct ↵Nick Lewycky2014-06-231-1/+3
| | | | | | &qualified-id into &unqualified-id. Also make sure to set the naming class when we find the qualified-id in a different class than the nested name specifier specified so far. Fixes PR19681! llvm-svn: 211551
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-30/+30
| | | | | | takeAs to getAs. llvm-svn: 209800
* [C++11] Use 'nullptr'. Parser edition.Craig Topper2014-05-211-22/+24
| | | | llvm-svn: 209275
* 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
OpenPOWER on IntegriCloud