summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
* Define DiagnosticBuilder<<APValue so it's easy to include APValues inJeffrey Yasskin2011-07-181-0/+45
| | | | | | diagnostics. llvm-svn: 135398
* Don't crash when codegen'ing an empty redecl of a function in C99 mode, whenNick Lewycky2011-07-181-3/+4
| | | | | | neither was inline. Fixes bug introduced in r135377. llvm-svn: 135380
* In C99, emit an inline function when encountering an extern redeclaration.Nick Lewycky2011-07-182-1/+27
| | | | | | Fixes PR10233! llvm-svn: 135377
* Augment the interface of ExternalASTSource::FindExternalLexicalDecls()Douglas Gregor2011-07-153-9/+19
| | | | | | | | | | | to allow clients to specify that they've already (correctly) loaded declarations, and that no further action is needed. Also, make sure that we clear the "has external lexical declarations" bit before calling FindExternalLexicalDecls(), to avoid infinite recursion. llvm-svn: 135306
* Use the new APFloat::convertToInt(APSInt) function to simplify uses ofJeffrey Yasskin2011-07-151-4/+3
| | | | | | convertToInt(integerParts*) and make them more reliable. llvm-svn: 135279
* Create a new expression node, SubstNonTypeTemplateParmExpr,John McCall2011-07-155-0/+25
| | | | | | | | to represent a fully-substituted non-type template parameter. This should improve source fidelity, as well as being generically useful for diagnostics and such. llvm-svn: 135243
* Switch comments and assert text in AST from 'instantiation' toChandler Carruth2011-07-151-3/+3
| | | | | | 'expansion'. llvm-svn: 135224
* Silliness with commas, as reported at http://blog.regehr.org/archives/558 . ↵Eli Friedman2011-07-131-1/+5
| | | | | | As it turns out, this is my fault for not noticing this was an issue when I was looking at this a long time ago. :( llvm-svn: 135026
* Correctly set up the list of virtual base classes for a CXXRecordDecl. ↵Richard Smith2011-07-121-16/+2
| | | | | | Previously we got the source range wrong for everything in the virtual bases list. llvm-svn: 135011
* revert fix for // rdar://9740328Fariborz Jahanian2011-07-121-1/+1
| | | | llvm-svn: 135010
* objc++: Some level of covariance is allowed in ObjC properties.Fariborz Jahanian2011-07-121-0/+4
| | | | | | Make it also available in ObjC++ propeties. // rdar://9740328 llvm-svn: 135001
* In ARC mode, consider Objective-C lifetime types (object pointers andDouglas Gregor2011-07-121-2/+0
| | | | | | | | | | | | | | block pointers) that don't have any qualification to be POD types. We were previously considering them to be non-POD types, because this was convenient in C++ for is_pod-like traits. However, we now end up inferring lifetime in such cases (template arguments infer __strong), so it is not necessary. Moreover, we want rvalues of object type (which have their lifetime stripped) to be PODs to allow, e.g., va_arg(arglist, id) to function properly. Fixes <rdar://problem/9758798>. llvm-svn: 134993
* Improve name mangling for instantiation-dependent types that are notDouglas Gregor2011-07-122-15/+71
| | | | | | | | | | | | | | | | | | | | | | | | | dependent. This covers an odd class of types such as int (&)[sizeof(sizeof(T() + T()))]; which involve template parameters but, because of some trick typically involving a form of expression that is never type-dependent, resolve down to a non-dependent type. Such types need to be mangled essentially as they were written in the source code (involving template parameters), rather than via their canonical type. In general, instantiation-dependent types should be mangled as they were written in the source. However, since we can't do that now without non-trivial refactoring of the AST (see the new FIXME), I've gone for this partial solution: only use the as-written-in-the-source mangling for these strange types that are instantiation-dependent but not dependent. This provides better compatibility with previous incarnations of Clang and with GCC. In the future, we'd like to get this right. Fixes <rdar://problem/9663282>. llvm-svn: 134984
* Implement name mangling for sizeof...(function parameter pack).Douglas Gregor2011-07-121-9/+2
| | | | llvm-svn: 134974
* Fix the desugaring of dependent decltype and typeof(expr) nodes. TheDouglas Gregor2011-07-121-1/+17
| | | | | | | | | | isSugared() and desugar() routines previously provided were never actually called, since the corresponding types (DependentTypeOfExprType, DependentDecltypeType) don't have corresponding type classes. Outside of the current (incomplete) patch I'm working on, I haven't found a way to trigger this problem. llvm-svn: 134973
* Mangle dependent template names of unknown arityDouglas Gregor2011-07-121-10/+4
| | | | llvm-svn: 134967
* Implement the Itanium C++ ABI's mangling rule forDouglas Gregor2011-07-121-2/+23
| | | | | | non-instantiation-dependent sizeof and alignof expressions. llvm-svn: 134963
* Centralize the getCanonicalType() calls in the Itanium C++ manglingDouglas Gregor2011-07-122-9/+29
| | | | | | code so that they only occur in a single place. No functionality change. llvm-svn: 134961
* Allow us to compute linkage et al for instantiation-dependent types.Douglas Gregor2011-07-111-2/+2
| | | | llvm-svn: 134932
* Apply patch from Richard Trieu to fix PR9548:Chandler Carruth2011-07-111-19/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When two different types has the same text representation in the same diagnostic message, print an a.k.a. after the type if the a.k.a. gives extra information about the type. class versa_string; typedef versa_string string; namespace std {template <typename T> class vector;} using std::vector; void f(vector<string> v); namespace std { class basic_string; typedef basic_string string; template <typename T> class vector {}; void g() { vector<string> v; f(v); } } Old message: ---------------- test.cc:15:3: error: no matching function for call to 'f' f(&v); ^ test.cc:7:6: note: candidate function not viable: no known conversion from 'vector<string>' to 'vector<string>' for 1st argument void f(vector<string> v); ^ 1 error generated. New message: --------------- test.cc:15:3: error: no matching function for call to 'f' f(v); ^ test.cc:7:6: note: candidate function not viable: no known conversion from 'vector<string>' (aka 'std::vector<std::basic_string>') to 'vector<string>' (aka 'std::vector<versa_string>') for 1st argument void f(vector<string> v); ^ 1 error generated. llvm-svn: 134904
* Teach CXXUnresolvedConstructExpr when it should be anDouglas Gregor2011-07-082-2/+8
| | | | | | | lvalue/xvalue/rvalue, rather than just (incorrectly) assuming it's an lvalue. Fixes PR10285 / <rdar://problem/9743926>. llvm-svn: 134700
* r134634 causes a failure on MultiSource/Benchmarks/Olden/bh with TEST=nightly,Cameron Zwarich2011-07-072-27/+1
| | | | | | so roll it out. llvm-svn: 134638
* A redeclaration of an inline method in C99 mode should trigger emission of thatNick Lewycky2011-07-072-1/+27
| | | | | | function. Fixes PR10233! llvm-svn: 134634
* In ARC, reclaim all return values of retainable type, not just thoseJohn McCall2011-07-073-0/+16
| | | | | | | | | | | | where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
* Zap a couple unnecessary loops.Eli Friedman2011-07-072-20/+2
| | | | llvm-svn: 134578
* objc-arc: enforce performSelector rules in rejecting retaining selectorsFariborz Jahanian2011-07-051-0/+28
| | | | | | | passed to it, and unknown selectors causing potential leak. // rdar://9659270 llvm-svn: 134449
* Don't overread the buffer when an %x escape in inline asm ends prematurely.Benjamin Kramer2011-07-051-0/+4
| | | | | | Tested by valgrind & Sema/asm.c. llvm-svn: 134404
* Switch the Decl and Stmt stats printing to use llvm::errs() instead ofChandler Carruth2011-07-042-15/+16
| | | | | | | fprintf, and to be more consistent in formatting with the other stats printing routines. llvm-svn: 134374
* Start switching the AST stats printing to use llvm::errs() instead ofChandler Carruth2011-07-041-26/+27
| | | | | | fprintf. There is more cleanup to be done to the AST stats printing... llvm-svn: 134373
* Rewritten fix in r134139 to conform evaluation result to original evaluation ↵Abramo Bagnara2011-07-021-11/+21
| | | | | | context. llvm-svn: 134320
* -Fix mistake in ASTContext::getInnerObjCOwnership noticed by DougArgyrios Kyrtzidis2011-07-011-1/+1
| | | | | | | | -Remove unnecessary 'return'. -Remove unnecessary 'if' check (llvm_unreachable make sure attrStr will be non-null) -Add a test of transferring ownership to a reference cast type. llvm-svn: 134285
* [ARC] When casting from a pointer to an objective-c object with known ↵Argyrios Kyrtzidis2011-07-011-0/+19
| | | | | | | | | | | | | | ownership, if the cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type to the cast type: id x; static_cast<NSString**>(&x); // Casting as (__strong NSString**). This currently only works for C++ named casts, C casts to follow. llvm-svn: 134273
* Just mangle substituted template parameter types as unresolved types.John McCall2011-07-011-10/+3
| | | | | | | This is kindof questionable but seems to do more-or-less the right thing. This is not a particularly friendly part of the ABI. llvm-svn: 134227
* Introduce the notion of instantiation dependence into Clang's AST. ADouglas Gregor2011-07-018-55/+317
| | | | | | | | | | | | | | | | | | | | | | | | | | type/expression/template argument/etc. is instantiation-dependent if it somehow involves a template parameter, even if it doesn't meet the requirements for the more common kinds of dependence (dependent type, type-dependent expression, value-dependent expression). When we see an instantiation-dependent type, we know we always need to perform substitution into that instantiation-dependent type. This keeps us from short-circuiting evaluation in places where we shouldn't, and lets us properly implement C++0x [temp.type]p2. In theory, this would also allow us to properly mangle instantiation-dependent-but-not-dependent decltype types per the Itanium C++ ABI, but we aren't quite there because we still mangle based on the canonical type in cases like, e.g., template<unsigned> struct A { }; template<typename T> void f(A<sizeof(sizeof(decltype(T() + T())))>) { } template void f<int>(A<sizeof(sizeof(int))>); and therefore get the wrong answer. llvm-svn: 134225
* Change the mangling of enclosing template template parametersJohn McCall2011-07-011-19/+73
| | | | | | | that serve as the base template name of an unresolved-name to be mangled as a substitution. llvm-svn: 134213
* No, actually, we do need to be able to mangle substituted template names.John McCall2011-06-301-3/+10
| | | | llvm-svn: 134195
* Fix off-by-one error in StringLiteral::getLocationOfByte.Hans Wennborg2011-06-301-1/+1
| | | | | | This fixes PR10223. llvm-svn: 134183
* Fixed enum constant evaluation assertions.Abramo Bagnara2011-06-301-6/+13
| | | | llvm-svn: 134139
* Preserve that a TemplateName was arrived at by substitutingJohn McCall2011-06-305-26/+125
| | | | | | | | | | | for a template template parameter. Uses to follow. I've also made the uniquing of SubstTemplateTemplateParmPacks use a ContextualFoldingSet as a minor space efficiency. llvm-svn: 134137
* Document and check tighter assumptions about the TemplateName of aJohn McCall2011-06-301-0/+3
| | | | | | TemplateSpecializationType. llvm-svn: 134120
* Eliminate most uses of ShallowCollectObjCIvars which requiresFariborz Jahanian2011-06-282-7/+10
| | | | | | | a vector for collection. Use iterators where needed instead. // rdar://6817577 llvm-svn: 134015
* Be more thorough about mangling unresolved types.John McCall2011-06-282-57/+102
| | | | llvm-svn: 134011
* Merge some calls to FoldingSetNodeID::AddInteger; assuming my measurements ↵Eli Friedman2011-06-271-4/+12
| | | | | | aren't completely off, roughly a 1% speedup on SingleSource/UnitTests/ObjC/trivial-interface.m . llvm-svn: 133968
* Don't factor in visibility for templates and template argumentsJohn McCall2011-06-271-24/+44
| | | | | | for explicit specializations with their own explicit visibility. llvm-svn: 133958
* Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about ↵Argyrios Kyrtzidis2011-06-241-5/+5
| | | | | | | | 'ownership', not 'lifetime'. rdar://9477613. llvm-svn: 133779
* Apparently at some point in the past I forgot how 'continue'John McCall2011-06-231-6/+2
| | | | | | | | works in a 'while(false)' loop. Simplify this code; it was complicated only in anticipation of C++0x lambdas, and it can become complicated again when those happen. :) llvm-svn: 133761
* Move definition of template <typename T> void Decl::dropAttrFariborz Jahanian2011-06-231-18/+0
| | | | | | to its header to avoid an explicit instantiation. llvm-svn: 133753
* Minor tweak to my last patch per Doug's comment.Fariborz Jahanian2011-06-231-2/+4
| | | | llvm-svn: 133731
* Remove multiple use of weak_import attribute onFariborz Jahanian2011-06-231-14/+16
| | | | | | same declaration. Templatize dropAttr for general use. llvm-svn: 133724
* Remove weak_import attribute on new declaration.Fariborz Jahanian2011-06-231-0/+14
| | | | | | // rdar://9538608 llvm-svn: 133721
OpenPOWER on IntegriCloud