summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/Parser.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Minor cleanup.Rafael Espindola2012-12-291-5/+1
| | | | | | | | DS parameter has a default (null) value anyway, so there's no need for an if/else here. Patch by Nikola Smiljanić. llvm-svn: 171210
* Use @import rather than @__experimental_modules_import, since theDouglas Gregor2012-12-111-1/+1
| | | | | | latter is rather a mess to type. llvm-svn: 169919
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-5/+5
| | | | | | | | | | | | | 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
* Move PrettyStackTraceParserEntry to ParseAST.cppNico Weber2012-11-271-23/+0
| | | | | | | r128056 moved PrettyStackTraceParserEntry construction from Parser.h to ParseAST.cpp, so there's no need to keep this class in a header. llvm-svn: 168731
* Made the "expected string literal" diagnostic more expressiveAndy Gibbs2012-11-171-1/+2
| | | | llvm-svn: 168267
* PR12713 - crash on invalid due to unmatched parens in decltypeDavid Blaikie2012-11-071-2/+2
| | | | llvm-svn: 167547
* Have the parser initialize Sema before it consumes the firstDouglas Gregor2012-11-051-3/+5
| | | | | | | | token. This is important because the first token could actually be after an #include that triggers a module import, which might use either Sema or the AST consumer before it would have been initialized. llvm-svn: 167423
* Decouple code-completion for the SkipFunctionBodies frontend option andArgyrios Kyrtzidis2012-10-311-2/+3
| | | | | | add a test to make sure code-completion skips bodies. llvm-svn: 167141
* Currently the initial value of Tok is dependent an the stack contentsChris Lattner2012-10-271-0/+1
| | | | | | | | and could cause the Parser to crash on the first ConsumeToken(). Patcy by Bas van den Berg! llvm-svn: 166891
* Reverted back the changes made in 166868 and in 166869Mahesha S2012-10-271-234/+0
| | | | llvm-svn: 166871
* Feature:Mahesha S2012-10-271-0/+235
| | | | | | | | | | | | | | | | | | | | | OpenMP support. Sub-Feature: Support for "#pragma omp ..." registration with Preprocessor. Files Changed/Added: * include/clang/Basic/DiagnosticGroups.td (C) * include/clang/Basic/DiagnosticParseKinds.td (C) * include/clang/Basic/TokenKinds.def (C) * include/clang/Parse/Parser.h (C) * lib/Parse/Parser.cpp (C) Test Cases Changed/Added: * test/Preprocessor/pragma_omp.c (A) * test/Preprocessor/pragma_omp_ignored_warning.c (A) llvm-svn: 166869
* Permanently end the whole "pragma got handled by the parser too early"Eli Friedman2012-10-041-10/+31
| | | | | | | mess by handling all pragmas which the parser touches uniformly. <rdar://problem/12248901>, etc. llvm-svn: 165195
* If a comma operator is followed by a token which unambiguously indicates theRichard Smith2012-09-181-1/+2
| | | | | | | | start of a statement or the end of a compound-statement, diagnose the comma as a typo for a semicolon. Patch by Ahmed Bougacha! Additional test cases and minor refactoring by me. llvm-svn: 164085
* Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer2012-08-231-11/+4
| | | | | | | | MutableArrayRef. This required changing all get() calls to data() and using the simpler constructors. llvm-svn: 162501
* Remove ASTOwningVector, it doesn't own anything and provides no value over ↵Benjamin Kramer2012-08-231-4/+4
| | | | | | SmallVector. llvm-svn: 162492
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-3/+3
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* Fix a bunch of -Wdocumentation warnings.Dmitri Gribenko2012-08-231-1/+1
| | | | llvm-svn: 162452
* PR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers andRichard Smith2012-08-181-29/+151
| | | | | | | | | | | | | | | | | nested names as id-expressions, using the annot_primary_expr annotation, where possible. This removes some redundant lookups, and also allows us to typo-correct within tentative parsing, and to carry on disambiguating past an identifier which we can determine will fail lookup as both a type and as a non-type, allowing us to disambiguate more declarations (and thus offer improved error recovery for such cases). This also introduces to the parser the notion of a tentatively-declared name, which is an identifier which we *might* have seen a declaration for in a tentative parse (but only if we end up disambiguating the tokens as a declaration). This is necessary to correctly disambiguate cases where a variable is used within its own initializer. llvm-svn: 162159
* Removed an unused function I added a while back.Fariborz Jahanian2012-08-101-21/+0
| | | | llvm-svn: 161714
* objective-C++: dalyed parsing of ctors with memberFariborz Jahanian2012-08-101-2/+3
| | | | | | | initializer list defined inside an objc class implementation. wip llvm-svn: 161699
* objective-C++: delayed parsing of member function withFariborz Jahanian2012-08-101-1/+2
| | | | | | | function-try-block occuring in objc's implementation block. wip. llvm-svn: 161675
* objective-C++: Delayed parsing of most commonFariborz Jahanian2012-08-101-1/+20
| | | | | | | member functions defined inside an objc class implementation. wip. llvm-svn: 161667
* Add diagnostics for comma at end of enum and for extra semicolon at namespaceRichard Smith2012-07-231-11/+20
| | | | | | | | scope to -Wc++11-extensions. Move extra semicolon after member function definition diagnostic out of -pedantic, since C++ allows a single semicolon there. Keep it in -Wextra-semi, though, since it's still questionable. llvm-svn: 160618
* Allow the parser to recover gracefully if a typename is used to introduce a ↵Francois Pichet2012-07-221-3/+5
| | | | | | | | | | decltype type. In Microsoft mode, we emit a warning instead of an error. This fixes a couple of errors when parsing the MSVC 11 RC headers with clang. llvm-svn: 160613
* Move helper class into an anonymous namespace.Benjamin Kramer2012-07-131-0/+2
| | | | llvm-svn: 160172
* Better parser recovery in Objective-C containers.Jordan Rose2012-07-091-1/+1
| | | | | | | | | | | | | | Previously it was possible to get an infinite-loop-on-invalid with a namespace decl within @interface. Since 'namespace' is normally a safe place to retry top-level parsing, we just didn't consume the token. This adds a flag that tracks whether we have temporarily left Objective-C scope to parse a C-like declaration, and uses that to better recover from parse problems by stopping at possible method declarations and at @end. To fix the original problem, we do /not/ stop at 'namespace' when in an Objective-C @interface or @protocol context (but still do in @implementation). llvm-svn: 159941
* Added a new memberfor Parser, to be used soonFariborz Jahanian2012-07-061-0/+21
| | | | | | | for doing delayed parsing of c++ method defined in objc class implementations. llvm-svn: 159792
* objective-c++ parsing. Turn off delayed parsingFariborz Jahanian2012-07-051-3/+1
| | | | | | | | | of out-of-line c++ method definition which happens to be inside an objc class implementation until I can figure out how to do it. This is to fix a broken project. llvm-svn: 159772
* Obj-C++11 parser: fix broken parsing of c-functionFariborz Jahanian2012-07-031-1/+0
| | | | | | defined in class implementations. llvm-svn: 159691
* Obj-C++11 parser: turn off buffering ofFariborz Jahanian2012-07-031-0/+1
| | | | | | | c-function defined in objc class implementation for now. llvm-svn: 159690
* objective-c: just as we have done for method definitions,Fariborz Jahanian2012-07-021-2/+4
| | | | | | | | c-functions declared in implementation should have their parsing delayed until the end so, they can access forward declared private methods. // rdar://10387088 llvm-svn: 159626
* Support the use of "=delete" and "=default" with delayed templateDouglas Gregor2012-06-281-0/+1
| | | | | | parsing. Fixes <rdar://problem/11700604>. llvm-svn: 159380
* Clean up a large number of C++11 attribute parse issues, including parsingAlexis Hunt2012-06-231-13/+20
| | | | | | | | | | | | | | | | | | attributes in more places where we didn't and catching a lot more issues. This implements nearly every aspect of C++11 attribute parsing, except for: - Attributes are permitted on explicit instantiations inside the declarator (but not preceding the decl-spec) - Attributes are permitted on friend declarations of functions. - Multiple instances of the same attribute in an attribute-list (e.g. [[noreturn, noreturn]], not [[noreturn]] [[noreturn]] which is conforming) are allowed. The first two are marked as expected-FIXME in the test file and the latter is probably a defect and is currently untested. Thanks to Richard Smith for providing the lion's share of the testcases. llvm-svn: 159072
* Unbreak GCC build: GCC doesn't like clang::Parser::CommentHandler and class ↵Dmitri Gribenko2012-06-201-3/+3
| | | | | | clang::CommentHandler to have same name. llvm-svn: 158780
* Structured comment parsing, first step.Dmitri Gribenko2012-06-201-1/+21
| | | | | | | | | * Retain comments in the AST * Serialize/deserialize comments * Find comments attached to a certain Decl * Expose raw comment text and SourceRange via libclang llvm-svn: 158771
* Whenever we have a BalancedDelimiterTracker, we have a 'nested' scopeDouglas Gregor2012-06-061-4/+4
| | | | | | | where '>' is going to behave as an operator (and not as a '>' closing a template argument list). llvm-svn: 158111
* Remove unused private member variables found by clang's new ↵Benjamin Kramer2012-06-061-4/+3
| | | | | | -Wunused-private-field. llvm-svn: 158086
* Add pedantic warning -Wempty-translation-unit (C11 6.9p1).Jordan Rose2012-06-061-4/+0
| | | | | | | | | | | | | | | | | | | In standard C since C89, a 'translation-unit' is syntactically defined to have at least one "external-declaration", which is either a decl or a function definition. In Clang the latter gives us a declaration as well. The tricky bit about this warning is that our predefines can contain external declarations (__builtin_va_list and the 128-bit integer types). Therefore our AST parser now makes sure we have at least one declaration that doesn't come from the predefines buffer. Also, remove bogus warning about empty source files. This doesn't catch source files that only contain comments, and never fired anyway because of our predefines. PR12665 and <rdar://problem/9165548> llvm-svn: 158085
* Move the warnings for extra semi-colons under -Wextra-semi. Also, addedRichard Trieu2012-05-161-5/+28
| | | | | | | | a warning for an extra semi-colon after function definitions. Added logic so that a block of semi-colons on a line will only get one warning instead of a warning for each semi-colon. llvm-svn: 156934
* Recover properly from a redundant 'typename' before a non-nested name. This isRichard Smith2012-05-141-5/+17
| | | | | | | permitted as a Microsoft extension. Patch by William Wilson! (Plus some minor tweaking by me.) llvm-svn: 156786
* Recover properly if a class member declaration starts with a scope specifierRichard Smith2012-05-091-2/+1
| | | | | | or template-id which can't be parsed. llvm-svn: 156468
* Replace a ConsumeAnyToken() call with ConsumeToken() when we knowDouglas Gregor2012-05-021-1/+1
| | | | | | | we're looking at a normal token. Tiny positive impact -fsyntax-only time for <rdar://problem/11004361>. llvm-svn: 155988
* switch some uses of ExpectAndConsume(tok::semi to use ExpectAndConsumeSemi. ↵Chris Lattner2012-04-281-4/+1
| | | | | | | | | | | | | | | | | | | | This allows us to improve this diagnostic (telling us to insert another ")": t.c:2:19: error: expected ';' at end of declaration int x = 4+(5-12)); ^ ; to: t.c:2:19: error: extraneous ')' before ';' int x = 4+(5-12)); ^ ...telling us to remove the ")". This is PR12595. There are more uses of ExpectAndConsumeSemi that could be switched over, but I don't hit them on a daily basis :) llvm-svn: 155759
* Typo.Chad Rosier2012-04-251-1/+1
| | | | llvm-svn: 155596
* Parser: Don't manage TemplateAnnotationIds in a delayed cleanup pool.Benjamin Kramer2012-04-141-4/+24
| | | | | | | | | | Instead, make it the allocation function's responsibility to add them to a list and clear it when a top-level decl is finished. This plugs leakage of TemplateAnnotationIds. DelayedCleanupPool is ugly and unused, remove it. llvm-svn: 154743
* Added a flag to the parser to skip method bodies.Erik Verbruggen2012-04-121-2/+3
| | | | llvm-svn: 154584
* Fix bugs found by -Wconstant-conversion improvements currently under review.David Blaikie2012-04-091-4/+3
| | | | | | | | | | | | | | | | | | Specifically, using a an integer outside [0, 1] as a boolean constant seems to be an easy mistake to make with things like "x == a || b" where the author intended "x == a || x == b". The bug caused by calling SkipUntil with three token kinds was also identified by a VC diagnostic & reported by Francois Pichet as review feedback for my commit r154163. I've included test cases to verify the error recovery that was broken/poorly implemented due to this bug. The other fix (lib/Sema/SemaExpr.cpp) seems like that code was never actually reached in any of Clang's tests & is related to Objective C features I'm not familiar with, so I've not been able to construct a test case for it. Perhaps someone else can. llvm-svn: 154325
* Remove "parse error" in favor of more descriptive diagnostics.David Blaikie2012-04-061-3/+3
| | | | | | | | | | | In a few cases clang emitted a rather content-free diagnostic: 'parse error'. This change replaces two actual cases (template parameter parsing and K&R parameter declaration parsing) with more specific diagnostics and removes a third dead case of this in the BalancedDelimiterTracker (the ctor already checked the invariant necessary to ensure that the diag::parse_error was never actually used). llvm-svn: 154224
* From Vassil Vassilev:Axel Naumann2012-03-161-2/+9
| | | | | | | | | | | | | | Enable incremental parsing by the Preprocessor, where more code can be provided after an EOF. It mainly prevents the tearing down of the topmost lexer. To be used like this: PP.enableIncrementalProcessing(); while (getMoreSource()) { while (Parser.ParseTopLevelDecl(ADecl)) {...} } PP.enableIncrementalProcessing(false); llvm-svn: 152914
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-30/+30
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
OpenPOWER on IntegriCloud