aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
AgeCommit message (Collapse)Author
2013-05-21Reverting r182337, which merged r182266, __declspec(selectany)Reid Kleckner
Was "Implement __declspec(selectany) under -fms-extensions ..." git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_33@182381 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21Merging r182266:Bill Wendling
------------------------------------------------------------------------ r182266 | rnk | 2013-05-20 07:02:37 -0700 (Mon, 20 May 2013) | 13 lines Implement __declspec(selectany) under -fms-extensions selectany only applies to externally visible global variables. It has the effect of making the data weak_odr. The MSDN docs suggest that unused definitions can only be dropped at linktime, so Clang uses weak instead of linkonce. MSVC optimizes away references to constant selectany data, so it must assume that there is only one definition, hence weak_odr. Reviewers: espindola Differential Revision: http://llvm-reviews.chandlerc.com/D814 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_33@182337 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-17Merging r182072:Bill Wendling
------------------------------------------------------------------------ r182072 | rsmith | 2013-05-16 19:19:35 -0700 (Thu, 16 May 2013) | 6 lines PR15757: When we instantiate an inheriting constructor template, also instantiate the inherited constructor template and mark that as the constructor which the instantiated specialization is inheriting. This fixes a crash-on-valid when trying to compute the exception specification of a specialization of the inheriting constructor. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_33@182150 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06Grab-bag of bit-field fixes:John McCall
- References to ObjC bit-field ivars are bit-field lvalues; fixes rdar://13794269, which got me started down this. - Introduce Expr::refersToBitField, switch a couple users to it where semantically important, and comment the difference between this and the existing API. - Discourage Expr::getBitField by making it a bit longer and less general-sounding. - Lock down on const_casts of bit-field gl-values until we hear back from the committee as to whether they're allowed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181252 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06Add missing initialization for Sema::CurScope. This is important for AST ↵Richard Smith
consumers which don't create a Parser. Pointed out by Tom Honermann. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181251 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06Fix representation of compound literals for C++ objects with destructors.Jordan Rose
Previously, this compound literal expression (a GNU extension in C++): (AggregateWithDtor){1, 2} resulted in this AST: `-CXXBindTemporaryExpr [...] 'struct Point' (CXXTemporary [...]) `-CompoundLiteralExpr [...] 'struct AggregateWithDtor' `-CXXBindTemporaryExpr [...] 'struct AggregateWithDtor' (CXXTemporary [...]) `-InitListExpr [...] 'struct AggregateWithDtor' |-IntegerLiteral [...] 'int' 1 `-IntegerLiteral [...] 'int' 2 Note the two CXXBindTemporaryExprs. The InitListExpr is really part of the CompoundLiteralExpr, not an object in its own right. By introducing a new entity initialization kind in Sema specifically for compound literals, we avoid the treatment of the inner InitListExpr as a temporary. `-CXXBindTemporaryExpr [...] 'struct Point' (CXXTemporary [...]) `-CompoundLiteralExpr [...] 'struct AggregateWithDtor' `-InitListExpr [...] 'struct AggregateWithDtor' |-IntegerLiteral [...] 'int' 1 `-IntegerLiteral [...] 'int' 2 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181212 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06Require the containing type to be complete when we seeJohn McCall
__alignof__ of a field. This problem can only happen in C++11. Also do some petty optimizations. rdar://13784901 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181185 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06Fix assert if __extension__ or _Generic is used when initializing a char ↵Richard Smith
array from a string literal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181174 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05Replace 'MultiExprArg()' with 'None'Dmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181166 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05Make all 'is in extern "C"' tests use the lexical context.Rafael Espindola
I was not able to find a case (other than the fix in r181163) where this makes a difference, but it is a more obviously correct API to have. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181165 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05ArrayRef'ize Sema::CheckObjCMethodCallDmitri Gribenko
Patch by Robert Wilhelm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181164 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05Use lexical contexts when checking for conflicting language linkages.Rafael Espindola
This fixes pr14958. I will audit other calls to isExternCContext to see if there are any similar bugs left. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181163 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05Handle parens properly when initializing a char array from a string literal.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181159 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05ArrayRef'ization of some methods in SemaOverload. Patch by Robert Wilhelm!Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181158 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko
constructor from None Patch by Robert Wilhelm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181139 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04In VarDecl nodes, store the thread storage class specifier as written.Enea Zaffanella
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181113 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Implement most of N3638 (return type deduction for normal functions).Richard Smith
Missing (somewhat ironically) is support for the new deduction rules in lambda functions, plus PCH support for return type patching. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181108 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Don't build a call expression referring to a function which we're not allowedRichard Smith
to use. This makes very little difference right now (other than suppressing follow-on errors in some cases), but will matter more once we support deduced return types (we don't want expressions with undeduced return types in the AST). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181107 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Say 'decltype(auto)' not 'auto' as appropriate in mismatched-deduction ↵Richard Smith
diagnostic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181103 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Implement template support for CapturedStmtWei Pan
- Sema tests added and CodeGen tests are pending Differential Revision: http://llvm-reviews.chandlerc.com/D728 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181101 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Simplify slightly.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181092 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Separate out and special-case the diagnostic for 'auto' in aRichard Smith
conversion-type-id, in preparation for this becoming valid in c++1y mode. No functionality change; small diagnostic improvement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181089 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03ArrayRef'ize MultiLevelTemplateArgumentList::ArgList. Patch by Faisal Vali!Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181077 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03Revert r177218.Argyrios Kyrtzidis
Per discussion in cfe-commits, asserting may be a better way than introducing a special test flag. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181073 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03Test commitWei Pan
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181057 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03PR15906: The body of a lambda is not an evaluated subexpression; don't visit ↵Richard Smith
it when visiting such subexpressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181046 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03Move CapturedStmt parameters to CapturedDeclBen Langmuir
Move the creation of CapturedStmt parameters out of CodeGen and into Sema, making it easier to customize the outlined function. The ImplicitParamDecls are stored in the CapturedDecl using an ASTContext-allocated array. Differential Revision: http://llvm-reviews.chandlerc.com/D722 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181043 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03Keep track of an @implementation's super class name location, if one was ↵Argyrios Kyrtzidis
provided. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181039 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03ArrayRef'ize InitializationSequence constructor and ↵Dmitri Gribenko
InitializationSequence::Diagnose() Patch by Robert Wilhelm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181022 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03Add const qualifier to Sema::getTypeName's parameter `II`Dmitri Gribenko
Patch by Ismail Pazarbasi. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181011 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03Correctly emit certain implicit references to 'self' even withinJohn McCall
a lambda. Bug #1 is that CGF's CurFuncDecl was "stuck" at lambda invocation functions. Fix that by generally improving getNonClosureContext to look through lambdas and captured statements but only report code contexts, which is generally what's wanted. Audit uses of CurFuncDecl and getNonClosureAncestor for correctness. Bug #2 is that lambdas weren't specially mapping 'self' when inside an ObjC method. Fix that by removing the requirement for that and using the normal EmitDeclRefLValue path in LoadObjCSelf. rdar://13800041 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181000 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03Move parsing of identifiers in MS-style inline assembly intoJohn McCall
the actual parser and support arbitrary id-expressions. We're actually basically set up to do arbitrary expressions here if we wanted to. Assembly operands permit things like A::x to be written regardless of language mode, which forces us to embellish the evaluation context logic somewhat. The logic here under template instantiation is incorrect; we need to preserve the fact that an expression was unevaluated. Of course, template instantiation in general is fishy here because we have no way of delaying semantic analysis in the MC parser. It's all just fishy. I've also fixed the serialization of MS asm statements. This commit depends on an LLVM commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180976 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02Use attribute argument information to determine when to parse attribute ↵Douglas Gregor
arguments as expressions. This change partly addresses a heinous problem we have with the parsing of attribute arguments that are a lone identifier. Previously, we would end up parsing the 'align' attribute of this as an expression "(Align)": template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align((Align)))) char storage[Size]; }; while this would parse as a "parameter name" 'Align': template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align(Align))) char storage[Size]; }; The code that handles the alignment attribute would completely ignore the parameter name, so the while the first of these would do what's expected, the second would silently be equivalent to template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align)) char storage[Size]; }; i.e., use the maximal alignment rather than the specified alignment. Address this by sniffing the "Args" provided in the TableGen description of attributes. If the first argument is "obviously" something that should be treated as an expression (rather than an identifier to be matched later), parse it as an expression. Fixes <rdar://problem/13700933>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180973 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02Revert r180970; it's causing breakage.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180972 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02Use attribute argument information to determine when to parse attribute ↵Douglas Gregor
arguments as expressions. This change partly addresses a heinous problem we have with the parsing of attribute arguments that are a lone identifier. Previously, we would end up parsing the 'align' attribute of this as an expression "(Align)": template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align((Align)))) char storage[Size]; }; while this would parse as a "parameter name" 'Align': template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align(Align))) char storage[Size]; }; The code that handles the alignment attribute would completely ignore the parameter name, so the while the first of these would do what's expected, the second would silently be equivalent to template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align)) char storage[Size]; }; i.e., use the maximal alignment rather than the specified alignment. Address this by sniffing the "Args" provided in the TableGen description of attributes. If the first argument is "obviously" something that should be treated as an expression (rather than an identifier to be matched later), parse it as an expression. Fixes <rdar://problem/13700933>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180970 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02Fix crasher when the range in a C++ range-for loop has an ill-formed ↵Douglas Gregor
initializer. Fixes <rdar://problem/13712739>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180937 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-01PR15884: In the 'taking the address of a temporary' extension, materialize theRichard Smith
temporary to an lvalue before taking its address. This removes a weird special case from the AST representation, and allows the constant expression evaluator to deal with it without (broken) hacks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180866 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-01Point diagnostics that complain about a use of a selector in an objc ↵Argyrios Kyrtzidis
message, to the selector location. Previously it would point to the left bracket or the receiver, which can be particularly problematic if the receiver is a block literal and we end up point the diagnostic far away for the selector that is complaining about. rdar://13620447 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180833 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-30Fix PR15845: apparently MSVC does not support implicit int in C++ mode.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180822 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-30When deducing an 'auto' type, don't modify the type-as-written.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180808 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-30Don't treat a non-deduced 'auto' type as being type-dependent. Instead, thereRichard Smith
are now two distinct canonical 'AutoType's: one is the undeduced 'auto' placeholder type, and the other is a deduced-but-dependent type. All deduced-to-a-non-dependent-type cases are still non-canonical. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180789 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-30Fix very confusing indent in Sema.cpp.Daniel Jasper
This came up during my Euro LLVM 2013 talk on clang-format and I was asked to submit it :-). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180772 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-30Objective-C (mostly arc): Under ARC, we often have unneeded qualifiers Fariborz Jahanian
in the diagnostics. Remove them when reporting incompatible Objective-C pointer types. // rdar://13752880. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180765 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-29c language: diagnose use of "[*]" on any array dimensionFariborz Jahanian
in the parameter of a function definition. Currently, it crashes in irgen if it is on other than the 1st dimension. // rdar://13705391 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180732 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-29Use ArrayRef in AddMethodCandidate.Rafael Espindola
Patch by Robert Wilhelm! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180724 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-29Small CapturedStmt improvementsBen Langmuir
Add a CapturedStmt.h similar to Lambda.h to reduce the typing required to get to the CapturedRegionKind enum. This also allows codegen to access this enum without including Sema/ScopeInfo.h. Also removes some duplicated code for capturing 'this' between CapturedStmt and Lambda. Differential Revision: http://llvm-reviews.chandlerc.com/D712 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180710 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-29Test commitBen Langmuir
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180709 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-29Implement DR580: access checks for template parameters of a class template areRichard Smith
performed within the context of that class template. Patch by Ismail Pazarbasi! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180707 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-29Fix an assertion failure / accepts-invalid in -fms-extensions mode. Don't buildRichard Smith
a dependent-scope id expression when a templated member function of a non-templated class references an unknown identifier, since instantiation won't rebuild it (and we can tell at parse time that it'll never work). Based on a patch by Faisal Vali! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180701 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-27ArrayRef'ize Sema::ActOnEnumBody. No functionality change.Dmitri Gribenko
Patch by Robert Wilhelm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180682 91177308-0d34-0410-b5e6-96231b3b80d8