summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Switch the C++ new expression over to InitializationSequence, ratherDouglas Gregor2009-12-161-14/+14
| | | | | | | | | | | | | | | | | | | | | than using its own partial implementation of initialization. Switched CheckInitializerTypes over to InitializedEntity/InitializationKind, to help move us closer to InitializationSequence. Added InitializedEntity::getName() to retrieve the name of the entity, for diagnostics that care about such things. Implemented support for default initialization in InitializationSequence. Clean up the determination of the "source expressions" for an initialization sequence in InitializationSequence::Perform. Taught CXXConstructExpr to store more location information. llvm-svn: 91492
* ShouldDestroyTemporaries? I don't think so.Anders Carlsson2009-12-151-2/+1
| | | | llvm-svn: 91450
* This patch should fix PR2461. It allows clang to apply the noreturnMike Stump2009-12-151-5/+4
| | | | | | | | | attribute to function pointers. It also fixes Sema to check function pointers for the noreturn attribute when checking for fallthrough. Patch by Chip Davis, with a slight fix to pass the testsuite. llvm-svn: 91408
* Fix the handling of dependent enums per C++ DR 502.Eli Friedman2009-12-111-4/+18
| | | | llvm-svn: 91089
* Don't complain about falling off the end of a function with an asmMike Stump2009-12-101-0/+5
| | | | | | | block, if the function is supposed to return a value as we don't know exactly what the asm code does. llvm-svn: 91073
* Clean up enum constants so that they're finally sane. Fixes PR3173 and aEli Friedman2009-12-101-14/+4
| | | | | | recently introduced crash. llvm-svn: 91070
* Improve the diagnostic when a new declaration conflicts with a using shadowJohn McCall2009-12-101-0/+9
| | | | | | | | declaration. Rename note_using_decl to note_using, which is possibly less confusing. Add a test for non-class-scope using decl collisions and be sure to note the case we can't diagnose yet. llvm-svn: 91057
* Move initialization via initializer list over to InitializationSequences.Douglas Gregor2009-12-101-4/+5
| | | | llvm-svn: 91050
* Implement redeclaration checking and hiding semantics for using ↵John McCall2009-12-101-4/+7
| | | | | | | | | | | declarations. There are a couple of O(n^2) operations in this, some analogous to the usual O(n^2) redeclaration problem and some not. In particular, retroactively removing shadow declarations when they're hidden by later decls is pretty unfortunate. I'm not yet convinced it's worse than the alternative, though. llvm-svn: 91045
* Fix for PR5515: allow "merging" array bounds both forwards and backwards.Eli Friedman2009-12-101-4/+13
| | | | llvm-svn: 91044
* Reimplement reference initialization (C++ [dcl.init.ref]) using theDouglas Gregor2009-12-091-3/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | new notion of an "initialization sequence", which encapsulates the computation of the initialization sequence along with diagnostic information and the capability to turn the computed sequence into an expression. At present, I've only switched one CheckReferenceInit callers over to this new mechanism; more will follow. Aside from (hopefully) being much more true to the standard, the diagnostics provided by this reference-initialization code are a bit better than before. Some examples: p5-var.cpp:54:12: error: non-const lvalue reference to type 'struct Derived' cannot bind to a value of unrelated type 'struct Base' Derived &dr2 = b; // expected-error{{non-const lvalue reference to ... ^ ~ p5-var.cpp:55:9: error: binding of reference to type 'struct Base' to a value of type 'struct Base const' drops qualifiers Base &br3 = bc; // expected-error{{drops qualifiers}} ^ ~~ p5-var.cpp:57:15: error: ambiguous conversion from derived class 'struct Diamond' to base class 'struct Base': struct Diamond -> struct Derived -> struct Base struct Diamond -> struct Derived2 -> struct Base Base &br5 = diamond; // expected-error{{ambiguous conversion from ... ^~~~~~~ p5-var.cpp:59:9: error: non-const lvalue reference to type 'long' cannot bind to a value of unrelated type 'int' long &lr = i; // expected-error{{non-const lvalue reference to type ... ^ ~ p5-var.cpp:74:9: error: non-const lvalue reference to type 'struct Base' cannot bind to a temporary of type 'struct Base' Base &br1 = Base(); // expected-error{{non-const lvalue reference to ... ^ ~~~~~~ p5-var.cpp:102:9: error: non-const reference cannot bind to bit-field 'i' int & ir1 = (ib.i); // expected-error{{non-const reference cannot ... ^ ~~~~~~ p5-var.cpp:98:7: note: bit-field is declared here int i : 17; // expected-note{{bit-field is declared here}} ^ llvm-svn: 90992
* First pass at implementing C++ enum semantics: calculate (and store) anJohn McCall2009-12-091-15/+40
| | | | | | | | | | | | "integer promotion" type associated with an enum decl, and use this type to determine which type to promote to. This type obeys C++ [conv.prom]p2 and is therefore generally signed unless the range of the enumerators forces it to be unsigned. Kills off a lot of false positives from -Wsign-compare in C++, addressing rdar://7455616 llvm-svn: 90965
* Don't warn about function templates or function template specializations.Anders Carlsson2009-12-091-5/+13
| | | | llvm-svn: 90943
* Rename Sema::IsOverload to Sema::CheckOverload. Teach it to ignore unresolvedJohn McCall2009-12-091-24/+34
| | | | | | | | using value decls; we optimistically assume they won't turn into conflicts. Teach it to tell the caller *why* the function doesn't overload with the returned decl; this will be useful for using hiding. llvm-svn: 90939
* Move the missing prototypes checking out into a new function. Don't warn ↵Anders Carlsson2009-12-091-17/+38
| | | | | | about inline functions. Add a test. llvm-svn: 90938
* Fix for PR5710: make sure to put function template specializations into theEli Friedman2009-12-081-4/+4
| | | | | | | | | | DeclContext, so they don't completely disappear from the AST. I don't particularly like this fix, but I don't see any obviously better way to deal with it, and I think it's pretty clearly an improvement; comments welcome. llvm-svn: 90835
* Rework how virtual member functions are marked. If a class has no key ↵Anders Carlsson2009-12-071-10/+3
| | | | | | function, we now wait until the end of the translation unit to mark its virtual member functions as references. This lays the groundwork for fixing PR5557. llvm-svn: 90752
* DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated ↵John McCall2009-12-071-40/+40
| | | | | | | | | | | | | | | | | | | | | variables, but the results are imperfect. For posterity, I did: cat <<EOF > $cmdfile s/DeclaratorInfo/TypeSourceInfo/g s/DInfo/TInfo/g s/TypeTypeSourceInfo/TypeSourceInfo/g s/SourceTypeSourceInfo/TypeSourceInfo/g EOF find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \; find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \; find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \; llvm-svn: 90743
* Move RequireCompleteType requirement for fields early into ActOnField so thatEli Friedman2009-12-071-7/+14
| | | | | | subsequent code which depends on a complete type does the right thing. llvm-svn: 90727
* remove some extraneous syntax: sourceloc implicitly converts to sourcerange.Chris Lattner2009-12-061-3/+3
| | | | llvm-svn: 90710
* Pass the desired vtable linkage to GenerateVtable directly. Only call ↵Anders Carlsson2009-12-061-1/+3
| | | | | | MaybeMarkVirtualImplicitMembersReferenced for non-inline functions. llvm-svn: 90686
* Diagnose declarations of implicit member functions.Anders Carlsson2009-12-041-25/+55
| | | | llvm-svn: 90605
* Make sure that overridden method decls are always canonical.Anders Carlsson2009-12-041-1/+1
| | | | llvm-svn: 90542
* When recovering from an invalid forward reference to an enum type in C++,John McCall2009-12-041-2/+6
| | | | | | create the enum type in the same scope as you would a record type. llvm-svn: 90500
* A new helper function to set various bits in the class whenFariborz Jahanian2009-12-031-8/+1
| | | | | | | a new virtual function is declared/instantiated. it is used in couple of places. llvm-svn: 90470
* Unify the end-of-class code paths used by the parser and templateDouglas Gregor2009-12-031-6/+12
| | | | | | | | | | | | | | instantiation, to ensure that we mark class template specilizations as abstract when we need to and perform checking of abstract classes. Also, move the checking that determines whether we are creating a variable of abstract class type *after* we check whether the type is complete. Otherwise, we won't see when we have an abstract class template specialization that is implicitly instantiated by this declaration. This is the "something else" that Sebastian had noted earlier. llvm-svn: 90467
* In Sema, whenever we think that a function is going to cause a vtable to be ↵Anders Carlsson2009-12-021-3/+5
| | | | | | generated, we mark any virtual implicit member functions as referenced. llvm-svn: 90327
* Rip out the last remaining implicit use of OverloadedFunctionDecl in Sema:John McCall2009-12-021-5/+2
| | | | | | | LookupResult::getAsSingleDecl() is no more. Shift Sema::LookupSingleName to return null on overloaded results. llvm-svn: 90309
* Push overloaded function templates through the parser using a totally differentJohn McCall2009-12-021-7/+2
| | | | | | | leaked data structure than before. This kills off the last remaining explicit uses of OverloadedFunctionDecl in Sema. llvm-svn: 90306
* Fix another "operator delete missing" crash: make sure we don't checkEli Friedman2009-12-021-2/+6
| | | | | | | isVirtual() before we've actually calculated whether the destructor is virtual. llvm-svn: 90303
* Funtion templates and function template specializations do notDouglas Gregor2009-12-011-2/+5
| | | | | | | override virtual functions. Also, eliminate a (now redundant) call to AddOverriddenMethods. llvm-svn: 90242
* Move the checking of overridden virtual functions into the code pathDouglas Gregor2009-12-011-16/+9
| | | | | | | | | | | | | | | common to both parsing and template instantiation, so that we'll find overridden virtuals for member functions of class templates when they are instantiated. Additionally, factor out the checking for pure virtual functions, so that it will be executed both at parsing time and at template instantiation time. These changes fix PR5656 (for real), although one more tweak w.r.t. member function templates will be coming along shortly. llvm-svn: 90241
* An inherited virtual (where "virtual" wasn't written explicitly) canDouglas Gregor2009-12-011-1/+1
| | | | | | be defined as pure. Fixes PR5656. llvm-svn: 90237
* Remove all of Sema's explicit uses of OverloadedFunctionDecl except forJohn McCall2009-11-301-36/+0
| | | | | | those associated with TemplateNames. llvm-svn: 90162
* Eliminate the use of OverloadedFunctionDecl in member expressions.John McCall2009-11-301-1/+1
| | | | | | | | Create a new UnresolvedMemberExpr for these lookups. Assorted hackery around qualified member expressions; this will all go away when we implement the correct (i.e. extremely delayed) implicit-member semantics. llvm-svn: 90161
* Use StringRef in Attr constructors.Benjamin Kramer2009-11-301-4/+2
| | | | llvm-svn: 90140
* Add DeclarationName support for C++0x operator literals. They should now work asAlexis Hunt2009-11-291-1/+2
| | | | | | | function names outside of templates - they'll probably cause some damage there as they're largely untested. llvm-svn: 90064
* Fix 80-cols violationsAlexis Hunt2009-11-291-3/+3
| | | | llvm-svn: 90057
* Add Parser support for C++0x literal operators ('operator "" i').Alexis Hunt2009-11-281-1/+4
| | | | | | DeclarationName can't handle them yet, so right now Parser just errors out on them. llvm-svn: 90027
* Fix thinko.Anders Carlsson2009-11-271-2/+1
| | | | llvm-svn: 89983
* Correctly find overridden destructors.Anders Carlsson2009-11-261-2/+15
| | | | llvm-svn: 89966
* Allow user re-definition of SEL as well as accessing its fields.Fariborz Jahanian2009-11-251-1/+1
| | | | | | This fixes pr5611. llvm-svn: 89895
* Diagnose ill-formed uses of default template arguments inDouglas Gregor2009-11-251-0/+10
| | | | | | | | | | | function templates (in C++98), friend function templates, and out-of-line definitions of members of class templates. Also handles merging of default template arguments from previous declarations of function templates, for C++0x. However, we don't yet make use of those default template arguments. llvm-svn: 89872
* Encapsulate "an array of TemplateArgumentLocs and two angle bracket ↵John McCall2009-11-231-7/+5
| | | | | | | | | | locations" into a new class. Use it pervasively throughout Sema. My fingers hurt. llvm-svn: 89638
* This patch implements objective-c's 'SEL' type as a built-inFariborz Jahanian2009-11-211-1/+3
| | | | | | | | | | | | | | | | | | type and fixes a long-standing code gen. crash reported in at least two PRs and a radar. (radar 7405040 and pr5025). There are couple of remaining issues that I would like for Ted. and Doug to look at: Ted, please look at failure in Analysis/MissingDealloc.m. I have temporarily added an expected-warning to make the test pass. This tests has a declaration of 'SEL' type which may not co-exist with the new changes. Doug, please look at a FIXME in PCHWriter.cpp/PCHReader.cpp. I think the changes which I have ifdef'ed out are correct. They need be considered for in a few Indexer/PCH test cases. llvm-svn: 89561
* Added rudimentary C++0x attribute support.Alexis Hunt2009-11-211-2/+2
| | | | | | | | | | | | | | 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
* Implement C++ [basic.lookup.classref]p3, which states how the typeDouglas Gregor2009-11-201-22/+59
| | | | | | | | | | | | name 'T' is looked up in the expression t.~T() Previously, we weren't looking into the type of "t", and therefore would fail when T actually referred to an injected-class-name. Fixes PR5530. llvm-svn: 89493
* Overhaul previous-declaration and overload checking to work on lookup resultsJohn McCall2009-11-181-170/+247
| | | | | | | rather than NamedDecl*. This is a major step towards eliminating OverloadedFunctionDecl. llvm-svn: 89263
* Track overriding methods when instantiating a template class. Fixes PR5550.Sebastian Redl2009-11-181-18/+22
| | | | llvm-svn: 89248
* Split LookupResult into its own header.John McCall2009-11-181-9/+9
| | | | llvm-svn: 89199
OpenPOWER on IntegriCloud