summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/Parser.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Revers r138040. Need to look at a few buildbot failures.Fariborz Jahanian2011-08-191-10/+1
| | | | llvm-svn: 138049
* objective-c: Bring objective-c handling of decl contextFariborz Jahanian2011-08-191-1/+10
| | | | | | | | | | to modernity. Instead of passing down individual context objects from parser to sema, establish decl context in parser and have sema access current context as needed. I still need to take of Doug's comment for minor cleanups. llvm-svn: 138040
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-0/+3
| | | | llvm-svn: 136210
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-1/+1
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Some documentation fixes for the parser, from John FreemanDouglas Gregor2011-07-051-3/+2
| | | | llvm-svn: 134419
* Introduce DelayedCleanupPool useful for simplifying clean-up of certain ↵Argyrios Kyrtzidis2011-06-221-5/+16
| | | | | | | | | | resources that, while their lifetime is well-known and restricted, cleaning them up manually is easy to miss and cause a leak. Use it to plug the leaking of TemplateIdAnnotation objects. rdar://9634138. llvm-svn: 133610
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-111-0/+16
| | | | llvm-svn: 132878
* Add support for Microsoft __if_exists, __if_not_exists extension at class scope.Francois Pichet2011-05-251-2/+2
| | | | | | | | | | | | | | | | Example: typedef int TYPE; class C { __if_exists(TYPE) { TYPE a; } __if_not_exists(TYPE) { this will never be parsed. } }; llvm-svn: 132052
* Implement explicit specialization of explicitly-defaulted constructors.Alexis Hunt2011-05-231-68/+39
| | | | | | | | The general out-of-line case (including explicit instantiation mostly works except that the definition is being lost somewhere between the AST and CodeGen, so the definition is never emitted. llvm-svn: 131933
* Properly parse the 'default' and 'delete' keywords.Alexis Hunt2011-05-121-1/+80
| | | | | | | | | | | | | | | | | 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
* Add support for _if_exists and __if_not_exists at namespace/global scope.Francois Pichet2011-05-071-0/+83
| | | | llvm-svn: 131050
* Parsing/AST support for Structured Exception HandlingJohn Wiegley2011-04-281-0/+28
| | | | | | | | Patch authored by Sohail Somani. Provide parsing and AST support for Windows structured exception handling. llvm-svn: 130366
* Extend Sema::ClassifyName() to support C++, ironing out a few issuesDouglas Gregor2011-04-271-1/+2
| | | | | | | | | in the classification of template names and using declarations. We now properly typo-correct the leading identifiers in statements to types, templates, values, etc. As an added bonus, this reduces the number of lookups required for disambiguation. llvm-svn: 130288
* Recognize gcc's ms_struct pragma (and ignore for now).Fariborz Jahanian2011-04-251-0/+5
| | | | | | This is wip. llvm-svn: 130138
* Downgrade unnecessary "typename" from error to warning in Microsoft mode. Francois Pichet2011-04-241-1/+4
| | | | | | | | This fixes 1 error when parsing MSVC 2008 headers with clang. Must "return true;" even if it is a warning because the rest of the code path assumes that SS is set to something. The parser will get back on its feet and continue parsing the rest of the declaration correctly so it is not a problem. llvm-svn: 130088
* 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/+47
| | | | | | | | | 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
* C1X: implement static assertsPeter Collingbourne2011-04-151-0/+1
| | | | llvm-svn: 129555
* Improve recovery (error + fix-it) when parsing type dependent template name ↵Francois Pichet2011-03-271-1/+2
| | | | | | | | | | | without the "template" keyword. For example: typename C1<T>:: /*template*/ Iterator<0> pos; Also the error is downgraded to an ExtWarn in Microsoft mode. llvm-svn: 128387
* Extend the new 'availability' attribute with support for anDouglas Gregor2011-03-261-0/+1
| | | | | | | 'unavailable' argument, which specifies that the declaration to which the attribute appertains is unavailable on that platform. llvm-svn: 128329
* Insomniac refactoring: change how the parser allocates attributes so thatJohn McCall2011-03-241-2/+2
| | | | | | | | | AttributeLists do not accumulate over the lifetime of parsing, but are instead reused. Also make the arguments array not require a separate allocation, and make availability attributes store their stuff in augmented memory, too. llvm-svn: 128209
* Implement a new 'availability' attribute, that allows one to specifyDouglas Gregor2011-03-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which versions of an OS provide a certain facility. For example, void foo() __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6))); says that the function "foo" was introduced in 10.2, deprecated in 10.4, and completely obsoleted in 10.6. This attribute ties in with the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that we want to deploy back to Mac OS X 10.1). There are several concrete behaviors that this attribute enables, as illustrated with the function foo() above: - If we choose a deployment target >= Mac OS X 10.4, uses of "foo" will result in a deprecation warning, as if we had placed attribute((deprecated)) on it (but with a better diagnostic) - If we choose a deployment target >= Mac OS X 10.6, uses of "foo" will result in an "unavailable" warning (in C)/error (in C++), as if we had placed attribute((unavailable)) on it - If we choose a deployment target prior to 10.2, foo() is weak-imported (if it is a kind of entity that can be weak imported), as if we had placed the weak_import attribute on it. Naturally, there can be multiple availability attributes on a declaration, for different platforms; only the current platform matters when checking availability attributes. The only platforms this attribute currently works for are "ios" and "macosx", since we already have -mxxxx-version-min flags for them and we have experience there with macro tricks translating down to the deprecated/unavailable/weak_import attributes. The end goal is to open this up to other platforms, and even extension to other "platforms" that are really libraries (say, through a #pragma clang define_system), but that hasn't yet been designed and we may want to shake out more issues with this narrower problem first. Addresses <rdar://problem/6690412>. As a drive-by bug-fix, if an entity is both deprecated and unavailable, we only emit the "unavailable" diagnostic. llvm-svn: 128127
* Migrate 'PrettySTackTraceParserEntry' object out of Parser, and have it ↵Ted Kremenek2011-03-221-1/+1
| | | | | | | | constructed within ParseAST. This avoids double crashes during crash recovery. llvm-svn: 128056
* 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
* Fixed source range for FileScopeAsmDecl. Others source range fixes will follow.Abramo Bagnara2011-03-031-2/+4
| | | | llvm-svn: 126939
* Push nested-name-specifier source-location information into dependentDouglas Gregor2011-03-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | template specialization types. This also required some parser tweaks, since we were losing track of the nested-name-specifier's source location information in several places in the parser. Other notable changes this required: - Sema::ActOnTagTemplateIdType now type-checks and forms the appropriate type nodes (+ source-location information) for an elaborated-type-specifier ending in a template-id. Previously, we used a combination of ActOnTemplateIdType and ActOnTagTemplateIdType that resulted in an ElaboratedType wrapped around a DependentTemplateSpecializationType, which duplicated the keyword ("class", "struct", etc.) and nested-name-specifier storage. - Sema::ActOnTemplateIdType now gets a nested-name-specifier, which it places into the returned type-source location information. - Sema::ActOnDependentTag now creates types with source-location information. llvm-svn: 126808
* Reinstate the introduction of source-location information forDouglas Gregor2011-03-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | nested-name-speciciers within elaborated type names, e.g., enum clang::NestedNameSpecifier::SpecifierKind Fixes in this iteration include: (1) Compute the type-source range properly for a dependent template specialization type that starts with "template template-id ::", as in a member access expression dep->template f<T>::f() This is a latent bug I triggered with this change (because now we're checking the computed source ranges for dependent template specialization types). But the real problem was... (2) Make sure to set the qualifier range on a dependent template specialization type appropriately. This will go away once we push nested-name-specifier locations into dependent template specialization types, but it was the source of the valgrind errors on the buildbots. llvm-svn: 126765
* Revert r126748, my second attempt at nested-name-specifier sourceDouglas Gregor2011-03-011-3/+1
| | | | | | location information for elaborated types. *sigh* llvm-svn: 126753
* Reinstate r126737, extending the generation of type-source locationDouglas Gregor2011-03-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | information for qualifier type names throughout the parser to address several problems. The commit message from r126737: Push nested-name-specifier source location information into elaborated name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind". Aside from the normal changes, this also required some tweaks to the parser. Essentially, when we're looking at a type name (via getTypeName()) specifically for the purpose of creating an annotation token, we pass down the flag that asks for full type-source location information to be stored within the returned type. That way, we retain source-location information involving nested-name-specifiers rather than trying to reconstruct that information later, long after it's been lost in the parser. With this change, test/Index/recursive-cxx-member-calls.cpp is showing much improved results again, since that code has lots of nested-name-specifiers. llvm-svn: 126748
* Revert r126737, the most recent nested-name-specifier location change, for ↵Douglas Gregor2011-03-011-3/+1
| | | | | | buildbot breakage. llvm-svn: 126746
* Push nested-name-specifier source location information into elaboratedDouglas Gregor2011-03-011-1/+3
| | | | | | | | | | | | | | | | | | | name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind". Aside from the normal changes, this also required some tweaks to the parser. Essentially, when we're looking at a type name (via getTypeName()) specifically for the purpose of creating an annotation token, we pass down the flag that asks for full type-source location information to be stored within the returned type. That way, we retain source-location information involving nested-name-specifiers rather than trying to reconstruct that information later, long after it's been lost in the parser. With this change, test/Index/recursive-cxx-member-calls.cpp is showing much improved results again, since that code has lots of nested-name-specifiers. llvm-svn: 126737
* When we encounter a dependent template name within aDouglas Gregor2011-02-281-0/+1
| | | | | | | | | | | | nested-name-specifier, e.g., T::template apply<U>:: represent the dependent template name specialization as a DependentTemplateSpecializationType, rather than a TemplateSpecializationType with a dependent TemplateName. llvm-svn: 126593
* Eliminate a silly little Parse/Sema dance when parsing typenameDouglas Gregor2011-02-271-9/+11
| | | | | | | | | | | | | | | | | | | specifiers such as typename T::template apply<U> Previously, we would turn T::template apply<U> into a TemplateSpecializationType. Then, we'd reprocess that TemplateSpecializationType and turn it into either a TemplateSpecializationType wrapped in an ElaboratedType (when we could resolve "apply" to a template declaration) or a DependentTemplateSpecializationType. We now produce the same ASTs but without generating the intermediate TemplateSpecializationType. The end goal here is to avoid generating TemplateSpecializationTypes with dependent template-names, ever. We're not there yet. llvm-svn: 126589
* Retain complete source-location information for C++Douglas Gregor2011-02-241-2/+2
| | | | | | | | | | | | nested-name-specifiers throughout the parser, and provide a new class (NestedNameSpecifierLoc) that contains a nested-name-specifier along with its type-source information. Right now, this information is completely useless, because we don't actually store the source-location information anywhere in the AST. Call this Step 1/N. llvm-svn: 126391
* Better parser recovery when method isFariborz Jahanian2011-02-231-0/+4
| | | | | | | errornously defined inside an objc class. // rdar://7029784 llvm-svn: 126269
* OpenCL: add support for __kernel, kernel keywords and EXTENSION,Peter Collingbourne2011-02-141-0/+15
| | | | | | FP_CONTRACT pragmas. Patch originally by ARM. llvm-svn: 125475
* Move support for "#pragma STDC FP_CONTRACT" to Parser; add Sema actionsPeter Collingbourne2011-02-141-0/+5
| | | | llvm-svn: 125474
* Parse: add support for parsing CUDA kernel callsPeter Collingbourne2011-02-091-0/+2
| | | | llvm-svn: 125219
* Support for objextive-c++ use of property-dot syntax as receiverFariborz Jahanian2011-02-081-1/+2
| | | | | | | in liu of a class method getter. // rdar://8962253 llvm-svn: 125094
* Fix a crash-on-invalid where we were trying to parse C++ constructs inDouglas Gregor2011-02-041-2/+3
| | | | | | | C, then hitting an assertion because C code shouldn't try to parse optional nested-name-specifiers. Fixes PR9137. llvm-svn: 124860
* Lazily initialize the 'final' and 'override' contextual keywords as ↵Anders Carlsson2011-01-201-5/+2
| | | | | | suggested by Doug. llvm-svn: 123876
* Convert "#pragma unused(...)" into tokens for the parser.Argyrios Kyrtzidis2011-01-171-0/+4
| | | | | | | This allows us to cache a "#pragma unused" that occurs inside an inline C++ member function. Fixes rdar://8829590&8770988. llvm-svn: 123666
* Begin work on supporting "N3206: Override control: Eliminating Attributes", fromAnders Carlsson2011-01-161-0/+6
| | | | | | | | | http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm This lands support for parsing virt-specifier-seq after member functions, including the contextual keywords 'final', and 'override'. The keywords are not yet used for anything. llvm-svn: 123606
* Speed up code-completion by skipping function bodies.Argyrios Kyrtzidis2011-01-031-5/+7
| | | | | | | | | | | | | | When we are in code-completion mode, skip parsing of all function bodies except the one where the code-completion point resides. For big .cpp files like 'SemaExpr.cpp' the improvement makes a huge difference, in some cases cutting down code-completion time -62% ! We don't get diagnostics for the bodies though, so modify the code-completion tests that check for errors. See rdar://8814203. llvm-svn: 122765
* Refactor how we collect attributes during parsing, and add slots for attributesJohn McCall2010-12-241-32/+24
| | | | | | | on array and function declarators. This is pretty far from complete, and I'll revisit it later if someone doesn't beat me to it. llvm-svn: 122535
* Added ParenType type node.Abramo Bagnara2010-12-101-9/+5
| | | | llvm-svn: 121488
* Not content to implement just "extern" explicit templateDouglas Gregor2010-12-011-4/+30
| | | | | | | | | instantiations, GCC also supports "inline" and "static" explicit template instantiations. Parse and warn about such constructs, but don't implement the semantics of either "inline" or "static". They don't seem to be widely used. llvm-svn: 120599
* Refactoring.Argyrios Kyrtzidis2010-11-191-2/+1
| | | | | | Move ErrorTrap from clang/Sema to clang/Basic as DiagnosticErrorTrap and use it in Scope. llvm-svn: 119763
* Refactoring of Diagnostic class.Argyrios Kyrtzidis2010-11-181-1/+1
| | | | | | | | | | | -Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class. -DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units. -The rest of the state in Diagnostic object is considered related and tied to one translation unit. -Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a SourceLocation instead of a FullSourceLoc. -Reflect the changes to various interfaces. llvm-svn: 119730
* Add parsing support for Microsoft attributes. MS attributes will just be ↵Francois Pichet2010-10-111-0/+3
| | | | | | skipped and not inserted into the AST for now. llvm-svn: 116203
OpenPOWER on IntegriCloud