summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
* When using a default function argument for a function template (orDouglas Gregor2009-12-231-0/+13
| | | | | | | | | | | | | | | | | member function thereof), perform the template instantiation each time the default argument is needed. This ensures that (1) We get different CXXTemporary objects for each instantiation, and (2) Any other instantiations or definitions triggered by the instantiation of the default argument expression are guaranteed to happen; previously, they might have been suppressed, e.g., because they happened in an unevaluated context. This fixes the majority of PR5810. However, it does not address the problem where we may have multiple uses of the same CXXTemporary within an expression when the temporary came from a non-instantiated default argument expression. llvm-svn: 92015
* move a few more symbols to .rodata/.data.rel.roNuno Lopes2009-12-231-1/+1
| | | | llvm-svn: 92012
* Add 'DeclStmt::DoDestroy()' which doesn't actually recurse over its child ↵Ted Kremenek2009-12-232-0/+9
| | | | | | expressions (via StmtIterator), as those expressions are owned by the Decls and Types (which are destroyed elsewhere). This fixes a crasher reported in <rdar://problem/7487294>. llvm-svn: 91990
* Fix CXXConstructExpr::getSourceRange() to not include the source ranges of ↵Ted Kremenek2009-12-231-0/+12
| | | | | | CXXDefaultArgExprs when computing its range (since these expressions have no source range, and using them will make the encompassing range invalid). llvm-svn: 91984
* Update for the intrinsic changes in llvm: the object size intrinsicEric Christopher2009-12-231-1/+2
| | | | | | | only takes a boolean second argument now. Update tests accordingly. Currently the builtin still accepts the full range for compatibility. llvm-svn: 91983
* Remove CharUnits::toString() to eliminate dependence on <string>.Ken Dyck2009-12-232-21/+0
| | | | llvm-svn: 91978
* Move the implementation of ASTContext::getTypeSizeInChars() to the .cpp file toKen Dyck2009-12-221-0/+10
| | | | | | avoid #including CharUnits.h in ASTContext.h. llvm-svn: 91903
* Eliminate the ASTContext argument to CXXConstructorDecl::isCopyConstructor, ↵Douglas Gregor2009-12-221-5/+5
| | | | | | since the context is available in the Decl llvm-svn: 91862
* indentation fixChris Lattner2009-12-211-1/+1
| | | | llvm-svn: 91807
* fix PR4010: add support for the warn_unused_result for function pointersNuno Lopes2009-12-201-3/+7
| | | | llvm-svn: 91803
* A CXXExprWithTemporaries expression is an lvalue if its subexpressionDouglas Gregor2009-12-191-0/+10
| | | | | | is an lvalue. Fixes PR5787. llvm-svn: 91765
* <string> already comes in from CharUnits.hChris Lattner2009-12-191-4/+0
| | | | llvm-svn: 91737
* Add and tidy doxygen comments and move implementation of toString() to newlyKen Dyck2009-12-182-0/+25
| | | | | | created CharUnits.cpp. llvm-svn: 91719
* Patch over yet more problems with friend declarations which were provokingJohn McCall2009-12-171-1/+5
| | | | | | | problems on LLVM-Code-Syntax. This proved remarkably easy to "fix" once I settled on how I was going to approach it. llvm-svn: 91633
* When value-initializing a class with no user-defined constructors butDouglas Gregor2009-12-161-11/+15
| | | | | | | with a non-trivial default constructor, zero-initialize the storage and then call the default constructor. Fixes PR5800. llvm-svn: 91548
* More work on the FullExpr class.Anders Carlsson2009-12-161-18/+34
| | | | llvm-svn: 91513
* Check in a rudimentary FullExpr class that isn't used anywhere yet. Rename ↵Anders Carlsson2009-12-162-0/+43
| | | | | | Action::FullExpr to Action::MakeFullExpr to avoid name clashes. llvm-svn: 91494
* Switch the C++ new expression over to InitializationSequence, ratherDouglas Gregor2009-12-161-5/+7
| | | | | | | | | | | | | | | | | | | | | 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
* Diagnose attempting to assign to a sub-structure of an ivarFariborz Jahanian2009-12-151-4/+14
| | | | | | using objective-c property. (fixes radar 7449707) llvm-svn: 91474
* ShouldDestroyTemporaries? I don't think so.Anders Carlsson2009-12-152-9/+4
| | | | llvm-svn: 91450
* If a ParmVarDecl's default argument is a CXXExprWithTemporaries, return the ↵Anders Carlsson2009-12-151-0/+29
| | | | | | underlying expr instead. Add getNumDefaultArgTemporaries and getDefaultArgTemporary which returns the temporaries a default arg creates. llvm-svn: 91439
* Elaborated types are specifier types, based on a patch from CorneliusDouglas Gregor2009-12-151-0/+1
| | | | llvm-svn: 91431
* Improve template instantiation for object constructions in several ways:Douglas Gregor2009-12-141-0/+31
| | | | | | | | | | | | | - During instantiation, drop default arguments from constructor and call expressions; they'll be recomputed anyway, and we don't want to instantiate them twice. - Rewrote the instantiation of variable initializers to cope with non-dependent forms properly. Together, these fix a handful of problems I introduced with the switch to always rebuild expressions from the source code "as written." llvm-svn: 91315
* Rename dump to dumpDeclContext, so that call RD->dump() won't dump the decl ↵Anders Carlsson2009-12-141-1/+1
| | | | | | context by default. llvm-svn: 91256
* More improvements to checking allocation and deallocation functions.Anders Carlsson2009-12-131-2/+2
| | | | llvm-svn: 91244
* Un-namespace-qualify llvm_unreachable. It's a macro, so the qualification gaveJeffrey Yasskin2009-12-122-2/+2
| | | | | | no extra safety anyway. llvm-svn: 91207
* Factor operator new declaration checking out into a separate function.Anders Carlsson2009-12-121-1/+1
| | | | llvm-svn: 91189
* Patch to allow C-style cast from 'void *' to block pointer type.Fariborz Jahanian2009-12-111-0/+2
| | | | | | (fixes radar 7465023). llvm-svn: 91171
* StmtDumper::VisitUnresolvedLookupExprJohn McCall2009-12-111-0/+14
| | | | llvm-svn: 91163
* Use StringRef.getAsInteger instead of temporary string + strtol. No intended ↵Benjamin Kramer2009-12-111-9/+3
| | | | | | functionality change. llvm-svn: 91118
* Patch to fix a crash trying to access a category name inFariborz Jahanian2009-12-111-2/+2
| | | | | | | objective-c++ mode and also removed dead-code in this area. (fixes radar 7456710). llvm-svn: 91081
* Clean up enum constants so that they're finally sane. Fixes PR3173 and aEli Friedman2009-12-102-11/+3
| | | | | | recently introduced crash. llvm-svn: 91070
* Implement redeclaration checking and hiding semantics for using ↵John McCall2009-12-101-0/+40
| | | | | | | | | | | 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
* spread 'const' love to some variables. this considerably reduces the amount ↵Nuno Lopes2009-12-101-1/+1
| | | | | | of dirty data around. llvm-svn: 91002
* Code gen for ObjCIsaExpr AST used as lvalue.Fariborz Jahanian2009-12-091-0/+1
| | | | | | (fixes radar 7457534). llvm-svn: 90995
* Reimplement reference initialization (C++ [dcl.init.ref]) using theDouglas Gregor2009-12-091-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add DeclContext::dump.Anders Carlsson2009-12-091-0/+11
| | | | llvm-svn: 90974
* First pass at implementing C++ enum semantics: calculate (and store) anJohn McCall2009-12-092-2/+11
| | | | | | | | | | | | "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
* In CXXRecordDecl::forallBases, add the base to the "queue", so we walk more ↵Anders Carlsson2009-12-091-2/+4
| | | | | | than one heirarchy of classes. John, please review. llvm-svn: 90948
* Implemented an implicit conversion from "noreturn" function types (andDouglas Gregor2009-12-091-20/+30
| | | | | | | | | | | | | | pointers thereof) to their corresponding non-noreturn function types. This conversion is considered an exact match for overload-resolution purposes. Note that we are a little more strict that GCC is, because we encode noreturn in the type system, but that's a Good Thing (TM) because it does not allow us to pretend that potentially-returning function pointers are non-returning function pointers. Fxies PR5620. llvm-svn: 90913
* Added a missing case to a switch statement.Fariborz Jahanian2009-12-081-0/+2
| | | | llvm-svn: 90902
* Implement template instantiation for exception specifications. Also,Douglas Gregor2009-12-082-0/+35
| | | | | | | | | | | | | | print exception specifications on function types and declarations. Fixes <rdar://problem/7450999>. There is some poor source-location information here, because we don't track locations of the types in exception specifications. Filed PR5719. Failures during template instantiation of the signature of a function or function template have wrong point-of-instantiation location information. I'll tackle that with a separate commit. llvm-svn: 90863
* DeclRefExpr stores a ValueDecl internally.John McCall2009-12-081-2/+2
| | | | | | Template instantiation can re-use DeclRefExprs. llvm-svn: 90848
* Add CXXRecordDecl::forallBases to walk an inheritance hierarchy with non-lookupJohn McCall2009-12-081-0/+49
| | | | | | | semantics and CXXRecordDecl::isProvablyNotDerivedFrom to assist with pre-instantiation diagnostics. llvm-svn: 90842
* Fix for PR5710: make sure to put function template specializations into theEli Friedman2009-12-081-0/+3
| | | | | | | | | | 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
* Misc key function fixes.Eli Friedman2009-12-081-1/+10
| | | | llvm-svn: 90831
* Instantiated or specialized class templates never have a key function. This ↵Anders Carlsson2009-12-071-0/+5
| | | | | | (and the previous check-in) fixes PR5557. llvm-svn: 90753
* getTemplateSpecializationKind should be const.Anders Carlsson2009-12-071-2/+2
| | | | llvm-svn: 90750
* Move key functions to a separate map.Anders Carlsson2009-12-073-33/+50
| | | | llvm-svn: 90745
* DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated ↵John McCall2009-12-076-44/+44
| | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud