summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* remove some extraneous syntax: sourceloc implicitly converts to sourcerange.Chris Lattner2009-12-061-2/+2
| | | | llvm-svn: 90710
* Deduce a ConstantArrayType from a value-dependent initializer listDouglas Gregor2009-11-191-3/+25
| | | | | | | rather than punting to a DependentSizedArrayType, tightening up our type checking for template definitions. Thanks, John! llvm-svn: 89407
* Cope with an amusingly little anomaly with dependent types andDouglas Gregor2009-11-191-1/+22
| | | | | | | | | | | | | | | | | | incomplete array initialization, where we have the following in a template: int a[] = { 1, 2, something-value-dependent }; // ... sizeof(a); The type of "a" appears to be a non-dependent IncompleteArrayType, but treating it as such makes the sizeof(a) fail at template definition time. We now correctly handle this by morphing the IncompleteArrayType into a DependentSizedArrayType with a NULL expression, indicating that its size has no corresponding expression (and, therefore, the type is distinct from others). llvm-svn: 89366
* First part of changes to eliminate problems with cv-qualifiers andDouglas Gregor2009-11-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sugared types. The basic problem is that our qualifier accessors (getQualifiers, getCVRQualifiers, isConstQualified, etc.) only look at the current QualType and not at any qualifiers that come from sugared types, meaning that we won't see these qualifiers through, e.g., typedefs: typedef const int CInt; typedef CInt Self; Self.isConstQualified() currently returns false! Various bugs (e.g., PR5383) have cropped up all over the front end due to such problems. I'm addressing this problem by splitting each qualifier accessor into two versions: - the "local" version only returns qualifiers on this particular QualType instance - the "normal" version that will eventually combine qualifiers from this QualType instance with the qualifiers on the canonical type to produce the full set of qualifiers. This commit adds the local versions and switches a few callers from the "normal" version (e.g., isConstQualified) over to the "local" version (e.g., isLocalConstQualified) when that is the right thing to do, e.g., because we're printing or serializing the qualifiers. Also, switch a bunch of Context.getCanonicalType(T1).getUnqualifiedType() == Context.getCanonicalType(T2).getQualifiedType() expressions over to Context.hasSameUnqualifiedType(T1, T2) llvm-svn: 88969
* Remove the ConstantArrayType subtypes. This information is preserved in theJohn McCall2009-10-161-3/+3
| | | | | | | | | | TypeLoc records for declarations; it should not be necessary to represent it directly in the type system. Please complain if you were using these classes and feel you can't replicate previous functionality using the TypeLoc API. llvm-svn: 84222
* Improve diagnostic location information when checking the initialization of ↵Douglas Gregor2009-09-231-1/+2
| | | | | | a reference llvm-svn: 82666
* Change all the Type::getAsFoo() methods to specializations of Type::getAs().John McCall2009-09-211-5/+5
| | | | | | | | | | | Several of the existing methods were identical to their respective specializations, and so have been removed entirely. Several more 'leaf' optimizations were introduced. The getAsFoo() methods which imposed extra conditions, like getAsObjCInterfacePointerType(), have been left in place. llvm-svn: 82501
* Issue good diagnostics when initialization failes due toFariborz Jahanian2009-09-151-5/+17
| | | | | | ambiguity in type conversion function selection. llvm-svn: 81898
* Improve handling of initialization by constructor, by ensuring thatDouglas Gregor2009-09-091-12/+32
| | | | | | | | such initializations properly convert constructor arguments and fill in default arguments where necessary. This also makes the ownership model more clear. llvm-svn: 81394
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-150/+150
| | | | llvm-svn: 81346
* BuildCXXConstructExpr now takes a MultiExprArg.Anders Carlsson2009-09-071-1/+2
| | | | llvm-svn: 81160
* Pass the ConstructLoc to BuildCXXConstructExpr.Anders Carlsson2009-09-051-1/+2
| | | | llvm-svn: 81068
* Add an InOverloadResolution flag to TryCopyInitialization.Anders Carlsson2009-08-271-1/+2
| | | | llvm-svn: 80261
* Remove more default arguments.Anders Carlsson2009-08-271-2/+8
| | | | llvm-svn: 80260
* Remove default argument from TryCopyInitialization.Anders Carlsson2009-08-271-1/+4
| | | | llvm-svn: 80256
* BuildCXXConstructExpr now returns an OwningExprResult.Anders Carlsson2009-08-251-1/+7
| | | | llvm-svn: 79975
* AddInitializerToDecl can't take a FullExprArg. Make it take an ExprArg, and ↵Anders Carlsson2009-08-161-4/+1
| | | | | | create the CXXExprWithTemporaries before setting the initializer on the VarDecl. llvm-svn: 79176
* BuildCXXConstructExpr doesn't need to take an ASTContext.Anders Carlsson2009-08-151-2/+1
| | | | llvm-svn: 79149
* Take 2 on AltiVec-style vector initializers. Nate Begeman2009-08-101-7/+38
| | | | | | | | | | | | 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-38/+7
| | | | | | | | | | | | | | | | | | | | | | | | --- 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-7/+38
| | | | | | | | 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
* Set and use Elidable in elimination of copy ctors.Fariborz Jahanian2009-08-061-2/+3
| | | | llvm-svn: 78331
* Handle destruction of temporaries used in default argumentFariborz Jahanian2009-08-051-0/+1
| | | | | | construction of constructor calls. llvm-svn: 78222
* Patch to improve ir-gen for constructors with default argumentFariborz Jahanian2009-08-051-2/+2
| | | | | | expressions and a test case. llvm-svn: 78213
* Canonicalize else.Mike Stump2009-08-041-4/+3
| | | | llvm-svn: 78102
* Change uses of:Ted Kremenek2009-07-291-10/+10
| | | | | | | | | | | | | | | | | | | | Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsRecordType() -> Type::getAs<RecordType>() Type::getAsPointerType() -> Type::getAs<PointerType>() Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>() Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>() Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>() Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>() Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsTagType() -> Type::getAs<TagType>() And remove Type::getAsReferenceType(), etc. This change is similar to one I made a couple weeks ago, but that was partly reverted pending some additional design discussion. With Doug's pending smart pointer changes for Types, it seemed natural to take this approach. llvm-svn: 77510
* Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methodsTed Kremenek2009-07-171-10/+10
| | | | | | | | | until Doug Gregor's Type smart pointer code lands (or more discussion occurs). These methods just call the new Type::getAs<XXX> methods, so we still have reduced implementation redundancy. Having explicit getAsXXXType() methods makes it easier to set breakpoints in the debugger. llvm-svn: 76193
* Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), ↵Ted Kremenek2009-07-171-10/+10
| | | | | | Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents. llvm-svn: 76139
* Extra vector element initializers in OpenCL is an error, not a warning.Nate Begeman2009-07-071-0/+4
| | | | llvm-svn: 74951
* Keep track of the Expr used to describe the size of an array type,Douglas Gregor2009-07-061-2/+3
| | | | | | from Enea Zaffanella! llvm-svn: 74831
* De-ASTContext-ify DeclContext.Argyrios Kyrtzidis2009-06-301-15/+14
| | | | | | | Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating". Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit. llvm-svn: 74506
* Improve error recovery in C++: when we hit 'implicit int' cases in C++,Chris Lattner2009-06-261-5/+4
| | | | | | | | | | these are usually because the parser was thoroughly confused. In addition to typing the value being declared as an int and hoping for the best, we mark the value as invalid so we don't get chains of errors when it is used downstream. In C, implicit int actually is valid, so typing the thing as int is good and marking it invalid is bad. :) llvm-svn: 74266
* Allow initializing a vector with a vector in addition to allowing a list Eli Friedman2009-06-131-1/+1
| | | | | | of the elements. Issue reported on cfe-dev by Mattias Holm. llvm-svn: 73292
* Fix for PR4285: allow intializing a const wchar_t array with a wide Eli Friedman2009-05-311-8/+10
| | | | | | string. llvm-svn: 72663
* Remove VarDecl from CXXConstructExpr.Anders Carlsson2009-05-301-2/+2
| | | | llvm-svn: 72633
* Remove VarDecl from CheckInitializerTypes now that CXXConstructExpr doesn't ↵Anders Carlsson2009-05-301-6/+3
| | | | | | need to take a VarDecl anymore. (It still does, but it won't for long) llvm-svn: 72630
* Make sure we don't give the wrong warning, and make sure not to set Eli Friedman2009-05-291-6/+9
| | | | | | | hadError (suppressing future diagnostics) if we didn't print an error. llvm-svn: 72588
* Add an assertion so that we don't accidentally build constant arrays of Eli Friedman2009-05-291-1/+1
| | | | | | VLAs. llvm-svn: 72587
* Revert r72575, which isn't really right, and fix up other code to Eli Friedman2009-05-291-20/+20
| | | | | | handle the construct in question correctly. llvm-svn: 72581
* Avoid dumping during semantic analysis when checking array types whenMike Stump2009-05-291-15/+16
| | | | | | a vla is used. llvm-svn: 72575
* Fix another test case.Anders Carlsson2009-05-271-0/+8
| | | | llvm-svn: 72478
* Relax an assert to an if check.Anders Carlsson2009-05-271-3/+3
| | | | llvm-svn: 72477
* Create CXXConstructExprs when constructing via copy initialization.Anders Carlsson2009-05-271-2/+10
| | | | llvm-svn: 72474
* Template instantiation for GNU array-range designators.Douglas Gregor2009-05-211-1/+1
| | | | llvm-svn: 72234
* Template instantiation for C99 designated initializers, because weDouglas Gregor2009-05-211-5/+16
| | | | | | | | can. Also, delay semantic analysis of initialization for value-dependent as well as type-dependent expressions, since we can't always properly type-check a value-dependent expression. llvm-svn: 72233
* Use v.data() instead of &v[0] when SmallVector v might be empty.Jay Foad2009-05-211-2/+3
| | | | llvm-svn: 72210
* PR3009: Get rid of bogus warning for scalar compound literals.Eli Friedman2009-05-161-1/+1
| | | | | | | | | This patch isn't quite ideal in that it eliminates the warning for constructs like "int a = {1};", where the braces are in fact redundant. However, that would have required a bunch of refactoring, and it's much less likely to cause confusion compared to redundant nested braces. llvm-svn: 71939
* Reflow some comments.Mike Stump2009-05-161-18/+16
| | | | llvm-svn: 71936
* Replace more release+static_cast with takeAs.Anders Carlsson2009-05-011-2/+1
| | | | llvm-svn: 70567
* fix PR4073 by making designated initializer checking code useChris Lattner2009-04-251-28/+16
| | | | | | | | | | | | | | VerifyIntegerConstantExpression instead of isIntegerConstantExpr. This makes it ext-warn but tolerate things that fold to a constant but that are not valid i-c-e's. There must be a bug in the i-c-e computation though, because it doesn't catch this case even with pedantic. This also switches the later code to use EvaluateAsInt which is simpler and handles everything that evaluate does. llvm-svn: 70081
OpenPOWER on IntegriCloud