summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
Commit message (Collapse)AuthorAgeFilesLines
...
* [Parser] Remove hard-coded bracket depth limitJan Korous2018-03-161-1/+1
| | | | | | The diagnostics produced if assert fails are using proper limit from language definition already. llvm-svn: 327735
* [OPENMP] Codegen for `omp declare target` construct.Alexey Bataev2018-03-151-1/+7
| | | | | | | | Added initial codegen for device side of declarations inside `omp declare target` construct + codegen for implicit `declare target` functions, which are used in the target regions. llvm-svn: 327636
* [MS] Accept __unaligned as a qualifier on member function pointersReid Kleckner2018-03-071-1/+2
| | | | | | | | | | We need to treat __unaligned like the other 'cvr' qualifiers when it appears at the end of a function prototype. We weren't doing that in some tentative parsing. Fixes PR36638. llvm-svn: 326962
* Fix a couple of cases where we would fail to correctly parse deduced class ↵Richard Smith2018-02-284-20/+38
| | | | | | | | | | | | | | | | template specialization types. Specifically, we would not properly parse these types within template arguments (for non-type template parameters), and in tentative parses. Fixing both of these essentially requires that we parse deduced template specialization types as types in all contexts, even in template argument lists -- in particular, tentative parsing may look ahead and annotate a deduced template specialization type before we figure out that we're actually supposed to treat the tokens as a template-name. We deal with this by simply permitting deduced template specialization types when parsing template arguments, and converting them to template template arguments. llvm-svn: 326299
* Improve the way attribute argument printing happens for omitted optional ↵Aaron Ballman2018-02-271-2/+5
| | | | | | | | arguments when pretty printing. Patch by Joel Denny. llvm-svn: 326266
* Add a C++11 and C2x spelling for the type safety attribute ↵Aaron Ballman2018-02-251-0/+4
| | | | | | | | (argument_with_type_tag, pointer_with_type_tag, and type_tag_for_datatype) in the clang vendor namespace. The TypeTagForDatatype attribute had custom parsing rules that previously prevented it from being supported with square bracket notation. The ArgumentWithTypeTag attribute previously had unnecessary custom parsing that could be handled declaratively. llvm-svn: 326052
* Add a C++11 and C2x spelling for the objc_bridge_related attribute in the ↵Aaron Ballman2018-02-241-0/+4
| | | | | | | | clang vendor namespace. This attribute has custom parsing rules that previously prevented it from being supported with square bracket notation. llvm-svn: 326038
* Add a C++11 and C2x spelling for the availability attribute in the clang ↵Aaron Ballman2018-02-241-5/+11
| | | | | | | | vendor namespace. This attribute has custom parsing rules that previously prevented it from being supported with square bracket notation. Rework the clang attribute argument parsing to be more easily extended for other custom-parsed attributes. llvm-svn: 326036
* [OPENMP] Fix parsing of the directives with inner directives.Alexey Bataev2018-02-162-3/+15
| | | | | | | The parsing may lead to compiler hanging because of the incorrect processing of inner OpenMP pragmas. llvm-svn: 325369
* Allow the NS, CF, and ObjC attributes to be used with ↵Aaron Ballman2018-02-122-15/+14
| | | | | | -fdouble-square-bracket-attributes. The syntactic locations for such attributes on ObjC constructs have been specifically chosen to follow the GNU attribute syntactic locations. llvm-svn: 324890
* [Templight] Template Instantiation ObserverGabor Horvath2018-02-101-0/+12
| | | | | | | | | | | | | | | | | | | | | This patch adds a base-class called TemplateInstantiationObserver which gets notified whenever a template instantiation is entered or exited during semantic analysis. This is a base class used to implement the template profiling and debugging tool called Templight (https://github.com/mikael-s-persson/templight). The patch also makes a few more changes: * ActiveTemplateInstantiation class is moved out of the Sema class (so it can be used with inclusion of Sema.h). * CreateFrontendAction function in front-end utilities is given external linkage (not longer a hidden static function). * TemplateInstObserverChain data member added to Sema class to hold the list of template-inst observers. * Notifications to the template-inst observer are added at the key places where templates are instantiated. Patch by: Abel Sinkovics! Differential Revision: https://reviews.llvm.org/D5767 llvm-svn: 324808
* PR36307: Consume the #pragma options align annotation token afterAlex Lorenz2018-02-081-2/+4
| | | | | | | | | semantic analysis to prevent incorrect -Wpragma-pack warning for an included file rdar://37354951 llvm-svn: 324651
* [Parser][FixIt] Better diagnostics for "typedef" instead of "typename" typoJan Korous2018-02-081-0/+14
| | | | | | | | rdar://problem/10214588 Differential Revision: https://reviews.llvm.org/D42170 llvm-svn: 324607
* Support `#pragma comment(lib, "name")` in the frontend for ELFSaleem Abdulrasool2018-02-071-2/+10
| | | | | | | | | | | | | This adds the frontend support required to support the use of the comment pragma to enable auto linking on ELFish targets. This is a generic ELF extension supported by LLVM. We need to change the handling for the "dependentlib" in order to accommodate the previously discussed encoding for the dependent library descriptor. Without the custom handling of the PCK_Lib directive, the -l prefixed option would be encoded into the resulting object (which is treated as a frontend error). llvm-svn: 324438
* Fix crash when trying to pack-expand a GNU statement expression.Richard Smith2018-02-032-11/+8
| | | | | | | | We could in principle support such pack expansion, using techniques similar to what we do for pack expansion of lambdas, but it's not clear it's worthwhile. For now at least, cleanly reject these cases rather than crashing. llvm-svn: 324160
* Add missing direct-init / parameter-declaration-clause disambiguation whenRichard Smith2018-02-024-8/+32
| | | | | | parsing a trailing-return-type of a (function pointer) variable declaration. llvm-svn: 324151
* [Parse] Forward brace locations to TypeConstructExprVedant Kumar2018-01-171-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | When parsing C++ type construction expressions with list initialization, forward the locations of the braces to Sema. Without these locations, the code coverage pass crashes on the given test case, because the pass relies on getLocEnd() returning a valid location. Here is what this patch does in more detail: - Forwards init-list brace locations to Sema (ParseExprCXX), - Builds an InitializationKind with these locations (SemaExprCXX), and - Uses these locations for constructor initialization (SemaInit). The remaining changes fall out of introducing a new overload for creating direct-list InitializationKinds. Testing: check-clang, and a stage2 coverage-enabled build of clang with asserts enabled. Differential Revision: https://reviews.llvm.org/D41921 llvm-svn: 322729
* [OpenMP] Fix handling of clause on wrong directive, by Joel. E. DennyAlexey Bataev2018-01-091-13/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: First, this patch fixes an assert failure when, for example, "omp for" has num_teams. Second, this patch prevents duplicate diagnostics when, for example, "omp for" has uniform. This patch makes the general assumption (even where it doesn't necessarily fix an existing bug) that it is worthless to perform sema for a clause that appears on a directive on which OpenMP does not permit that clause. However, due to this assumption, this patch suppresses some diagnostics that were expected in the test suite. I assert that those diagnostics were likely just distracting to the user. Reviewers: ABataev Reviewed By: ABataev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41841 llvm-svn: 322107
* Preserve unknown STDC pragma through preprocessorSteven Wu2018-01-051-0/+56
| | | | | | | | | | | | | | | | | | | Summary: #pragma STDC FP_CONTRACT handler is only registered in parser so we should keep the unknown STDC pragma through preprocessor and we also should not emit warning for unknown STDC pragma during preprocessor. rdar://problem/35724351 Reviewers: efriedma, rsmith, arphaman Reviewed By: efriedma Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41780 llvm-svn: 321909
* Again reverting an attempt to convert the DeclSpec enums into scoped enums.Faisal Vali2018-01-016-30/+24
| | | | | | | | | | | | - reverts r321622, r321625, and r321626. - the use of bit-fields is still resulting in warnings - even though we can use static-asserts to harden the code and ensure the bit-fields are wide enough. The bots still complain of warnings being seen. - to silence the warnings requires specifying the bit-fields with the underlying enum type (as opposed to the enum type itself), which then requires lots of unnecessary static casts of each enumerator within DeclSpec to the underlying-type, which even though could be seen as implementation details, it does hamper readability - and given the additional litterings, makes me question the value of the change. So in short - I give up (for now at least). Sorry about the noise. llvm-svn: 321628
* [NFC] Modernize enums TypeSpecifierWidth, TypeSpecifierSign & ↵Faisal Vali2018-01-016-24/+30
| | | | | | | | | | | | TypeSpecifierType into scoped enums with underlying types. - Since these enums are used as bit-fields - for the bit-fields to be interpreted as unsigned, the underlying type must be specified as unsigned. Previous failed attempt - wherein I did not specify an underlying type - was the sum of: https://reviews.llvm.org/rC321614 https://reviews.llvm.org/rC321615 llvm-svn: 321622
* Revert r321614 and r321615Faisal Vali2018-01-016-30/+24
| | | | | | | | - the enum changes to TypeSpecifierType are breaking some tests - and will require a more careful integration. Sorry about rushing these changes - thought I could sneak them in prior to heading out for new years ;) llvm-svn: 321616
* [NFC] Modernize enums TypeSpecifierWidth, TypeSpecifierSign & ↵Faisal Vali2018-01-016-24/+30
| | | | | | | | TypeSpecifierType into scoped enums. llvm-svn: 321614
* [NFC] Modernize enum DeclSpecContext into a scoped enum.Faisal Vali2017-12-316-61/+71
| | | | llvm-svn: 321590
* [NFC] Modernize enum 'UnqualifiedId::IdKind' into a scoped enum ↵Faisal Vali2017-12-304-26/+29
| | | | | | UnqualifiedIdKind. llvm-svn: 321574
* [NFC] Modernize enum Declarator::TheContext to a type-safe scoped enum.Faisal Vali2017-12-299-136/+146
| | | | | | Note, we don't do any bitwise manipulations when using them. llvm-svn: 321546
* Add a fixit for attributes incorrectly placed prior to 'struct/class/enum' ↵Faisal Vali2017-12-252-5/+35
| | | | | | | | | | | | | keyword. Suggest moving the following erroneous attrib list (based on location) [[]] struct X; to struct [[]] X; Additionally, added a fixme for the current implementation that diagnoses misplaced attributes to consider using the newly introduced diagnostic (that I think is more user-friendly). llvm-svn: 321449
* [NFC] Remove a cast rendered unnecessary by r321409Faisal Vali2017-12-231-1/+1
| | | | | | See https://reviews.llvm.org/rC321409 for additional context. llvm-svn: 321410
* [NFC] Update the template-parameter parsers and analyzers to return ↵Faisal Vali2017-12-231-6/+6
| | | | | | | | NamedDecl (vs Decl) This patch addresses a FIXME and has the template-parameter processing functions return a more derived common type NamedDecl (as opposed to a type needlessly higher up in the inheritance hierarchy : Decl). llvm-svn: 321409
* Fix more inconsistent line endings. NFC.Dimitry Andric2017-12-181-2/+2
| | | | llvm-svn: 321016
* [c++20] P0515R3: Parsing support and basic AST construction for operator <=>.Richard Smith2017-12-141-6/+11
| | | | | | | | | | | | | | | Adding the new enumerator forced a bunch more changes into this patch than I would have liked. The -Wtautological-compare warning was extended to properly check the new comparison operator, clang-format needed updating because it uses precedence levels as weights for determining where to break lines (and several operators increased their precedence levels with this change), thread-safety analysis needed changes to build its own IL properly for the new operator. All "real" semantic checking for this operator has been deferred to a future patch. For now, we use the relational comparison rules and arbitrarily give the builtin form of the operator a return type of 'void'. llvm-svn: 320707
* Allow conditions to be decomposed with structured bindingsZhihao Yuan2017-12-071-0/+2
| | | | | | | | | | | | | | | | | | | | | Summary: This feature was discussed but not yet proposed. It allows a structured binding to appear as a //condition// if (auto [ok, val] = f(...)) So the user can save an extra //condition// if the statement can test the value to-be-decomposed instead. Formally, it makes the value of the underlying object of the structured binding declaration also the value of a //condition// that is an initialized declaration. Considering its logicality which is entirely evident from its trivial implementation, I think it might be acceptable to land it as an extension for now before I write the paper. Reviewers: rsmith, faisalv, aaron.ballman Reviewed By: rsmith Subscribers: aaron.ballman, cfe-commits Differential Revision: https://reviews.llvm.org/D39284 llvm-svn: 320011
* Remove old concepts parsing codeHubert Tong2017-12-072-10/+0
| | | | | | | | | | | | | | | | | | Summary: This is so we can implement concepts per P0734R0. Relevant failing test cases are disabled. Reviewers: hubert.reinterpretcast, rsmith, saar.raz, nwilson Reviewed By: saar.raz Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40380 Patch by Changyu Li! llvm-svn: 319992
* Now that C++17 is official (https://www.iso.org/standard/68564.html), start ↵Aaron Ballman2017-12-046-18/+18
| | | | | | changing the C++1z terminology over to C++17. NFC intended, these are all mechanical changes. llvm-svn: 319688
* [c++2a] P0515R3: Support for overloaded operator<=>.Richard Smith2017-12-011-1/+1
| | | | | | No CodeGen support for MSABI yet, we don't know how to mangle this there. llvm-svn: 319513
* [OPENMP] Initial support for asynchronous data update, NFC.Alexey Bataev2017-11-211-0/+9
| | | | | | | | | OpenMP 5.0 introduces asynchronous data update/dependecies clauses on target data directives. Patch adds initial support for outer task regions to use task-based codegen for future async target data directives. llvm-svn: 318781
* [Modules TS] Added module re-export support.Hamza Sood2017-11-212-8/+12
| | | | | | | This implements [dcl.modules.export] from the C++ Modules TS, which lets a module re-export another module with the "export import" syntax. Differential Revision: https://reviews.llvm.org/D40270 llvm-svn: 318744
* Revert r318556 "Loosen -Wempty-body warning"Hans Wennborg2017-11-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems this somehow made -Wempty-body fire in some macro cases where it didn't before, e.g. ../../third_party/ffmpeg/libavcodec/bitstream.c(169,5): error: if statement has empty body [-Werror,-Wempty-body] ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size); ^ ../../third_party/ffmpeg\libavutil/internal.h(276,80): note: expanded from macro 'ff_dlog' # define ff_dlog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) ^ ../../third_party/ffmpeg/libavcodec/bitstream.c(169,5): note: put the semicolon on a separate line to silence this warning Reverting until this can be figured out. > Do not show it when `if` or `else` come from macros. > E.g., > > #define USED(A) if (A); else > #define SOME_IF(A) if (A) > > void test() { > // No warnings are shown in those cases now. > USED(0); > SOME_IF(0); > } > > Patch by Ilya Biryukov! > > Differential Revision: https://reviews.llvm.org/D40185 llvm-svn: 318665
* Loosen -Wempty-body warningReid Kleckner2017-11-171-0/+1
| | | | | | | | | | | | | | | | | | | | Do not show it when `if` or `else` come from macros. E.g., #define USED(A) if (A); else #define SOME_IF(A) if (A) void test() { // No warnings are shown in those cases now. USED(0); SOME_IF(0); } Patch by Ilya Biryukov! Differential Revision: https://reviews.llvm.org/D40185 llvm-svn: 318556
* [Parser] Fix TryParseLambdaIntroducer() error handlingJan Korous2017-11-061-14/+21
| | | | | | | | rdar://35066196 Differential Revision: https://reviews.llvm.org/D39419 llvm-svn: 317493
* Fix comment typoJan Korous2017-11-021-1/+1
| | | | llvm-svn: 317216
* Fix usage of right shift operator in fold expressionsRichard Smith2017-10-311-3/+4
| | | | | | | | The right shift operator was not seen as a valid operator in a fold expression, which is PR32563. Patch by Nicolas Lesser ("Blitz Rakete")! llvm-svn: 317032
* Typo correct the condition of 'do-while' before exiting its scopeAlex Lorenz2017-10-301-0/+3
| | | | | | rdar://35172419 llvm-svn: 316966
* Move MS inline asm parser methods out of line to reduce indentation, NFCReid Kleckner2017-10-261-98/+118
| | | | llvm-svn: 316674
* mplement __has_unique_object_representationsErich Keane2017-10-241-0/+1
| | | | | | | | | | | | A helper builtin to facilitate implementing the std::has_unique_object_representations type trait. Requested here: https://bugs.llvm.org/show_bug.cgi?id=34942 Also already exists in GCC and MSVC. Differential Revision: https://reviews.llvm.org/D39064 llvm-svn: 316518
* [code completion] Complete ObjC methods in @implementation without leadingAlex Lorenz2017-10-241-3/+9
| | | | | | | | '-'/'+' prefix rdar://12040840 llvm-svn: 316458
* Do not add a colon chunk to the code completion of class inheritance access ↵Erik Verbruggen2017-10-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | modifiers With enabled CINDEXTEST_CODE_COMPLETE_PATTERNS env option (which enables IncludeCodePatterns in completion options) code completion after colon currently suggests access modifiers with 2 completion chunks which is incorrect. Example: class A : <Cursor>B { } Currently we get 'NotImplemented:{TypedText public}{Colon :} (40)' but the correct line is just 'NotImplemented:{TypedText public} (40)' The fix introduces more specific scope that occurs between ':' and '{' It allows us to determine when we don't need to add ':' as a second chunk to the public/protected/private access modifiers. Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D38618 llvm-svn: 316436
* Create fewer copies of StringMaps. No functionality change intended.Benjamin Kramer2017-10-221-1/+1
| | | | llvm-svn: 316301
* Add -f[no-]double-square-bracket-attributes as new driver options to control ↵Aaron Ballman2017-10-152-25/+44
| | | | | | use of [[]] attributes in all language modes. This is the initial implementation of WG14 N2165, which is a proposal to add [[]] attributes to C2x, but also allows you to enable these attributes in C++98, or disable them in C++11 or later. llvm-svn: 315856
* Fix backwards warning for use of C++17 ↵Richard Smith2017-10-142-6/+8
| | | | | | attributes-on-namespaces-and-enumerators feature. llvm-svn: 315784
OpenPOWER on IntegriCloud