summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Perform code-completion within ParseCastExpression, which handles,Douglas Gregor2010-04-061-1/+6
| | | | | | e.g., the right-hand side of binary expressions. llvm-svn: 100526
* Fix an assertion-on-error during tentative constructor parsing byJohn McCall2010-02-261-1/+5
| | | | | | | | | | propagating error conditions out of the various annotate-me-a-snowflake routines. Generally (but not universally) removes redundant diagnostics as well as, you know, not crashing on bad code. On the other hand, I have just signed myself up to fix fiddly parser errors for the next week. Again. llvm-svn: 97221
* Restore the invariant that a nested-name-specifier can only containDouglas Gregor2010-02-251-1/+1
| | | | | | | | | class types, dependent types, and namespaces. I had previously weakened this invariant while working on parsing pseudo-destructor expressions, but recent work in that area has made these changes unnecessary. llvm-svn: 97112
* Rework parsing of pseudo-destructor expressions and explicitDouglas Gregor2010-02-241-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | destructor calls, e.g., p->T::~T We now detect when the member access that we've parsed, e.g., p-> or x. may be a pseudo-destructor expression, either because the type of p or x is a scalar or because it is dependent (and, therefore, may become a scalar at template instantiation time). We then parse the pseudo-destructor grammar specifically: ::[opt] nested-name-specifier[opt] type-name :: ∼ type-name and hand those results to a new action, ActOnPseudoDestructorExpr, which will cope with both dependent member accesses of destructors and with pseudo-destructor expressions. This commit affects the parsing of pseudo-destructors, only; the semantic actions still go through the semantic actions for member access expressions. That will change soon. llvm-svn: 97045
* Implement support for parsing pseudo-destructor expression with a ↵Douglas Gregor2010-02-211-1/+1
| | | | | | | | | | | | nested-name-specifier, e.g., typedef int Int; int *p; p->Int::~Int(); This weakens the invariant that the only types in nested-name-specifiers are tag types (restricted to class types in C++98/03). However, we weaken this invariant as little as possible, accepting arbitrary types in nested-name-specifiers only when we're in a member access expression that looks like a pseudo-destructor expression. llvm-svn: 96743
* When we're parsing an expression that may have looked like aDouglas Gregor2010-02-051-2/+38
| | | | | | | | | declaration, we can end up with template-id annotation tokens for types that have not been converted into type annotation tokens. When this is the case, translate the template-id into a type and parse as an expression. llvm-svn: 95404
* First stage of adding AltiVec supportJohn Thompson2010-02-051-0/+1
| | | | llvm-svn: 95335
* Improve code completion by introducing patterns for the various C andDouglas Gregor2010-01-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | C++ grammatical constructs that show up in top-level (namespace-level) declarations, member declarations, template declarations, statements, expressions, conditions, etc. For example, we now provide a pattern for static_cast<type>(expr) when we can have an expression, or using namespace identifier; when we can have a using directive. Also, improves the results of code completion at the beginning of a top-level declaration. Previously, we would see value names (function names, global variables, etc.); now we see types, namespace names, etc., but no values. llvm-svn: 93134
* When parsing an identifier as an expression in C++, only try to annotate itJohn McCall2010-01-071-3/+11
| | | | | | | | | | as a type or scope token if the next token requires it. This eliminates a lot of redundant lookups in C++, but there's room for improvement; a better solution would do a single lookup whose kind and results would be passed through the parser. llvm-svn: 92930
* If we enter parens, colons can become un-sacred, allowing us to emitChris Lattner2009-12-101-3/+9
| | | | | | a better diagnostic in the second example. llvm-svn: 91040
* fix a more evil case of : / :: confusion arising in ?:.Chris Lattner2009-12-101-0/+3
| | | | llvm-svn: 91039
* rename ExtensionRAIIObject.h -> RAIIObjectsForParser.hChris Lattner2009-12-101-1/+1
| | | | llvm-svn: 91008
* Introduce the notion of literal types, as specified in C++0x.Sebastian Redl2009-12-031-0/+1
| | | | llvm-svn: 90361
* Some fancy footwork to move the decision on how Fariborz Jahanian2009-11-251-11/+11
| | | | | | to build casted expression-list AST to Sema. llvm-svn: 89827
* Fix a recent regression probably caused by addition of altivec-styleFariborz Jahanian2009-11-231-1/+2
| | | | | | type-casts in the parser. llvm-svn: 89691
* Added rudimentary C++0x attribute support.Alexis Hunt2009-11-211-4/+4
| | | | | | | | | | | | | | The following attributes are currently supported in C++0x attribute lists (and in GNU ones as well): - align() - semantics believed to be conformant to n3000, except for redeclarations and what entities it may apply to - final - semantics believed to be conformant to CWG issue 817's proposed wording, except for redeclarations - noreturn - semantics believed to be conformant to n3000, except for redeclarations - carries_dependency - currently ignored (this is an optimization hint) llvm-svn: 89543
* This patch fixes a bug in misdiagnosing correctFariborz Jahanian2009-11-181-11/+0
| | | | | | use of pointer to data member. llvm-svn: 89251
* Remove a bunch of #if 0'd code made irrelevant by the latest ↵Douglas Gregor2009-11-031-106/+0
| | | | | | ParseUnqualifiedId changes llvm-svn: 85938
* Replace the code that parses member access expressions after "." orDouglas Gregor2009-11-031-0/+16
| | | | | | | | | | | | "->" with a use of ParseUnqualifiedId. Collapse ActOnMemberReferenceExpr, ActOnDestructorReferenceExpr (both of them), ActOnOverloadedOperatorReferenceExpr, ActOnConversionOperatorReferenceExpr, and ActOnMemberTemplateIdReferenceExpr into a single, new action ActOnMemberAccessExpr that does the same thing more cleanly (and can keep more source-location information). llvm-svn: 85930
* 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
OpenPOWER on IntegriCloud