summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Use ParseUnqualifiedId when parsing id-expressions. This eliminatesDouglas Gregor2009-11-031-1/+5
| | | | | | | | | | | yet another copy of the unqualified-id parsing code. Also, use UnqualifiedId to simplify the Action interface for building id-expressions. ActOnIdentifierExpr, ActOnCXXOperatorFunctionIdExpr, ActOnCXXConversionFunctionExpr, and ActOnTemplateIdExpr have all been removed in favor of the new ActOnIdExpression action. llvm-svn: 85904
* simplify Sema::getTypeName a bit: if control gets out of the switch,Chris Lattner2009-10-251-1/+1
| | | | | | | IIDecl cannot be null. There is no need to check for both C++ mode and presence of CXXRecordDecl. ObjC interfaces can't have ScopeSpecs. llvm-svn: 85057
* In objc mode, every identifier in a cast expression was using doing aChris Lattner2009-10-251-18/+17
| | | | | | | | | | type looking using getTypeName() and every property access was using NextToken() to do lookahead to see if the identifier is followed by a '.'. Rearrange this code to not need lookahead and only do the type lookup if we have "identifier." in the token stream. Also improve a diagnostic a bit. llvm-svn: 85056
* Diagnose misuse of '.*' and '->*' operators during parseFariborz Jahanian2009-10-231-1/+12
| | | | | | instead of crashing in code gen. llvm-svn: 84968
* Parse a simple-template-id following a '~' when calling a destructor, e.g.,Douglas Gregor2009-10-191-7/+35
| | | | | | | | t->~T<A0, A1>() Fixes PR5213. llvm-svn: 84545
* Pass the right SourceLocation to ↵Anders Carlsson2009-10-131-2/+4
| | | | | | Actions.ActOnOverloadedOperatorReferenceExpr and Actions.ActOnConversionOperatorReferenceExpr. Update incomplete-call.cpp test. llvm-svn: 84026
* Implement code completion within a function call, triggered after theDouglas Gregor2009-09-221-2/+19
| | | | | | | | | | | | | | | | | | | | | opening parentheses and after each comma. We gather the set of visible overloaded functions, perform "partial" overloading based on the set of arguments that we have thus far, and return the still-viable results sorted by the likelihood that they will be the best candidate. Most of the changes in this patch are a refactoring of the overloading routines for a function call, since we needed to separate out the notion of building an overload set (common to code-completion and normal semantic analysis) and then what to do with that overload set. As part of this change, I've pushed explicit template arguments into a few more subroutines. There is still much more work to do in this area. Function templates won't be handled well (unless we happen to deduce all of the template arguments before we hit the completion point), nor will overloaded function-call operators or calls to member functions. llvm-svn: 82549
* Code completion for ordinary names when we're starting a declaration, ↵Douglas Gregor2009-09-211-0/+5
| | | | | | expression, or statement llvm-svn: 82481
* Initial implementation of a code-completion interface in Clang. InDouglas Gregor2009-09-171-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | essence, code completion is triggered by a magic "code completion" token produced by the lexer [*], which the parser recognizes at certain points in the grammar. The parser then calls into the Action object with the appropriate CodeCompletionXXX action. Sema implements the CodeCompletionXXX callbacks by performing minimal translation, then forwarding them to a CodeCompletionConsumer subclass, which uses the results of semantic analysis to provide code-completion results. At present, only a single, "printing" code completion consumer is available, for regression testing and debugging. However, the design is meant to permit other code-completion consumers. This initial commit contains two code-completion actions: one for member access, e.g., "x." or "p->", and one for nested-name-specifiers, e.g., "std::". More code-completion actions will follow, along with improved gathering of code-completion results for the various contexts. [*] In the current -code-completion-dump testing/debugging mode, the file is truncated at the completion point and EOF is translated into "code completion". llvm-svn: 82166
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-52/+52
| | | | llvm-svn: 81346
* Initial stab at implement dependent member references to memberDouglas Gregor2009-09-091-2/+4
| | | | | | | | | | | | | templates, e.g., x.template get<T> We can now parse these, represent them within an UnresolvedMemberExpr expression, then instantiate that expression node in simple cases. This allows us to stumble through parsing LLVM's Casting.h. llvm-svn: 81300
* If a destructor is referenced or a pseudo-destructor expression isDouglas Gregor2009-09-041-1/+2
| | | | | | | formed without a trailing '(', diagnose the error (these expressions must be immediately called), emit a fix-it hint, and fix the code. llvm-svn: 81015
* Rewrite of our handling of name lookup in C++ member access expressions, e.g.,Douglas Gregor2009-09-021-13/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | x->Base::f We no longer try to "enter" the context of the type that "x" points to. Instead, we drag that object type through the parser and pass it into the Sema routines that need to know how to perform lookup within member access expressions. We now implement most of the crazy name lookup rules in C++ [basic.lookup.classref] for non-templated code, including performing lookup both in the context of the type referred to by the member access and in the scope of the member access itself and then detecting ambiguities when the two lookups collide (p1 and p4; p3 and p7 are still TODO). This change also corrects our handling of name lookup within template arguments of template-ids inside the nested-name-specifier (p6; we used to look into the scope of the object expression for them) and fixes PR4703. I have disabled some tests that involve member access expressions where the object expression has dependent type, because we don't yet have the ability to describe dependent nested-name-specifiers starting with an identifier. llvm-svn: 80843
* Add parsing for references to member function templates with explicitDouglas Gregor2009-08-311-1/+24
| | | | | | | | template argument lists, e.g., x.f<int>(). Semantic analysis will be a separate commit. llvm-svn: 80624
* Support explicit C++ member operator syntax, from James Porter!Douglas Gregor2009-08-311-2/+29
| | | | llvm-svn: 80608
* Address some of Doug's comments.Anders Carlsson2009-08-261-1/+1
| | | | llvm-svn: 80114
* Parsing of pseudo-destructors.Anders Carlsson2009-08-251-8/+24
| | | | llvm-svn: 80055
* Keep track of the right paren ')' source location in a function declarator.Argyrios Kyrtzidis2009-08-191-1/+2
| | | | llvm-svn: 79489
* Implement __is_empty. Patch by Sean Hunt.Eli Friedman2009-08-151-0/+1
| | | | llvm-svn: 79143
* Take 2 on AltiVec-style vector initializers. Nate Begeman2009-08-101-8/+23
| | | | | | | | | | | | Fixes PR4704 problems Addresses Eli's patch feedback re: ugly cast code Updates all postfix operators to remove ParenListExprs. While this is awful, no better solution (say, in the parser) is obvious to me. Better solutions welcome. llvm-svn: 78621
* Revert r78535, it is causing a number of failures to build projects.Daniel Dunbar2009-08-101-23/+8
| | | | | | | | | | | | | | | | | | | | | | | | --- Reverse-merging r78535 into '.': D test/Sema/altivec-init.c U include/clang/Basic/DiagnosticSemaKinds.td U include/clang/AST/Expr.h U include/clang/AST/StmtNodes.def U include/clang/Parse/Parser.h U include/clang/Parse/Action.h U tools/clang-cc/clang-cc.cpp U lib/Frontend/PrintParserCallbacks.cpp U lib/CodeGen/CGExprScalar.cpp U lib/Sema/SemaInit.cpp U lib/Sema/Sema.h U lib/Sema/SemaExpr.cpp U lib/Sema/SemaTemplateInstantiateExpr.cpp U lib/AST/StmtProfile.cpp U lib/AST/Expr.cpp U lib/AST/StmtPrinter.cpp U lib/Parse/ParseExpr.cpp U lib/Parse/ParseExprCXX.cpp llvm-svn: 78551
* AltiVec-style vector initializer syntax, vec4 a = (vec4)(a, b, c, d);Nate Begeman2009-08-091-8/+23
| | | | | | | | In addition to being defined by the AltiVec PIM, this is also the vector initializer syntax used by OpenCL, so that vector literals are compatible with macro arguments. llvm-svn: 78535
* Support nested-name-specifiers for C++ member access expressions, e.g.,Douglas Gregor2009-08-061-1/+15
| | | | | | | | this->Base::foo from James Porter! llvm-svn: 78278
* This patch fixes the implementations of the __has_trivial_destructorDouglas Gregor2009-07-231-0/+2
| | | | | | | | and __has_trivial_constructor builtin pseudo-functions and additionally implements __has_trivial_copy and __has_trivial_assign, from John McCall! llvm-svn: 76916
* Basic support for C++0x unicode types. Support for literals will follow in ↵Alisdair Meredith2009-07-141-0/+2
| | | | | | an incremental patch llvm-svn: 75622
* Preliminary parsing and ASTs for template-ids that refer to functionDouglas Gregor2009-06-301-1/+1
| | | | | | | templates, such as make<int&>. These template-ids are only barely functional for function calls; much more to come. llvm-svn: 74563
* Fix the parser error hanlding for __builtin_offsetof to actually print Eli Friedman2009-06-271-6/+7
| | | | | | out an error for a malformed __builtin_offsetof. llvm-svn: 74388
* Rework the way we track which declarations are "used" duringDouglas Gregor2009-06-221-3/+6
| | | | | | | | | | | | | | | | | | | | | compilation, and (hopefully) introduce RAII objects for changing the "potentially evaluated" state at all of the necessary places within Sema and Parser. Other changes: - Set the unevaluated/potentially-evaluated context appropriately during template instantiation. - We now recognize three different states while parsing or instantiating expressions: unevaluated, potentially evaluated, and potentially potentially evaluated (for C++'s typeid). - When we're in a potentially potentially-evaluated context, queue up MarkDeclarationReferenced calls in a stack. For C++ typeid expressions that are potentially evaluated, we will play back these MarkDeclarationReferenced calls when we exit the corresponding potentially potentially-evaluated context. - Non-type template arguments are now parsed as constant expressions, so they are not potentially-evaluated. llvm-svn: 73899
* Keep track of when declarations are "used" according to C andDouglas Gregor2009-06-191-1/+21
| | | | | | | | | | | | C++. This logic is required to trigger implicit instantiation of function templates and member functions of class templates, which will be implemented separately. This commit includes support for -Wunused-parameter, printing warnings for named parameters that are not used within a function/Objective-C method/block. Fixes <rdar://problem/6505209>. llvm-svn: 73797
* PR4364: fix parsing 'typename' in an expression.Eli Friedman2009-06-111-1/+7
| | | | llvm-svn: 73177
* Disallow exception specs on typedefs.Sebastian Redl2009-05-311-1/+2
| | | | llvm-svn: 72664
* Reject incomplete types in exception specs.Sebastian Redl2009-05-291-1/+1
| | | | llvm-svn: 72580
* Handle correctly a very ugly part of the C++ syntax. We cannot disambiguate ↵Argyrios Kyrtzidis2009-05-221-3/+34
| | | | | | | | | | | | | | between a parenthesized type-id and a paren expression without considering the context past the parentheses. Behold: (T())x; - type-id (T())*x; - type-id (T())/x; - expression (T()); - expression llvm-svn: 72260
* Factor the compound literal parsing out from ParseParenExpression and into a ↵Argyrios Kyrtzidis2009-05-221-7/+21
| | | | | | | | new ParseCompoundLiteralExpression. No functionality change. llvm-svn: 72259
* Modification to ParseParenExpression.Argyrios Kyrtzidis2009-05-221-16/+25
| | | | | | Now it parses the cast expression unless 'stopIfCastExpr' is true. llvm-svn: 72258
* Refactor the common code of 'ParseTypeofSpecifier' and ↵Argyrios Kyrtzidis2009-05-221-19/+72
| | | | | | | | 'ParseSizeofAlignofExpression' into a new 'ParseExprAfterTypeofSizeofAlignof' method. llvm-svn: 72256
* Merge the ASTVector and ASTOwningVector templates, since they offeredDouglas Gregor2009-05-211-1/+0
| | | | | | | | redundant functionality. The result (ASTOwningVector) lives in clang/Parse/Ownership.h and is used by both the parser and semantic analysis. No intended functionality change. llvm-svn: 72214
* Use v.data() instead of &v[0] when SmallVector v might be empty.Jay Foad2009-05-211-1/+1
| | | | llvm-svn: 72210
* Make the RAII extension warning silencing for __extension__ a bit Eli Friedman2009-05-161-2/+8
| | | | | | | narrower, so it doesn't catch expresions that aren't sub-expressions of __extension__ operator. llvm-svn: 71967
* Fixup __extension__ i = 1 parsing. Thanks Eli!Mike Stump2009-05-161-1/+1
| | | | llvm-svn: 71927
* Fixup parsing for (throw,throw) and __extension__ throw 1.Mike Stump2009-05-151-9/+2
| | | | llvm-svn: 71897
* Implement C++0x nullptr.Sebastian Redl2009-05-101-0/+4
| | | | llvm-svn: 71405
* Remove extra line.Mike Stump2009-04-291-1/+0
| | | | llvm-svn: 70418
* Fixup Sema and CodeGen for block literal attributes when the returnMike Stump2009-04-291-0/+4
| | | | | | | | type and argument types are missing, and let return type deduction happen before we give errors for returning from a noreturn block. Radar 6441502 llvm-svn: 70413
* Sema and CodeGen support for attributes on blocks. Radar 6441502Mike Stump2009-04-291-0/+21
| | | | llvm-svn: 70403
* Have the parser communicate the exception specification to the action.Sebastian Redl2009-04-291-2/+3
| | | | llvm-svn: 70389
* This is a pretty big cleanup for how invalid decl/type are handle.Chris Lattner2009-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This gets rid of a bunch of random InvalidDecl bools in sema, changing us to use the following approach: 1. When analyzing a declspec or declarator, if an error is found, we set a bit in Declarator saying that it is invalid. 2. Once the Decl is created by sema, we immediately set the isInvalid bit on it from what is in the declarator. From this point on, sema consistently looks at and sets the bit on the decl. This gives a very clear separation of concerns and simplifies a bunch of code. In addition to this, this patch makes these changes: 1. it renames DeclSpec::getInvalidType() -> isInvalidType(). 2. various "merge" functions no longer return bools: they just set the invalid bit on the dest decl if invalid. 3. The ActOnTypedefDeclarator/ActOnFunctionDeclarator/ActOnVariableDeclarator methods now set invalid on the decl returned instead of returning an invalid bit byref. 4. In SemaType, refering to a typedef that was invalid now propagates the bit into the resultant type. Stuff declared with the invalid typedef will now be marked invalid. 5. Various methods like CheckVariableDeclaration now return void and set the invalid bit on the decl they check. There are a few minor changes to tests with this, but the only major bad result is test/SemaCXX/constructor-recovery.cpp. I'll take a look at this next. llvm-svn: 70020
* fix two error paths out of ParseBlockLiteralExpression toChris Lattner2009-04-181-0/+2
| | | | | | | | call ActOnBlockError so that CurBlock gets popped. This fixes a crash on test/block-syntax-error.c when this new assertion is enabled. llvm-svn: 69464
* Add support for the __has_trivial_destructor type trait.Anders Carlsson2009-04-171-1/+2
| | | | llvm-svn: 69345
* Fix a crash bug when comparing overload quality of conversion operators with ↵Sebastian Redl2009-04-161-1/+12
| | | | | | | | | | | conversion constructors. Remove an atrocious amount of trailing whitespace in the overloaded operator mangler. Sorry, couldn't help myself. Change the DeclType parameter of Sema::CheckReferenceInit to be passed by value instead of reference. It wasn't changed anywhere. Let the parser handle C++'s irregular grammar around assignment-expression and conditional-expression. And finally, the reason for all this stuff: implement C++ semantics for the conditional operator. The implementation is complete except for determining lvalueness. llvm-svn: 69299
OpenPOWER on IntegriCloud