summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* compare.c also needs a target triple now, and improve some comments while we'reJohn McCall2009-11-061-7/+7
| | | | | | at it. llvm-svn: 86243
* Improve the -Wsign-compare heuristics:John McCall2009-11-062-5/+37
| | | | | | | | | | | | | * If the unsigned type is smaller than the signed type, never warn, because its value will not change when zero-extended to the larger type. * If we're testing for (in)equality, and the unsigned value is an integer constant whose sign bit is not set, never warn, because even though the signed value might change, it can't affect the result of the equality. Also make the comparison test cases much more rigorous, and have them expose the subtle differences between C and C++ here. llvm-svn: 86242
* Rework the fix-it hint for code likeDouglas Gregor2009-11-061-12/+32
| | | | | | | | | | | get_origin->x where get_origin is actually a function and the user has forgotten the parentheses. Instead of giving a lame note for the fix-it, give a full-fledge error, early, then build the call expression to try to recover. llvm-svn: 86238
* If we have a C-style cast, functional cast, or a static_cast to aDouglas Gregor2009-11-061-2/+2
| | | | | | | | | | class type, don't perform the array-to-pointer or function-to-pointer conversions, because we may end up binding a reference to a function or array. With this change, FileCheck now passes -fsyntax-only! llvm-svn: 86211
* When we encounter a derived-to-base conversion when performing anDouglas Gregor2009-11-061-1/+11
| | | | | | | implicit conversion sequence, check the validity of this conversion and then perform it. llvm-svn: 86210
* Minor cleanup of my last patch.Fariborz Jahanian2009-11-061-1/+1
| | | | llvm-svn: 86209
* This patch implements Sema for clause 13.3.3.1p4.Fariborz Jahanian2009-11-064-11/+30
| | | | | | | It has to do with vararg constructors used as conversion functions. Code gen needs work. This is WIP. llvm-svn: 86207
* Make sure that EnumConstantDecls always get a type, even when they have ↵Douglas Gregor2009-11-061-14/+20
| | | | | | type-dependent initializers. llvm-svn: 86197
* The signed/unsigned checker should not warn for value-dependent expressions, ↵Sebastian Redl2009-11-051-0/+5
| | | | | | and should especially not try to evaluate them. llvm-svn: 86173
* Be a little more careful when trying to extract a TypeDecl from a ↵Douglas Gregor2009-11-051-1/+2
| | | | | | enum/class/struct/union specifier; in invalid code, we may also see ClassTemplateDecls. llvm-svn: 86171
* Don't allow definitions of array variables without some size information in ↵Sebastian Redl2009-11-051-0/+10
| | | | | | C++. Fixed PR5401 llvm-svn: 86165
* Eliminate some false positives due to a thinko in the "'blah' isDouglas Gregor2009-11-051-11/+7
| | | | | | | always zero in this context" warning logic. Also, make the diagnostic itself more precise when referring to pointer values ("NULL" vs. "zero"). llvm-svn: 86143
* When collecting types for built-in candidates, make arrays decay to ↵Sebastian Redl2009-11-051-0/+4
| | | | | | pointers. Otherwise, subscripting an array leads to no candidates at all. Fixes PR5360. llvm-svn: 86140
* Allow the element type of arrays to be incomplete in C++.Sebastian Redl2009-11-051-17/+29
| | | | | | This fixes PR5048. Also fix a bug where zero-sized arrays weren't warned about when the size was unsigned. llvm-svn: 86136
* Fixed two places where we needed to force completion of a typeDouglas Gregor2009-11-054-11/+18
| | | | | | | | | | | | (without complaining if it fails) to get proper semantics: reference binding with a derived-to-base conversion and the enumeration of constructors for user-defined conversions. There are probably more cases to fix, but my prior attempt at statically ensuring that complete-type checking always happens failed. Perhaps I'll try again. With this change, Clang can parse include/llvm/*.h! llvm-svn: 86129
* Implement the conditional-operator part of -Wsign-compare. TurnJohn McCall2009-11-053-5/+12
| | | | | | | | | | | | DiagnoseSignCompare into Sema::CheckSignCompare and call it from more places. Add some enumerator tests. These seem to expose some oddities in the types we're converting C++ enumerators to; in particular, they're converting to unsigned before int, which seems to contradict 4.5 [conv.prom] p2. Note to self: stop baiting Doug in my commit messages. llvm-svn: 86128
* When instantiating a UnaryOperator, allow the resulting expression toDouglas Gregor2009-11-054-30/+49
| | | | | | | | | | | | | still be dependent or invoke an overloaded operator. Previously, we only supported builtin operators. BinaryOperator/CompoundAssignOperator didn't have this issue because we always built a CXXOperatorCallExpr node, even when name lookup didn't find any functions to save until instantiation time. Now, that code builds a BinaryOperator or CompoundAssignOperator rather than a CXXOperatorCallExpr, to save some space. llvm-svn: 86087
* Implement -Wsign-compare, or at least the actual comparison part of it.John McCall2009-11-051-0/+37
| | | | | | | | Conditional operands are next. Fixes part of rdar://problem/7289584. llvm-svn: 86083
* Make sure to grab CVR qualifiers from the canonical type. ARGH!Douglas Gregor2009-11-051-2/+2
| | | | llvm-svn: 86079
* When instantiating a MemberExpr, be sure to instantiate theDouglas Gregor2009-11-041-4/+33
| | | | | | explicitly-specified template arguments, too! llvm-svn: 86066
* Comments, formatting. Based on patch by Brandon Pearcy!John McCall2009-11-041-2/+8
| | | | llvm-svn: 86065
* Diagnose using a field to initialize itself. Patch by Brandon Pearcy!John McCall2009-11-041-0/+59
| | | | llvm-svn: 86061
* When starting a C++ member access expression, make sure to compute theDouglas Gregor2009-11-042-64/+75
| | | | | | | | | type of the object even when it is dependent. Specifically, this makes sure that we get the right type for "this->", which is important when performing name lookup into this scope to determine whether an identifier or operator-function-id is a template name. llvm-svn: 86060
* Fix a little canonical-types issue with non-type template arguments.Douglas Gregor2009-11-041-1/+1
| | | | | | Fixes PR5349. llvm-svn: 86052
* Don't try to check the initialization of fields with dependentDouglas Gregor2009-11-041-7/+16
| | | | | | | | types. Fixes PR5352. Fariborz, please review. llvm-svn: 86031
* Store the unresolved class type in MemberPointerType's Class field,Douglas Gregor2009-11-041-7/+22
| | | | | | from Peter Collingbourne! llvm-svn: 86030
* Switch parsing of using declarations over to ParseUnqualifiedId.Douglas Gregor2009-11-042-15/+28
| | | | llvm-svn: 86027
* Preserve type source information in sizeof/alignof expressions, and pass itJohn McCall2009-11-043-16/+20
| | | | | | through to indexing. llvm-svn: 86018
* When performing template instantiation (transformation) ofDouglas Gregor2009-11-042-94/+179
| | | | | | | | | expressions, keep track of whether we are immediately taking the address of the expression. Pass this flag when building a declaration name expression so that we handle pointer-to-member constants properly. llvm-svn: 86017
* Diagnose the use of 'fastcall' on functions without prototypes or withJohn McCall2009-11-041-0/+18
| | | | | | varargs prototypes. llvm-svn: 86001
* Diagnose __builtin_offsetof on incomplete types. FixesJohn McCall2009-11-041-0/+4
| | | | | | rdar://problem/7222956 llvm-svn: 85999
* Change our basic strategy for avoiding deprecation warnings when the decl useJohn McCall2009-11-047-65/+91
| | | | | | | | | | | | appears in a deprecated context. In the new strategy, we emit the warnings as usual unless we're currently parsing a declaration, where "declaration" is restricted to mean a decl group or a few special cases in Objective C. If we *are* parsing a declaration, we queue up the deprecation warnings until the declaration has been completely parsed, and then emit them only if the decl is not deprecated. We also standardize the bookkeeping for deprecation so as to avoid special cases. llvm-svn: 85998
* Implement support for parsing dependent template-ids that refer toDouglas Gregor2009-11-043-10/+64
| | | | | | | | overloaded operators, e.g., p->template operator+<T>() llvm-svn: 85989
* Refine volatile handling, specifically, we must have the canonicalMike Stump2009-11-031-1/+1
| | | | | | | type to look at the volatile specifier. I found these all from just hand auditing the code. llvm-svn: 85967
* Parsing and semantic analysis for template-ids that name overloadedDouglas Gregor2009-11-033-30/+60
| | | | | | | | | | | | operators, e.g., operator+<int> which now works in declarators, id-expressions, and member access expressions. This commit only implements the non-dependent case, where we can resolve the template-id to an actual declaration. llvm-svn: 85966
* We have to ensure we have the canonical type to do this. This is butMike Stump2009-11-031-1/+2
| | | | | | | one instance of a large problem. assert for non-canoical types would help track down these things. llvm-svn: 85956
* Remove previous patch for pr5296 due to further clarificationFariborz Jahanian2009-11-031-29/+1
| | | | | | of value-initialization and trivial constructors. llvm-svn: 85935
* Replace the code that parses member access expressions after "." orDouglas Gregor2009-11-035-202/+77
| | | | | | | | | | | | "->" 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-034-123/+99
| | | | | | | | | | | 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
* Introduce a new class, UnqualifiedId, that provides a parsedDouglas Gregor2009-11-034-52/+59
| | | | | | | | | | | | | | | | representation of a C++ unqualified-id, along with a single parsing function (Parser::ParseUnqualifiedId) that will parse all of the various forms of unqualified-id in C++. Replace the representation of the declarator name in Declarator with the new UnqualifiedId class, simplifying declarator-id parsing considerably and providing more source-location information to Sema. In the future, I hope to migrate all of the other unqualified-id-parsing code over to this single representation, then begin to merge actions that are currently only different because we didn't have a unqualified notion of the name in the parser. llvm-svn: 85851
* Assortment of property attributes declared in continuationFariborz Jahanian2009-11-031-2/+9
| | | | | | | class must match those of same property declared in its primary class. (Fixes radar 7352425) llvm-svn: 85843
* Property declared in continuation class can only be used toFariborz Jahanian2009-11-021-12/+6
| | | | | | | change a readonly property declared in the class (and its inherited protocols) to writable property. (Fixes radar 7350645). llvm-svn: 85836
* Diagnose implementation of a property declared in a categoryFariborz Jahanian2009-11-021-0/+8
| | | | | | in its class implementation instead of crashing. Fixes radar 7350345. llvm-svn: 85813
* When determining whether a reference to a static data member is anDouglas Gregor2009-11-011-1/+1
| | | | | | | | | integral constant expression, make sure to find where the initializer was provided---inside or outside the class definition---since that can affect whether we have an integral constant expression (and, we need to see the initializer itself). llvm-svn: 85741
* Within a template, qualified name lookup can refer to a non-dependent typeDouglas Gregor2009-11-011-0/+6
| | | | | | | | | that is not known to be a base class at template definition time due to some dependent base class. Treat qualified name lookup that refers to a non-static data member or function as implicit class member access when the "this" type would be dependent. llvm-svn: 85718
* Implement "incremental" template instantiation for non-type templateDouglas Gregor2009-10-313-58/+90
| | | | | | | | | | | | | | | parameters and template type parameters, which occurs when substituting into the declarations of member templates inside class templates. This eliminates errors about our inability to "reduce non-type template parameter depth", fixing PR5311. Also fixes a bug when instantiating a template type parameter declaration in a member template, where we weren't properly reducing the template parameter's depth. LLVM's StringSwitch header now parses. llvm-svn: 85669
* When a friend is declared in a dependent context, don't even try toDouglas Gregor2009-10-302-3/+12
| | | | | | match it up with a declaration in the outer scope. llvm-svn: 85628
* Instantiate class template friends better; fixes PR5332.Douglas Gregor2009-10-301-1/+8
| | | | llvm-svn: 85612
* Include macros in code-completion resultsDouglas Gregor2009-10-302-13/+88
| | | | llvm-svn: 85594
* warn about returning the address of a label.Chris Lattner2009-10-301-1/+6
| | | | llvm-svn: 85576
OpenPOWER on IntegriCloud