summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
Commit message (Collapse)AuthorAgeFilesLines
* Fix a layering oddity by passing Sema to DeclSpec::Finish instead of ↵Craig Topper2015-11-152-7/+7
| | | | | | DiagnosticsEngine and Preprocessor. Everything the preprocessor was being used for can be acquired from Sema. llvm-svn: 253158
* Move diagnostics from Parse to Sema to remove Sema's dependency on ↵Craig Topper2015-11-141-0/+1
| | | | | | ParserDiagnostic.h diagnostics. llvm-svn: 253143
* Merge some similar diagnostics using %select.Craig Topper2015-11-144-16/+21
| | | | llvm-svn: 253136
* Minor formatting fixes. NFCCraig Topper2015-11-141-2/+1
| | | | llvm-svn: 253135
* Fix 80 column violation. NFC.Craig Topper2015-11-141-2/+2
| | | | llvm-svn: 253134
* Fix spelling error in comment.Craig Topper2015-11-141-1/+1
| | | | llvm-svn: 253133
* Add support for GCC's '__auto_type' extension, per the GCC manual:Richard Smith2015-11-113-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | https://gcc.gnu.org/onlinedocs/gcc/Typeof.html Differences from the GCC extension: * __auto_type is also permitted in C++ (but only in places where it could appear in C), allowing its use in headers that might be shared across C and C++, or used from C++98 * __auto_type can be combined with a declarator, as with C++ auto (for instance, "__auto_type *p") * multiple variables can be declared in a single __auto_type declaration, with the C++ semantics (the deduced type must be the same in each case) This patch also adds a missing restriction on applying typeof to a bit-field, which GCC has historically rejected in C (due to lack of clarity as to whether the operand should be promoted). The same restriction also applies to __auto_type in C (in both GCC and Clang). This also fixes PR25449. Patch by Nicholas Allegra! llvm-svn: 252690
* N3922: direct-list-initialization of an auto-typed variable no longer deduces aRichard Smith2015-11-111-11/+13
| | | | | | | | | | | | | | | | | | | 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
* Switch to using an explicit scope object to ensure we don't forget to pop ObjCRichard Smith2015-11-031-24/+39
| | | | | | type parameters off the scope, and fix the cases where we failed to do so. llvm-svn: 251875
* Put global classes into the appropriate namespace.Benjamin Kramer2015-10-281-0/+4
| | | | | | | Most of the cases belong into an anonymous namespace. No functionality change intended. llvm-svn: 251514
* [coroutines] Creation of promise object, lookup of operator co_await, buildingRichard Smith2015-10-273-9/+6
| | | | | | of await_* calls, and AST representation for same. llvm-svn: 251387
* [coroutines] Initial stub Sema functionality for handling coroutine await / ↵Richard Smith2015-10-223-8/+9
| | | | | | yield / return. llvm-svn: 250993
* Convert ActOnForwardProtocolDeclaration to take an ArrayRef and use a ↵Craig Topper2015-10-221-4/+2
| | | | | | range-based for loop. NFC llvm-svn: 250990
* Use an ArrayRef<OffsetOfComponent> instead of pointer and size throughout ↵Craig Topper2015-10-221-1/+1
| | | | | | offsetof handling code. Also use a range-based for loop. NFC llvm-svn: 250989
* Change FindProtocolDeclaration to take an ArrayRef and use a range-based for ↵Craig Topper2015-10-221-4/+2
| | | | | | loop. NFC llvm-svn: 250988
* [coroutines] Add parsing support for co_await expression, co_yield expression,Richard Smith2015-10-223-3/+54
| | | | | | co_await modifier on range-based for loop, co_return statement. llvm-svn: 250985
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* [OPENMP] Fix for http://llvm.org/PR25221: Infinite loop while parsing OpenMP ↵Alexey Bataev2015-10-191-0/+1
| | | | | | | | directive Clang skipped annot_pragma_openmp token, while it should be considered as a stop token while skipping tokens. llvm-svn: 250684
* Parse and ignore #pragma runtime_checks in MS extensions mode (PR25138)Hans Wennborg2015-10-121-0/+8
| | | | | | We already silently ignore the /RTC, which controls the same functionality. llvm-svn: 250099
* When pretty-printing a C++11 literal operator, don't insert whitespace betweenRichard Smith2015-10-081-1/+1
| | | | | | | 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
* Fix Clang-tidy modernize-use-nullptr warnings in source directories; other ↵Hans Wennborg2015-10-062-17/+9
| | | | | | | | | | minor cleanups Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13406 llvm-svn: 249484
* Add -f[no-]declspec to control recognition of __declspec as a keywordSaleem Abdulrasool2015-10-041-3/+1
| | | | | | | | | | | | | | | In versions of clang prior to r238238, __declspec was recognized as a keyword in all modes. It was then changed to only be enabled when Microsoft or Borland extensions were enabled (and for CUDA, as a temporary measure). There is a desire to support __declspec in Playstation code, and possibly other environments. This commit adds a command-line switch to allow explicit enabling/disabling of the recognition of __declspec as a keyword. Recognition is enabled by default in Microsoft, Borland, CUDA, and PS4 environments, and disabled in all other environments. Patch by Warren Ristow! llvm-svn: 249279
* SourceRanges are small and trivially copyable, don't them by reference.Craig Topper2015-10-041-1/+1
| | | | llvm-svn: 249259
* [OPENMP 4.1] Add 'simd' clause for 'ordered' directive.Alexey Bataev2015-09-281-1/+5
| | | | | | | | | | | Parsing and sema analysis for 'simd' clause in 'ordered' directive. Description If the simd clause is specified, the ordered regions encountered by any thread will use only a single SIMD lane to execute the ordered regions in the order of the loop iterations. Restrictions An ordered construct with the simd clause is the only OpenMP construct that can appear in the simd region llvm-svn: 248696
* [OPENMP 4.1] Add 'threads' clause for '#pragma omp ordered'.Alexey Bataev2015-09-251-1/+5
| | | | | | | | OpenMP 4.1 extends format of '#pragma omp ordered'. It adds 3 additional clauses: 'threads', 'simd' and 'depend'. If no clause is specified, the ordered construct behaves as if the threads clause had been specified. If the threads clause is specified, the threads in the team executing the loop region execute ordered regions sequentially in the order of the loop iterations. The loop region to which an ordered region without any clause or with a threads clause binds must have an ordered clause without the parameter specified on the corresponding loop directive. llvm-svn: 248569
* [Modules] More descriptive diagnostics for misplaced import directiveSerge Pavlov2015-09-194-6/+44
| | | | | | | | | | If an import directive was put into wrong context, the error message was obscure, complaining on misbalanced braces. To get more descriptive messages, annotation tokens related to modules are processed where they must not be seen. Differential Revision: http://reviews.llvm.org/D11844 llvm-svn: 248085
* Revert r247692: Replace Triple with a new TargetTuple in MCTargetDesc/* and ↵Daniel Sanders2015-09-151-2/+2
| | | | | | | | related. NFC. Eric has replied and has demanded the patch be reverted. llvm-svn: 247702
* Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* ↵Daniel Sanders2015-09-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | and related. NFC. Summary: This is the first patch in the series to migrate Triple's (which are ambiguous) to TargetTuple's (which aren't). For the moment, TargetTuple simply passes all requests to the Triple object it holds. Once it has replaced Triple, it will start to implement the interface in a more suitable way. This change makes some changes to the public C++ API. In particular, InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer() now take TargetTuples instead of Triples. The other public C++ API's have been left as-is for the moment to reduce patch size. This commit also contains a trivial patch to clang to account for the C++ API change. Thanks go to Pavel Labath for fixing LLDB for me. Reviewers: rengolin Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D10969 llvm-svn: 247692
* Revert r247684 - Replace Triple with a new TargetTuple ...Daniel Sanders2015-09-151-2/+2
| | | | | | LLDB needs to be updated in the same commit. llvm-svn: 247686
* Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.Daniel Sanders2015-09-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first patch in the series to migrate Triple's (which are ambiguous) to TargetTuple's (which aren't). For the moment, TargetTuple simply passes all requests to the Triple object it holds. Once it has replaced Triple, it will start to implement the interface in a more suitable way. This change makes some changes to the public C++ API. In particular, InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer() now take TargetTuples instead of Triples. The other public C++ API's have been left as-is for the moment to reduce patch size. This commit also contains a trivial patch to clang to account for the C++ API change. Reviewers: rengolin Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D10969 llvm-svn: 247683
* [OPENMP 4.1] Parsing/sema analysis for extended format of 'if' clause.Alexey Bataev2015-09-031-40/+59
| | | | | | | | | | | | | | | | | OpenMP 4.1 added special 'directive-name-modifier' to the 'if' clause. Format of 'if' clause is as follows: ``` if([ directive-name-modifier :] scalar-logical-expression) ``` The restriction rules are also changed. 1. If any 'if' clause on the directive includes a 'directive-name-modifier' then all 'if' clauses on the directive must include a 'directive-name-modifier'. 2. At most one 'if' clause without a 'directive-name-modifier' can appear on the directive. 3. At most one 'if' clause with some particular 'directive-name-modifier' can appear on the directive. 'directive-name-modifier' is important for combined directives and allows to separate conditions in 'if' clause for simple sub-directives in combined directive. This 'directive-name-modifier' identifies the sub-directive to which this 'if' clause must be applied. llvm-svn: 246747
* [ms-inline-asm] Add field access to MS inline asm identifier lookupReid Kleckner2015-08-261-3/+20
| | | | | | | | | | | | | | Now we can parse code like this: struct A { int field; }; int f(A o) { __asm mov eax, o.field } Fixes PR19117. llvm-svn: 246088
* Modify DeclaratorChuck::getFunction to be passed an Exception Specification ↵Nathan Wilson2015-08-263-4/+4
| | | | | | | | | | | | | | | | | SourceRange Summary: - Store the exception specification range's begin and end SourceLocation in DeclaratorChuck::FunctionTypeInfo. These SourceLocations can be used in a FixItHint Range. - Add diagnostic; function concept having an exception specification. Reviewers: hubert.reinterpretcast, fraggamuffin, faisalv, aaron.ballman, rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11789 llvm-svn: 246005
* [OPENMP 4.0] Initial support for array sections.Alexey Bataev2015-08-251-4/+25
| | | | | | | | Adds parsing/sema analysis/serialization/deserialization for array sections in OpenMP constructs (introduced in OpenMP 4.0). Currently it is allowed to use array sections only in OpenMP clauses that accepts list of expressions. Differential Revision: http://reviews.llvm.org/D10732 llvm-svn: 245937
* [OPENMP 4.1] Initial support for 'simdlen' clause.Alexey Bataev2015-08-211-3/+9
| | | | | | Add parsing/sema analysis for 'simdlen' clause in simd directives. Also add check that if both 'safelen' and 'simdlen' clauses are specified, the value of 'simdlen' parameter is less than the value of 'safelen' parameter. llvm-svn: 245692
* [modules] When we see a definition of a function for which we already have aRichard Smith2015-08-212-4/+34
| | | | | | | non-visible definition, skip the new definition to avoid ending up with a function with multiple definitions. llvm-svn: 245664
* [OPENMP 4.1] Allow to use 'uval' and 'ref' modifiers for reference types only.Alexey Bataev2015-08-201-2/+1
| | | | | | Standard allows to use 'uval' and 'ref' modifiers in 'linear' clause for variables with reference types only. Added check for it and modified test. llvm-svn: 245556
* [OPENMP 4.1] Initial support for modifiers in 'linear' clause.Alexey Bataev2015-08-201-4/+28
| | | | | | | | | | | | | | | | | | | | | | OpenMP 4.1 adds 3 optional modifiers to 'linear' clause. Format of 'linear' clause has changed to: ``` linear(linear-list[ : linear-step]) ``` where linear-list is one of the following ``` list modifier(list) ``` where modifier is one of the following: ``` ref (C++) val (C/C++) uval (C++) ``` Patch adds parsing and sema analysis for these modifiers. llvm-svn: 245550
* Delay emitting members of dllexport classes until the class is fully parsed ↵Hans Wennborg2015-08-151-1/+1
| | | | | | | | | | | | | | | | | (PR23542) This enables Clang to correctly handle code such as: struct __declspec(dllexport) S { int x = 42; }; where it would otherwise error due to trying to generate the default constructor before the in-class initializer for x has been parsed. Differential Revision: http://reviews.llvm.org/D11850 llvm-svn: 245139
* [OPENMP] Fix for http://llvm.org/PR24430: clang hangs on invalid input with ↵Alexey Bataev2015-08-121-0/+8
| | | | | | | | openmp directive Add parsing of openmp directives inside structs/unions in C mode. llvm-svn: 244719
* Add new llvm.loop.unroll.enable metadata for use with "#pragma unroll".Mark Heffernan2015-08-101-9/+12
| | | | | | | | | | | | | | | | | | | | | | 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
* Restore PrettyStackTrace state on crash.Nico Weber2015-08-071-0/+17
| | | | | | Last part of PR11974. llvm-svn: 244339
* This patch commits OpenMP 4 target device clausesMichael Wong2015-08-071-1/+4
| | | | | | | This is committed on behalf of Kelvin Li http://reviews.llvm.org/D11469?id=31227 llvm-svn: 244325
* [Parse] ArrayRefize PragmaLoopHintInfo. No functionality change.Benjamin Kramer2015-08-051-10/+4
| | | | llvm-svn: 244024
* Outline function Parser::ParseCXXClassMemberDeclarationWithPragmas(), NFC.Alexey Bataev2015-07-311-123/+122
| | | | | | Parsing of pragmas followed by a class member declaration is outlined into a separate function Parser::ParseCXXClassMemberDeclarationWithPragmas(). llvm-svn: 243739
* Fix sanitizer fallout from r243642Ulrich Weigand2015-07-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | The memory-sanitizer build bot reported: ==5574== WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x7f03089e15f6 in clang::Parser::TryAltiVecTokenOutOfLine(clang::DeclSpec&, clang::SourceLocation, char const*&, unsigned int&, bool&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDecl.cpp:6290:11 This is because the "Ident_pixel" variable was uninitialized in the getLangOpts().ZVector case, but we'd still call into clang::Parser::TryAltiVecTokenOutOfLine, which uses the variable. The simplest fix for this without sprinkling !getLangOpts().ZVector checks all over the code seems to be to just initialize the variable to nullptr; this will then do the right thing on ZVector. Checked in to unbreak the build bots. llvm-svn: 243644
* Add support for System z vector language extensionsUlrich Weigand2015-07-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The z13 vector facility has an associated language extension, closely modeled on AltiVec/VSX. The main differences are: - vector long, vector float and vector pixel are not supported - vector long long and vector double are supported (like VSX) - comparison operators return a vector rather than a scalar integer - shift operators behave like the OpenCL shift operators - vector bool is only supported as argument to certain operators; some operators allow mixing a bool with a non-bool vector This patch adds clang support for the extension. It is closely modelled on the AltiVec support. Similarly to the -faltivec option, there's a new -fzvector option to enable the extensions (as well as an -mzvector alias for compatibility with GCC). There's also a separate LangOpt. The extension as implemented here is intended to be compatible with the -mzvector extension recently implemented by GCC. Based on a patch by Richard Sandiford. Differential Revision: http://reviews.llvm.org/D11001 llvm-svn: 243642
* [OPENMP 4.1] Initial support for extended 'ordered' clause.Alexey Bataev2015-07-301-2/+5
| | | | | | | | OpenMP 4.1 introduces optional argument '(n)' for 'ordered' clause, where 'n' is a number of loops that immediately follow the directive. 'n' must be constant positive integer expressions and it must be less or equal than the number of the loops in the resulting loop nest. Patch adds parsing and semantic analysis for this optional argument. llvm-svn: 243635
* [MS Compat] Allow _Atomic(Type) and 'struct _Atomic' to coexistDavid Majnemer2015-07-222-0/+50
| | | | | | | | | | | | | | | | | | | | | | MSVC 2013 ships, as part of its STL implementation, a class named '_Atomic'. This is unfortunate because this keyword is in conflict with the C11 keyword with the same name. Our solution was to disable this keyword when targeting MSVC 2013 and reenable it for 2015. However, this makes it impossible for clang's headers to make use of _Atomic. This is problematic in the case of libc++ as it makes heavy use of this keyword. Let the keywordness of _Atomic float under certain circumstances: the body of a class named _Atomic, or a class with a base specifier named _Atomic, will not have the keyword variant of _Atomic for the duration of the class body. This is sufficient to allow us to correctly handle _Atomic in the STL while permitting us to use _Atomic as a keyword everywhere else. Differential Revision: http://reviews.llvm.org/D11233 llvm-svn: 242970
OpenPOWER on IntegriCloud