summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Reinstate r97674 with a fix for the assertion that was firing in <list>Douglas Gregor2010-03-036-48/+140
| | | | llvm-svn: 97686
* Revert r97674; it's causing failuresDouglas Gregor2010-03-036-138/+46
| | | | llvm-svn: 97677
* Implement disambiguation of base class members via aDouglas Gregor2010-03-036-46/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | nested-name-specifier. For example, this allows member access in diamond-shaped hierarchies like: struct Base { void Foo(); int Member; }; struct D1 : public Base {}; struct D2 : public Base {}; struct Derived : public D1, public D2 { } void Test(Derived d) { d.Member = 17; // error: ambiguous cast from Derived to Base d.D1::Member = 17; // error: okay, modify D1's Base's Member } Fixes PR5820 and <rdar://problem/7535045>. Also, eliminate some redundancy between Sema::PerformObjectMemberConversion() and Sema::PerformObjectArgumentInitialization() -- the latter now calls the former. llvm-svn: 97674
* Suppress implicit member redeclarations arising from explicit instantiationJohn McCall2010-03-021-0/+1
| | | | | | | | | | | | declarations after the member has been explicitly specialized. We already did this after explicit instantiation definitions; not doing it for declarations meant that subsequent definitions would see a previous member declaration with specialization kind "explicit instantiation decl", which would then happily get overridden. Fixes PR 6458. llvm-svn: 97605
* During codegen assert that any copy assignment, destructor or constructor thatRafael Espindola2010-03-022-43/+87
| | | | | | | | we need to synthesize has been marked as used by Sema. Change Sema to avoid these asserts. llvm-svn: 97589
* Diagnose the declaration of enum templates. Also, be a bit moreDouglas Gregor2010-03-021-3/+4
| | | | | | careful about value-dependent enumerators. Fixes PR5786. llvm-svn: 97570
* Use CXXTemporaryObjectExpr for explicitly-constructed temporaries. WeDouglas Gregor2010-03-022-5/+28
| | | | | | | used to do this, but it got lost when we switched functional-style cast syntax over to using the new initialization code. Fixes PR6457. llvm-svn: 97568
* Unify initializer-instantiation code for variable declarations andDouglas Gregor2010-03-021-85/+93
| | | | | | base/member initializers. llvm-svn: 97560
* Split out types that are non-canonical unless dependent as their ownJohn McCall2010-03-011-0/+21
| | | | | | | | | | | category. Use this in a few places to eliminate unnecessary TST cases and do some future-proofing. Provide terrible manglings for typeof. Mangle decltype with some hope of accuracy. Our manglings for some of the cases covered in the testcase are different from gcc's, which I've raised as an issue with the ABI list. llvm-svn: 97523
* Keep an explicit stack of function and block scopes, each element ofDouglas Gregor2010-03-018-136/+197
| | | | | | | | | | | | | | | | | | | | which has the label map, switch statement stack, etc. Previously, we had a single set of maps in Sema (for the function) along with a stack of block scopes. However, this lead to funky behavior with nested functions, e.g., in the member functions of local classes. The explicit-stack approach is far cleaner, and we retain a 1-element cache so that we're not malloc/free'ing every time we enter a function. Fixes PR6382. Also, tweaked the unused-variable warning suppression logic to look at errors within a given Scope rather than within a given function. The prior code wasn't looking at the right number-of-errors count when dealing with blocks, since the block's count would be deallocated before we got to ActOnPopScope. This approach works with nested blocks/functions, and gives tighter error recovery. llvm-svn: 97518
* Fix the lookup of names used in a friend declaration to not attempt toChandler Carruth2010-03-011-2/+3
| | | | | | | re-declare them. This fixes PR6317. Also add the beginnings of an interesting test case for p1 of [class.friend] which also covers PR6317. llvm-svn: 97499
* fix PR5933: don't warn about unused variables if a function has other errors ↵Chris Lattner2010-03-011-1/+2
| | | | | | in it. llvm-svn: 97498
* Implement jump checking for initialized c++ variables, implementingChris Lattner2010-03-016-12/+41
| | | | | | | | | | | | | | | | | | a fixme and PR6451. Only perform jump checking if the containing function has no errors, and add the infrastructure needed to do this. On the testcase in the PR, we produce: t.cc:6:3: error: illegal goto into protected scope goto later; ^ t.cc:7:5: note: jump bypasses variable initialization X x; ^ llvm-svn: 97497
* Start detangling the BlockSemaInfo/Sema mess. No functionality change.Douglas Gregor2010-03-012-22/+37
| | | | llvm-svn: 97494
* When looking for a redeclaration of a static variable, only look for ↵Douglas Gregor2010-03-011-1/+1
| | | | | | redeclarations. Fixes PR6449 llvm-svn: 97478
* When instantiating a function-scoped enum, make sure that it and itsDouglas Gregor2010-03-012-1/+10
| | | | | | | enumeration constants get placed into the local instantiation hash table. Fixes PR6375. llvm-svn: 97471
* Robustify instantiation of templates when there are errors in theDouglas Gregor2010-03-012-2/+4
| | | | | | | | | template definition. Do this both by being more tolerant of errors in our asserts and by not dropping a variable declaration completely when its initializer is ill-formed. Fixes the crash-on-invalid in PR6375, but not the original issue. llvm-svn: 97463
* Finish pushing source-location information though TreeTransform'sDouglas Gregor2010-03-012-8/+17
| | | | | | TransformDefinition. llvm-svn: 97445
* When looking for the instantiated declaration that corresponds to aDouglas Gregor2010-03-014-42/+86
| | | | | | | given declaration in a template, make sure that the context we're searching through is complete. Fixes PR6376. llvm-svn: 97444
* Don't warn about case-value conversions from a negative value to aDouglas Gregor2010-03-011-7/+5
| | | | | | | | larger unsigned value, since this is implementation-defined behavior. (We previously suppressed this warning when converting from a signed value to an unsigned value of the same size). llvm-svn: 97430
* Warn about the deprecated string literal -> char* conversion. Fixes PR6428.Douglas Gregor2010-02-283-6/+11
| | | | llvm-svn: 97404
* Add an overload of Preprocessor::getSpelling which takes a SmallVector andBenjamin Kramer2010-02-271-5/+3
| | | | | | returns a StringRef. Use it to simplify some repetitive code. llvm-svn: 97322
* Fix crasher caused by setting a bit in a possibly empty bitvector whileTed Kremenek2010-02-271-1/+6
| | | | | | doing printf format string checking. This is a recent regression. llvm-svn: 97318
* For printf format string checking, add support for positional format strings.Ted Kremenek2010-02-271-20/+53
| | | | | | Along the way, coelesce some of the diagnostics. llvm-svn: 97297
* Skip dependent virtual base classes; fixes PR6413.Douglas Gregor2010-02-271-1/+4
| | | | llvm-svn: 97291
* At sabre's request, drop the FP bounds diagnostics down to warnings and fileJohn McCall2010-02-261-2/+2
| | | | | | them under -Wbad-literal. They're still on by default. llvm-svn: 97284
* For printf format string checking, move the tracking of the data argument ↵Ted Kremenek2010-02-261-28/+55
| | | | | | | | | index out of Sema and into analyze_printf::ParseFormatString(). Also use a bitvector to determine what arguments have been covered (instead of just checking to see if the last argument consumed is the max argument). This is prep. for support positional arguments (an IEEE extension). llvm-svn: 97248
* An explicit specialization is allowed following an explicitDouglas Gregor2010-02-261-7/+41
| | | | | | | instantiation so long as that explicit specialization was declared previously. Fixes PR6160. llvm-svn: 97210
* Implement semantic analysis for C++ [expr.new]p18-20, which describeDouglas Gregor2010-02-261-2/+133
| | | | | | | | | | how we find the operator delete that matches withe operator new we found in a C++ new-expression. This will also need CodeGen support. On a happy note, we're now a "nans" away from building tramp3d-v4. llvm-svn: 97209
* Commit Eli's fix for implicit conversions to array type. Fixes PR6264.Douglas Gregor2010-02-261-1/+1
| | | | llvm-svn: 97202
* Make sure to mark constructors, operator new, and operator delete asDouglas Gregor2010-02-261-2/+56
| | | | | | | | | used when we instantiate C++ new expressions, delete expressions, and object-construction expressions. Fixes PR6424, although we can't test all of it until we finish implementing lookup of "operator delete" for new expressions (!). llvm-svn: 97195
* When we decide to re-use an existing CXXConstructExpr node, make sureDouglas Gregor2010-02-261-1/+3
| | | | | | | | to mark the constructor as referenced. Fixes the narrow issue reported in PR6424, but there are a few other places that I'll fix before closing out that PR. llvm-svn: 97185
* When computing the composite pointer type for relational comparisons,Douglas Gregor2010-02-253-7/+67
| | | | | | | | | | | | | | | | | | | | | | | | equality comparisons, and conditional operators, produce a composite pointer type with the appropriate additional "const" qualifiers if the pointer types would otherwise be incompatible. This is a small extension (also present in GCC and EDG in a slightly different form) that permits code like: void** i; void const** j; i == j; with the following extwarn: t.cpp:5:5: warning: comparison of distinct pointer types ('void **' and 'void const **') uses non-standard composite pointer type 'void const *const *' [-pedantic] i == j; ~ ^ ~ Fixes PR6346, and I'll be filing a core issue about this with the C++ committee. llvm-svn: 97177
* Allow us to compare derived-to-base conversions between a referenceDouglas Gregor2010-02-251-27/+8
| | | | | | | binding and a copy-construction. Fixes an overloading problem in the Clang-on-Clang build. llvm-svn: 97161
* Don't try to finalize an ill-formed variable or one whose class type is ↵Douglas Gregor2010-02-251-1/+2
| | | | | | ill-formed. Fixes PR6421 llvm-svn: 97152
* Add "template" keyword at strategic position to fixGabor Greif2010-02-251-1/+2
| | | | | | | | | | | | | | | | | compilation using g++ v3.4. I'll watch the buildbots and back out if necessary. Feel free to do the same if something breaks. Without this patch I get (on g++ 3.4.6) following error: In file included from clang/lib/Sema/SemaTemplate.cpp:14: clang/lib/Sema/TreeTransform.h: In member function `clang::ASTOwningResult<&clang::ActionBase::DeleteExpr> clang::TreeTransform<Derived>::RebuildCXXPseudoDestructorExpr(clang::ASTOwningResult<&clang::ActionBase::DeleteExpr>, clang::SourceLocation, bool, clang::NestedNameSpecifier*, clang::SourceRange, clang::TypeSourceInfo*, clang::SourceLocation, clang::SourceLocation, clang::PseudoDestructorTypeStorage)': clang/lib/Sema/TreeTransform.h:5784: error: expected primary-expression before '>' token clang/lib/Sema/TreeTransform.h:5784: error: expected primary-expression before ')' token make[4]: *** [clang/lib/Sema/Release/SemaTemplate.o] Error 1 llvm-svn: 97136
* When comparing two method overload candidates during overload diagnostics,John McCall2010-02-251-1/+2
| | | | | | | | | | | skip the object argument conversion if either of the candidates didn't initialize it. Fixes PR6421, which is such a very straightforward extension of PR6398 that I should have worked it into the last test case (and therefore caught it then). Ah well. llvm-svn: 97135
* Fix a really trivial crasher and begin fleshing out one of the namespace testChandler Carruth2010-02-251-4/+7
| | | | | | cases. llvm-svn: 97134
* Add a new conversion rank to classify conversions between complex and scalarChandler Carruth2010-02-252-14/+15
| | | | | | | | types. Rank these conversions below other conversions. This allows overload resolution when the only distinction is between a complex and scalar type. It also brings the complex overload resolutin in line with GCC's. llvm-svn: 97128
* Restore the invariant that a nested-name-specifier can only containDouglas Gregor2010-02-256-70/+28
| | | | | | | | | 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
* Allow __attribute__((unused)) to be applied to ObjC ivars.Ted Kremenek2010-02-251-1/+1
| | | | llvm-svn: 97103
* Remove some oogly code made dead by the pseudo-destructorDouglas Gregor2010-02-251-44/+0
| | | | | | instantiation changes. llvm-svn: 97095
* Use CXXPseudoDestructorExpr as the stored representation for dependentDouglas Gregor2010-02-253-207/+114
| | | | | | | | | | | | | | | | expressions that look like pseudo-destructors, e.g., p->T::~T() where p has dependent type. At template instantiate time, we determine whether we actually have a pseudo-destructor or a member access, and funnel down to the appropriate routine in Sema. Fixes PR6380. llvm-svn: 97092
* Catch more uses of uninitialized implicit conversion sequences.John McCall2010-02-254-50/+89
| | | | | | | When diagnosing bad conversions, skip the conversion for ignored object arguments. Fixes PR 6398. llvm-svn: 97090
* Keep track of the location of the '~' in a pseudo-destructor expression.Douglas Gregor2010-02-244-3/+10
| | | | llvm-svn: 97080
* Retain complete source information for the type after the '~' in aDouglas Gregor2010-02-243-44/+80
| | | | | | | | | | | CXXPseudoDestructorExpr. Update template instantiation for pseudo-destructor expressions to use this source information and to make use of Sema::BuildPseudoDestructorExpr when the base expression is dependent or refers to a scalar type. llvm-svn: 97079
* Make sure that we have type source information for the scope type of aDouglas Gregor2010-02-241-1/+6
| | | | | | pseudo-destructor expression. Attempt #1 at fixing the MSVC buildbot. llvm-svn: 97076
* Split ActOnPseudoDestructorExpr into the part that interprets theDouglas Gregor2010-02-242-86/+158
| | | | | | | | parser's data structures and the part that performs semantic analysis and AST building, in preparation for improved template instantiation of pseudo-destructor expressions. llvm-svn: 97070
* Retain source information for the "type-name ::" in aDouglas Gregor2010-02-242-3/+7
| | | | | | | | pseudo-destructor expression such as p->T::~T() llvm-svn: 97060
* ActOnPseudoDestructorExpr now performs all semantic analysis forDouglas Gregor2010-02-244-58/+280
| | | | | | | | | | | | | | | | pseudo-destructor expressions, and builds the CXXPseudoDestructorExpr node directly. Currently, this only affects pseudo-destructor expressions when they are parsed, but not after template instantiation. That's coming next... Improve parsing of pseudo-destructor-names. When parsing the nested-name-specifier and we hit the sequence of tokens X :: ~, query the actual module to determine whether X is a type-name (in which case the X :: is part of the pseudo-destructor-name but not the nested-name-specifier) or not (in which case the X :: is part of the nested-name-specifier). llvm-svn: 97058
OpenPOWER on IntegriCloud