summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
Commit message (Collapse)AuthorAgeFilesLines
...
* parser: improve diagnostics for MS attributesSaleem Abdulrasool2015-06-151-6/+8
| | | | | | | | Switch to using BalancedDelimiterTracker to get better diagnostics for unbalanced delimiters. This still does not handle any of the attributes, simply improves the parsing. llvm-svn: 239758
* Revert r239721 - Replace string GNU Triples with llvm::Triple in ↵Daniel Sanders2015-06-151-2/+2
| | | | | | | | InitMCObjectFileInfo. NFC. It appears to cause sparc-little-endian.s to assert on Windows and Darwin. llvm-svn: 239724
* Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.Daniel Sanders2015-06-151-2/+2
| | | | | | | | | | | | | | | | | | | | | Summary: This affects other tools so the previous C++ API has been retained as a deprecated function for the moment. Clang has been updated with a trivial patch (not covered by the pre-commit review) to avoid breaking -Werror builds. Other in-tree tools will be fixed with similar trivial patches. This continues the patch series to eliminate StringRef forms of GNU triples from the internals of LLVM that began in r239036. Reviewers: rengolin Reviewed By: rengolin Subscribers: llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D10366 llvm-svn: 239721
* Add assume_safety option for pragma loop vectorize and interleave.Tyler Nowicki2015-06-111-3/+6
| | | | | | | | Specifying #pragma clang loop vectorize(assume_safety) on a loop adds the mem.parallel_loop_access metadata to each load/store operation in the loop. This metadata tells loop access analysis (LAA) to skip memory dependency checking. llvm-svn: 239572
* [modules] Fix assert/crash when parsing and merging a definition of a class ↵Richard Smith2015-06-111-2/+3
| | | | | | with a base-specifier inside a namespace. llvm-svn: 239569
* Correct Loop Hint Diagnostic MessageTyler Nowicki2015-06-081-3/+4
| | | | | | When pragma clang loop unroll() is specified without an argument the diagnostic message should inform that user that 'full' and 'disable' are valid arguments (not 'enable'). llvm-svn: 239363
* __declspec is not a core Clang language extension. Instead, require ↵Aaron Ballman2015-05-261-0/+3
| | | | | | | -fms-extensions or -fborland to enable the language extension. Note: __declspec is also temporarily enabled when compiling for a CUDA target because there are implementation details relying on __declspec(property) support currently. When those details change, __declspec should be disabled for CUDA targets. llvm-svn: 238238
* Refactored some common functionality into MaybeParseMicrosoftDeclSpecs; NFC.Aaron Ballman2015-05-203-60/+57
| | | | llvm-svn: 237835
* [modules] Support for merging a parsed class template specialization ↵Richard Smith2015-05-181-1/+2
| | | | | | definition into an imported but hidden definition. llvm-svn: 237612
* Don't leak TemplateIds when a plugin parses late-parsed templates at TU end.Nico Weber2015-05-171-20/+29
| | | | | | | | | | | | | | | | | | | | | | | | | In -fdelayed-template-parsing mode, templates that aren't used are not parsed at all. For some diagnostic plugins, this is a problem since they want to analyse the contents of the template function body. What has been suggested on cfe-dev [1] is to explicitly parse interesting templates in HandleTranslationUnit(); IWYU does this for example [2]. This is workable, but since the delayed parsing doesn't run below a call to ParseTopLevelDecl(), no DestroyTemplateIdAnnotationsRAIIObj object is on the stack to clean up TemplateIds that are created during parsing. To fix this, let ~Parser() clean them up in delayed template parsing mode instead of leaking (or asserting in +Assert builds). (r219810, relanded in r220400, fixed the same problem in incremental processing mode; the review thread of r219810 has a good discussion of the problem.) To test this, give the PrintFunctionNames plugin a flag to force parsing of a template and add a test that uses it in -fdelayed-template-parsing mode. Without the Parser.cpp change, that test asserts. 1: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-August/038415.html 2: https://code.google.com/p/include-what-you-use/source/detail?r=566 llvm-svn: 237531
* [modules] Add local submodule visibility support for declarations.Richard Smith2015-05-151-1/+7
| | | | | | | | | | | | With this change, enabling -fmodules-local-submodule-visibility results in name visibility rules being applied to submodules of the current module in addition to imported modules (that is, names no longer "leak" between submodules of the same top-level module). This also makes it much safer to textually include a non-modular library into a module: each submodule that textually includes that library will get its own "copy" of that library, and so the library becomes visible no matter which including submodule you import. llvm-svn: 237473
* Add a new error for unexpected semi-colon before closing delimiter.Richard Trieu2015-05-121-1/+7
| | | | | | | | | Previously, if a semi-colon is unexpectedly added before a closing ')', ']' or '}', two errors and one note would emitted, and the parsing would get confused to which scope it was in. This change consumes the semi-colon, recovers parsing better, and emits only one error with a fix-it. llvm-svn: 237192
* Allow empty assembly string literal with -fno-gnu-inline-asmSteven Wu2015-05-122-8/+18
| | | | | | | | | Empty assembly string will not introduce assembly code in the output binary and it is often used as a trick in the header to disable optimizations. It doesn't conflict with the purpose of the option so it is allowed with -fno-gnu-inline-asm flag. llvm-svn: 237073
* PR20625: Instantiate static constexpr member function of a local struct in a ↵Richard Smith2015-05-111-1/+3
| | | | | | | | | | | | | | | function template earlier. This is necessary in order to allow the use of a constexpr member function, or a member function with deduced return type, of a local class within a surrounding instantiated function template specialization. Patch by Michael Park! This re-commits r236063, which was reverted in r236134, along with a fix for a delayed template parsing bug that was exposed by this change. llvm-svn: 237064
* Allow AsmLabel with -fno-gnu-inline-asmSteven Wu2015-05-111-4/+5
| | | | | | | | | | | | | | | | | | | Summary: AsmLabel is heavily used in system level and firmware to redirect function and access platform specific labels. They are also extensively used in system headers which makes this option unusable for many users. Since AsmLabel doesn't introduce any assembly code into the output binary, it shouldn't be considered as inline-asm. Reviewers: bob.wilson, rnk Reviewed By: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9679 llvm-svn: 237048
* [OPENMP] Code cleanup for capturing of variables in OpenMP regions.Alexey Bataev2015-05-081-0/+2
| | | | llvm-svn: 236821
* [modules] Suport for merging a parsed enum definition into an existing ↵Richard Smith2015-05-072-3/+25
| | | | | | imported but not visible definition. llvm-svn: 236690
* Allow TransformTypos to ignore corrections to a specified VarDecl.Kaelyn Takata2015-05-051-1/+6
| | | | | | | | | | | | | This is needed to prevent a TypoExpr from being corrected to a variable when the TypoExpr is a subexpression of that variable's initializer. Also exclude more keywords from the correction candidate pool when the subsequent token is .* or ->* since keywords like "new" or "return" aren't valid on the left side of those operators. Fixes PR23140. llvm-svn: 236519
* [OPENMP] Allow use of macros in OpenMP directives/clauses.Alexey Bataev2015-05-051-1/+1
| | | | llvm-svn: 236493
* Diagnose delayed typos when parsing a postfix expression with anKaelyn Takata2015-05-021-1/+13
| | | | | | | | unmatched l_paren before setting the LHS to ExprError(). Fixes PR23285. llvm-svn: 236371
* Also correct typos in the middle of a ternary expression when the RHS is ↵Kaelyn Takata2015-05-011-0/+8
| | | | | | | | | | | | invalid. The LHS was already being corrected before being set to ExprError when the RHS is invalid, but when it was present the middle of a ternary expression would be dropped in the error paths. Fixes PR23350. llvm-svn: 236347
* Eagerly correct typos in ParenExprs that may be type casts for non-C++ code.Kaelyn Takata2015-05-011-0/+5
| | | | | | | This is needed to ensure the type casts are parsed properly. Fixes PR23101. llvm-svn: 236337
* Batch up access-related diagnostics on enum constants until the whole enum ↵Jordan Rose2015-04-302-2/+17
| | | | | | | | | | is parsed. That way we can take any trailing availability attributes into account. rdar://problem/20713550 llvm-svn: 236241
* [OPENMP] Allow to use global variables as lcv in loop-based directives.Alexey Bataev2015-04-301-0/+6
| | | | | | | For proper codegen we need to capture variable in the OpenMP region. In loop-based directives loop control variables are private by default and they must be captured in this region. There was a problem with capturing of globals, used as lcv, as they was not marked as private by default. Differential Revision: http://reviews.llvm.org/D9336 llvm-svn: 236201
* Fix the typo in r236044. NFC.Steven Wu2015-04-281-1/+1
| | | | llvm-svn: 236051
* Fix -fno-gnu-inline-asm doesn't catch file scope asmSteven Wu2015-04-281-0/+4
| | | | | | | | | | | | | | | | | | Summary: FileScopeAsm should be treated the same as funcion level inline asm. -fno-gnu-inline-asm should trigger an error if file scope asm is used. I missed this case from r226340. This should not affect ms-extension because it is not allowed in the file scope. Reviewers: bob.wilson, rnk Reviewed By: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9328 llvm-svn: 236044
* Put statement expression decls in the enclosing code DeclContextReid Kleckner2015-04-201-0/+11
| | | | | | | | | | We already check that statement expressions are in a function or block, but we didn't do anything with that information. Now we use that DeclContext for the duration of the statement expression. Otherwise, we'd treat statement expression locals as static data members and go into the weeds. llvm-svn: 235335
* [Sema] Check availability of ObjC super class and protocols of a containerArgyrios Kyrtzidis2015-04-191-5/+6
| | | | | | | | | | | in the context of the container itself. Otherwise we will emit 'unavailable' errors when referencing an unavailable super class even though the subclass is also marked 'unavailable'. rdar://20598702 llvm-svn: 235276
* [MS ABI] Correctly associate align attrs before the class-keyDavid Majnemer2015-04-192-0/+44
| | | | | | | | | | | | __declspec(align(...)) is unlike all other attributes in that it is not applied to a variable if it appears before the class-key. If the tag in question isn't part of a variable declaration, it is not ignored. Instead, the alignment attribute is applied to the tag. This fixes PR18024. llvm-svn: 235272
* Don't eagerly typo-correct to a keyword if the next token is a right paren.Kaelyn Takata2015-04-102-2/+6
| | | | | | | | | Take advantage of the delayed typo no longer being eagerly corrected to a keyword to filter out keyword corrections (and other things like unresolved & overloaded expressions, which have placeholder types) when correcting typos inside of a decltype(). llvm-svn: 234623
* Correct typos in SEH filter expressionsReid Kleckner2015-04-021-1/+1
| | | | | | Otherwise we assert due to uncorrected delayed typos. llvm-svn: 233980
* [OPENMP] Fix crash on private variables not used in OpenMP region.Alexey Bataev2015-04-021-7/+2
| | | | llvm-svn: 233902
* Update for llvm commit r233648.Eric Christopher2015-03-311-1/+1
| | | | llvm-svn: 233649
* [parse] Don't crash on alternative operator spellings from macros in c++11 ↵Benjamin Kramer2015-03-291-1/+3
| | | | | | | | attributes. Found by afl-fuzz. llvm-svn: 233499
* [parser] Push _Atomic locs through DeclaratorChunk.Benjamin Kramer2015-03-291-1/+2
| | | | | | | Otherwise it stays uninitialized with potentially catastrophic results. Found by afl-fuzz. llvm-svn: 233494
* [Parse] Don't crash on ~A::{Benjamin Kramer2015-03-291-1/+1
| | | | | | Found by clang-fuzz. llvm-svn: 233492
* Diagnose delayed typos in an expr list that is in an invalid expression.Kaelyn Takata2015-03-271-0/+3
| | | | | | | | | | Previously, if the expr list parsed fine but the expr to the left of the open parenthesis was invalid (when parsing the suffix of a postfix-expression), the parsed expr list was just ignored. Fixes PR23005. llvm-svn: 233347
* [modules] If we reach a definition of a class for which we already have aRichard Smith2015-03-261-2/+56
| | | | | | | | non-visible definition, skip the new definition and make the old one visible instead of trying to parse it again and failing horribly. C++'s ODR allows us to assume that the two definitions are identical. llvm-svn: 233250
* Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit ↵Ehsan Akhgari2015-03-252-10/+35
| | | | | | | | | | | | | | hints Summary: Follow-up to the fix of PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7012 llvm-svn: 233161
* Diagnose declspecs occuring after virt-specifier-seq and generate fixit hintsEhsan Akhgari2015-03-252-2/+52
| | | | | | | | | | | | Summary: This fixes PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6828 llvm-svn: 233160
* Revert "Diagnose declspecs occuring after virt-specifier-seq and generate ↵Ehsan Akhgari2015-03-242-50/+2
| | | | | | | | fixit hints" This reverts commit 2131e63e2fdff7c831ab3bfe31facf2e3ebab03d. llvm-svn: 233074
* Revert "Diagnose ref-qualifiers occuring after virt-specifier-seq and ↵Ehsan Akhgari2015-03-242-35/+10
| | | | | | | | generate fixit hints" This reverts commit 49079d45966a3f57cd82edb35bde2e8e88fccf40. llvm-svn: 233073
* Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit ↵Ehsan Akhgari2015-03-242-10/+35
| | | | | | | | | | | | | | hints Summary: Follow-up to the fix of PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7012 llvm-svn: 233070
* Diagnose declspecs occuring after virt-specifier-seq and generate fixit hintsEhsan Akhgari2015-03-242-2/+50
| | | | | | | | | | | | Summary: This fixes PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6828 llvm-svn: 233069
* Cleanup: no need to pass DefinitionKind into ParseCXXInlineMethodDefEli Bendersky2015-03-232-6/+5
| | | | | | | | | | All ParseCXXInlineMethodDef does with it is assign it on the ParsingDeclarator. Since that is passed in as well, the (single) caller may as well set the DefinitionKind, thus simplifying the code. No change in functionality. llvm-svn: 233043
* Record correct source range for defaulted/deleted members.Eli Bendersky2015-03-231-0/+7
| | | | | | | | | | | | | | | | | | | Fixes https://llvm.org/bugs/show_bug.cgi?id=20744 struct A { A() = default; }; Previously the source range of the declaration of A ended at the ')'. It should include the '= default' part as well. The same for '= delete'. Note: this will break one of the clang-tidy fixers, which is going to be addessed in a follow-up patch. Differential Revision: http://reviews.llvm.org/D8465 llvm-svn: 233028
* Adds a warning for unrecognized argument to #pragma comment() on PS4.Yunzhong Gao2015-03-231-8/+16
| | | | | | | | | | | PS4 target recognizes the #pragma comment() syntax as in -fms-extensions, but only handles the case of #pragma comment(lib). This patch adds a warning if any other arguments are encountered. This patch also refactors the code in ParsePragma.cpp a little bit to make it more obvious that some codes are being shared between -fms-extensions and PS4. llvm-svn: 233015
* MS ABI: Implement the MSVC 2015 scheme for scope disambiguationDavid Majnemer2015-03-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | consider C++ that looks like: inline int &f(bool b) { if (b) { static int i; return i; } static int i; return i; } Both 'i' variables must have distinct (and stable) names for linkage purposes. The MSVC 2013 ABI would number the variables using a count of the number of scopes that have been created. However, the final 'i' returns to a scope that has already been created leading to a mangling collision. MSVC 2015 fixes this by giving the second 'i' the name it would have if it were declared before the 'if'. However, this results in ABI breakage because the mangled name, in cases where there was no ambiguity, would now be different. We implement the new behavior and only enable it if we are targeting the MSVC 2015 ABI, otherwise the old behavior will be used. This fixes PR18131. llvm-svn: 232766
* Correct typos in C11 generic-selection expressions.Kaelyn Takata2015-03-191-2/+4
| | | | llvm-svn: 232760
* Parse: Don't assume tokens have a lengthDavid Majnemer2015-03-192-8/+25
| | | | | | | Don't crash if the last token in a bad inline method body is an annotation token. llvm-svn: 232694
OpenPOWER on IntegriCloud