summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseCXXInlineMethods.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Keep the parser's template depth up to date when parsing local templates andRichard Smith2013-04-291-9/+27
| | | | | | late-parsed templates. Patch by Faisal Vali! llvm-svn: 180708
* Implement C++1y decltype(auto).Richard Smith2013-04-261-2/+1
| | | | llvm-svn: 180610
* [Parser] Don't code-complete twice.Argyrios Kyrtzidis2013-03-271-2/+2
| | | | | | | | | | | | | | | When we are consuming the current token just to enter a new token stream, we push the current token in the back of the stream so that we get it again. Unfortunately this had the effect where if the current token is a code-completion one, we would code-complete once during consuming it and another time after the stream ended. Fix this by making sure that, in this case, ConsumeAnyToken() will consume a code-completion token without invoking code-completion. rdar://12842503 llvm-svn: 178199
* Flag that friend function definitions are "late parsed" so thatJohn McCall2013-03-141-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | template instantiation will still consider them to be definitions if we instantiate the containing class before we get around to parsing the friend. This seems like a legitimate use of "late template parsed" to me, but I'd appreciate it if someone responsible for the MS feature would look over this. This file already appears to access AST nodes directly, which is arguably not kosher in the parser, but the performance of this path matters enough that perpetuating the sin is justifiable. Probably we ought to reconsider this policy for very simple manipulations like this. The reason this entire thing is necessary is that function template instantiation plays some very gross games in order to not associate an instantiated function template with the class it came from unless it's a definition, and the reason *that's* necessary is that the AST currently cannot represent the instantiation history of individual function template declarations, but instead tracks it in common for the entire function template. That probably prevents us from correctly reporting ill-formed calls to ambiguously instantiated friend function templates. rdar://12350696 llvm-svn: 177003
* Finish semantic analysis for [[carries_dependency]] attribute.Richard Smith2013-01-281-2/+2
| | | | | | | | | | This required plumbing through a new flag to determine whether a ParmVarDecl is actually a parameter of a function declaration (as opposed to a function typedef etc, where the attribute is prohibited). Weirdly, this attribute (just like [[noreturn]]) cannot be applied to a function type, just to a function declaration (and its parameters). llvm-svn: 173726
* Tighten types a bit. No functionality change.Rafael Espindola2013-01-081-2/+2
| | | | llvm-svn: 171895
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-4/+4
| | | | llvm-svn: 171367
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | 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
* Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer2012-08-231-1/+1
| | | | | | | | MutableArrayRef. This required changing all get() calls to data() and using the simpler constructors. llvm-svn: 162501
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-2/+2
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* Support the use of "=delete" and "=default" with delayed templateDouglas Gregor2012-06-281-0/+1
| | | | | | parsing. Fixes <rdar://problem/11700604>. llvm-svn: 159380
* PR13064: Store whether an in-class initializer uses direct or copyRichard Smith2012-06-101-2/+2
| | | | | | | initialization, and use that information to produce the right kind of initialization during template instantiation. llvm-svn: 158288
* CXXThisScopeRAII objects aren't free, don't compute one if it's unused.Benjamin Kramer2012-05-171-1/+1
| | | | llvm-svn: 156987
* Refactor DelayedDiagnostics so that it keeps diagnostics inJohn McCall2012-05-071-0/+1
| | | | | | | separate pools owned by the RAII objects that keep pushing decl state. This gives us quite a bit more flexibility. llvm-svn: 156289
* Revert most of r154844, which was disabled in r155975. Keep around theRichard Smith2012-05-021-71/+1
| | | | | | | refactorings in that revision, and some of the subsequent bugfixes, which seem to be relevant even without delayed exception specification parsing. llvm-svn: 156031
* Implement the last part of C++ [class.mem]p2, delaying the parsing ofDouglas Gregor2012-04-161-1/+72
| | | | | | | | | exception specifications on member functions until after the closing '}' for the containing class. This allows, for example, a member function to throw an instance of its own class. Fixes PR12564 and a fairly embarassing oversight in our C++98/03 support. llvm-svn: 154844
* Implement C++11 [expr.prim.general]p3, which permits the use of 'this'Douglas Gregor2012-04-161-5/+16
| | | | | | | | | | | | | | | | | | | | | | | in the declaration of a non-static member function after the (optional) cv-qualifier-seq, which in practice means in the exception specification and late-specified return type. The new scheme here used to manage 'this' outside of a member function scope is more general than the Scope-based mechanism previously used for non-static data member initializers and late-parsesd attributes, because it can also handle the cv-qualifiers on the member function. Note, however, that a separate pass is required for static member functions to determine whether 'this' was used, because we might not know that we have a static function until after declaration matching. Finally, this introduces name mangling for 'this' and for the implicit 'this', which is intended to match GCC's mangling. Independent verification for the new mangling test case would be appreciated. Fixes PR10036 and PR12450. llvm-svn: 154799
* Fix the other place where C++98 work for initializer lists was necessary.Sebastian Redl2012-03-201-2/+3
| | | | llvm-svn: 153129
* Parse brace initializers as default arguments. PR12236.Sebastian Redl2012-03-141-1/+5
| | | | llvm-svn: 152721
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-4/+4
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Streamline BalancedDelimiterTracker, by eliminating the duplicateDouglas Gregor2012-03-081-1/+1
| | | | | | | | paren/brace/bracket tracking (the Consume* functions already did it), removing the use of ConsumeAnyToken(), and moving the hot paths inline with the error paths out-of-line. llvm-svn: 152274
* Improve diagnostics a bit for bad member initializers, and fix an obscure ↵Eli Friedman2012-02-221-23/+40
| | | | | | bug involving packs. Fixes PR12049. llvm-svn: 151130
* Implement name mangling for lambda expressions that occur within theDouglas Gregor2012-02-211-1/+2
| | | | | | initializers of data members (both static and non-static). llvm-svn: 151017
* Implement name mangling for lambda expressions that occur within theDouglas Gregor2012-02-211-2/+4
| | | | | | | | | | | | | | | | default arguments of function parameters. This simple-sounding task is complicated greatly by two issues: (1) Default arguments aren't actually a real context, so we need to maintain extra state within lambda expressions to track when a lambda was actually in a default argument. (2) At the time that we parse a default argument, the FunctionDecl doesn't exist yet, so lambda closure types end up in the enclosing context. It's not clear that we ever want to change that, so instead we introduce the notion of the "effective" context of a declaration for the purposes of name mangling. llvm-svn: 151011
* Change the diagnostics which said 'accepted as an extension' to instead sayRichard Smith2011-12-291-2/+2
| | | | | | | 'is an extension'. The former is inappropriate and confusing when building with -Werror/-pedantic-errors. llvm-svn: 147357
* Remove unused parameter from the LateParsedTemplatedFunction constructor.Francois Pichet2011-12-081-2/+1
| | | | llvm-svn: 146145
* Enable delayed template parsing for friend functions declared at template ↵Francois Pichet2011-11-181-2/+1
| | | | | | class scope. llvm-svn: 144980
* PR11148: Fix crash-on-invalid if an invalid member declaration is marked asRichard Smith2011-11-101-0/+5
| | | | | | defaulted or deleted. llvm-svn: 144270
* When we notice that a member function is defined with "= delete" or "=Douglas Gregor2011-11-071-3/+5
| | | | | | | | | | | | default", make a note of which is used when creating the initial declaration. Previously, we would wait until later to handle default/delete as a definition, but this is too late: when adding the declaration, we already treated the declaration as "user-provided" when in fact it was merely "user-declared". Fixes PR10861 and PR10442, along with a bunch of FIXMEs. llvm-svn: 144011
* When we end up having to parse the initializer of a C++ member earlyDouglas Gregor2011-10-171-2/+2
| | | | | | | in -fms-extensions mode, make sure we actually use that initializer after having handled the declaration. Fixes PR11150. llvm-svn: 142195
* Implement -Wc++98-compat warnings for the parser.Richard Smith2011-10-151-4/+6
| | | | llvm-svn: 142056
* Allow for annotate attributes after access specifiers. When suchErik Verbruggen2011-10-131-1/+5
| | | | | | attributes are found, propagate them to subsequent declarations. llvm-svn: 141861
* Move some bool flags out of function parameter lists.Kaelyn Uhrain2011-10-111-3/+3
| | | | llvm-svn: 141610
* Parse the initializer for a class member after handling itsDouglas Gregor2011-10-101-4/+11
| | | | | | | declarator, so that the declarator is in scope for the initializer. Fixes PR9989. llvm-svn: 141539
* Fix a bug in the token caching for inline constructors in C++11, and improve ↵Sebastian Redl2011-09-301-28/+41
| | | | | | error recovery in both dialects. This should fix the GCC test suite failures as well. llvm-svn: 140847
* PR11000: Fix crash on invalid.Richard Smith2011-09-291-1/+1
| | | | llvm-svn: 140802
* Correctly parse braced member initializers (even in delayed parsing) and ↵Sebastian Redl2011-09-241-2/+50
| | | | | | | | | | | correctly pass the information on to Sema. There's still an incorrectness in the way template instantiation works now, but that is due to a far larger underlying representational problem. Also add a test case for various list initialization cases of scalars, which test this commit as well as the previous one. llvm-svn: 140460
* Fix a crash-on-invalid.Matt Beaumont-Gay2011-09-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The token stream was not getting properly reset when leaving ParseLexedMethodDef in some error cases. In the testcase, that caused later accesses to the token stream to touch memory which had been freed as we finished parsing the class definition. Major hat-tip to AddressSanitizer for helping pinpoint the use-after-free, including the allocation and deallocation points: ==21510== ERROR: AddressSanitizer heap-use-after-free on address 0x7feb3de87848 at pc 0x249f4e2 bp 0x7fff15a89df0 sp 0x7fff15a89ce0 READ of size 1 at 0x7feb3de87848 thread T0 #0 0x249f4e2 clang::TokenLexer::Lex() #1 0x1c834a0 clang::Parser::ConsumeToken() #2 0x1c7dc0f clang::Parser::ParseDeclarationOrFunctionDefinition() #3 0x1c7e16b clang::Parser::ParseDeclarationOrFunctionDefinition() <snip> 0x7feb3de87848 is located 1992 bytes inside of 3816-byte region [0x7feb3de87080,0x7feb3de87f68) freed by thread T0 here: #0 0x3a22c19 free #1 0x1d136a1 clang::Parser::LexedMethod::~LexedMethod() #2 0x1cef528 clang::Parser::DeallocateParsedClasses() #3 0x1cef676 clang::Parser::PopParsingClass() #4 0x1cea094 clang::Parser::ParseCXXMemberSpecification() #5 0x1ce7ae5 clang::Parser::ParseClassSpecifier() #6 0x1cfe588 clang::Parser::ParseDeclarationSpecifiers() #7 0x1c7dbe8 clang::Parser::ParseDeclarationOrFunctionDefinition() #8 0x1c7e16b clang::Parser::ParseDeclarationOrFunctionDefinition() <snip> previously allocated by thread T0 here: #0 0x3a2302d realloc #1 0x39d7c97 llvm::SmallVectorBase::grow_pod() #2 0x1ac588e llvm::SmallVectorImpl<>::push_back() #3 0x1d12d8b clang::Parser::ConsumeAndStoreUntil() #4 0x1c9c24d clang::Parser::ConsumeAndStoreUntil() #5 0x1d12c1e clang::Parser::ConsumeAndStoreUntil() #6 0x1c9c24d clang::Parser::ConsumeAndStoreUntil() #7 0x1d10042 clang::Parser::ParseCXXInlineMethodDef() #8 0x1cec51a clang::Parser::ParseCXXClassMemberDeclaration() #9 0x1ce9de5 clang::Parser::ParseCXXMemberSpecification() #10 0x1ce7ae5 clang::Parser::ParseClassSpecifier() #11 0x1cfe588 clang::Parser::ParseDeclarationSpecifiers() #12 0x1c7dbe8 clang::Parser::ParseDeclarationOrFunctionDefinition() #13 0x1c7e16b clang::Parser::ParseDeclarationOrFunctionDefinition() <snip> llvm-svn: 140427
* Support code-completion for C++ inline methods and ObjC buffering methods.Argyrios Kyrtzidis2011-09-041-0/+5
| | | | | | | | | | | | | | Previously we would cut off the source file buffer at the code-completion point; this impeded code-completion inside C++ inline methods and, recently, with buffering ObjC methods. Have the code-completion inserted into the source buffer so that it can be buffered along with a method body. When we actually hit the code-completion point the cut-off lexing or parsing. Fixes rdar://10056932&8319466 llvm-svn: 139086
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-0/+3
| | | | llvm-svn: 136210
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-111-0/+113
| | | | llvm-svn: 132878
* Properly parse the 'default' and 'delete' keywords.Alexis Hunt2011-05-121-2/+37
| | | | | | | | | | | | | | | | | They are actually grammatically considered definitions and parsed accordingly. This fixes the outstanding bugs regarding defaulting functions after their declarations. We now really nicely diagnose the following construct (try it!) int foo() = delete, bar; Still todo: Defaulted functions other than default constructors Test cases (including for the above construct) llvm-svn: 131228
* In Microsoft mode, allow pure specifier (=0) on inline functions declared at ↵Francois Pichet2011-05-111-2/+3
| | | | | | | | | | | | | class scope. This removes 2 errors when parsing MFC code with clang Example: class A { virtual void f() = 0 { } } llvm-svn: 131175
* Remove some more hard CR-LF lines. These were particularly weird as they wereChandler Carruth2011-04-251-1/+1
| | | | | | | only a few lines of the file. Also set their properties to have explicitly native eol sytle. llvm-svn: 130124
* Correctly emit a diagnostic for multiple templated function definitions in ↵Francois Pichet2011-04-221-0/+1
| | | | | | -flate-template-parsing mode. llvm-svn: 130030
* Add -fdelayed-template-parsing option. Using this option all templated ↵Francois Pichet2011-04-221-0/+31
| | | | | | | | | function definitions are parsed at the end of the translation unit only if it is required by an actual instantiation. As such all the symbols of the TU are available during name lookup. Using this flag is necessary for compatibility with Microsoft template code. This also provides some parsing speed improvement. llvm-svn: 130022
* If the declaration of a C++ member function with an inline definitionDouglas Gregor2011-04-141-0/+8
| | | | | | | is so broken that Sema can't form a declaration for it, don't bother trying to parse the definition later. Fixes <rdar://problem/9221993>. llvm-svn: 129547
* Remove warnings about using override control keywords in inline function ↵Anders Carlsson2011-03-251-5/+0
| | | | | | definitions; they will be allowed in the next C++0x draft. llvm-svn: 128273
* Remove 'new' from virt-specifier since it's going to be removed in the next ↵Anders Carlsson2011-03-251-2/+0
| | | | | | C++0x draft llvm-svn: 128271
* Make sure that we always pop a function's scope *before* we callDouglas Gregor2011-03-161-2/+3
| | | | | | | | | | | ActOnFinishFunctionBody/ActOnBlockStmtExpr. This way, we ensure that we diagnose undefined labels before the jump-scope checker gets run, since the jump-scope checker requires (as its invariant) that all of the GotoStmts be wired up correctly. Fixes PR9495. llvm-svn: 127738
OpenPOWER on IntegriCloud