Граф коммитов

4921 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek dd0e490c24 After a lengthy design discussion, add support for "ownership attributes" for malloc/free checking. Patch by Andrew McGregor!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109939 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-31 01:52:11 +00:00
Sebastian Redl 1450ef9989 Correctly deal with using names for both functions and structs in chained PCH.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109871 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-30 17:25:10 +00:00
Fariborz Jahanian 73f666ff7c Tighten the rules when deciding if an ivar must be
auto-synthesized (nonfragile-abi2 specific).
Fixes radar 8251648.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-30 16:59:05 +00:00
Abramo Bagnara 35f9a196ef Fixed typedef inside extern "C".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109865 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-30 16:47:02 +00:00
John McCall 27940d2fb3 If a TST_typename has a null type, mark the declarator invalid. Prevents
some downstream crashes, among them rdar://problem/8229840.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109850 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-30 05:17:22 +00:00
Nate Begeman bb37f50c2d Wire up sema checking for __builtin_arm_usat and __builtin_arm_ssat immediates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109814 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 22:48:34 +00:00
Fariborz Jahanian b1d58e3a62 Tigthen the condition for issung ivar shadowing
variables to those in file scope (nonfragile-abi2).
Fixes radar 8248681.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109758 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 16:53:53 +00:00
Douglas Gregor 5492b02e26 When dynamic_cast'ing from a type to itself, fill in the cast kind
with CK_NoOp. Fixes PR7727.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109757 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 16:12:45 +00:00
Douglas Gregor 8f70ddb557 When taking the address of a value of Objective-C object type (e.g.,
one because we're referencing a variable of type NSString &), the
resulting type is an ObjCObjectPointerType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109753 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 16:05:45 +00:00
Douglas Gregor 447234dd45 Allow a looser form of compatibility checking (which ignores
qualifiers) when checking a K&R function definition against a previous
prototype. Fixes <rdar://problem/8193107>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109751 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 15:18:02 +00:00
Douglas Gregor 254a9427ff When deleting a value of class type, make sure that type is complete
before looking for conversions to pointer type. Fixes <rdar://problem/8248780>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109749 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 14:44:35 +00:00
Douglas Gregor 98c2e6248f Don't set out-of-line template specialization/definition information
for AST nodes that aren't actually out-of-line (i.e., require a
nested-name-specifier). Fixes <rdar://problem/8204126>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109704 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 23:59:57 +00:00
Douglas Gregor 9d4bb94626 Don't die when a member access refers to a non-class member via a
qualified name. Fixes <rdar://problem/8231724>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109682 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 22:27:52 +00:00
Douglas Gregor f957843641 When performing code completion for a case statement in a switch whose
condition is not of enumeration type, provide code-completion results
containing all values of integral or enumeral type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109677 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 21:50:18 +00:00
Douglas Gregor 6813d7ba5f Enable expression transformations in the current-instantiation
rebuilder, i.e., remove a silly short-sighted hack from long
ago. Thanks to Abramo Bagnara for the test case/bug report!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109583 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 15:14:14 +00:00
Douglas Gregor ac7cbd8102 When a nested-name-specifier refers into a current instantiation that has
dependent bases, construct a dependent nested-name-specifier rather
than complaining that the name could not be found within the current
instantiation itself. Fixes PR7725.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109582 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 14:49:07 +00:00
Eli Friedman 0246376203 Fix a minor crash bug with constructs like Obj.Class::ENUM_VALUE.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109537 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-27 20:51:02 +00:00
Eli Friedman 787b094695 PR7724: Don't try to evaluate value-dependent expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109532 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-27 19:14:53 +00:00
Michael J. Spencer 96827eb524 Revert r109428 "Hoist argument type checking into CheckFormatHandler. This is prep for scanf format"
Got errors about ASTContext being undefined with Visual Studio 2010.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109491 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-27 04:46:02 +00:00
Dan Gohman 6bdeb4024a Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109443 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 21:33:22 +00:00
Dan Gohman 3c46e8db99 Fix namespace polution.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109440 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 21:25:24 +00:00
Ted Kremenek f762905bde Hoist argument type checking into CheckFormatHandler. This is prep for scanf format
string argument type checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109428 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 19:45:54 +00:00
Ted Kremenek 666a197deb Consolidate #args checking for scanf/printf format strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109427 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 19:45:42 +00:00
Sebastian Redl 66d0acd5f1 Make sure that implicit qualification and derived-to-base conversions of xvalues preserve xvalue-ness. Unfortunately I have no idea how to test this property; there doesn't seem to be a syntactical construct that triggers such a conversion and still allows the distinction between prvalues and xvalues to be made.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109406 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 17:52:21 +00:00
Nick Lewycky 5606220447 Add source location information to C++ base specifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109396 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 16:56:01 +00:00
Douglas Gregor 37db4db11b Kill off the last Destroy method in the AST library
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109378 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-25 18:23:53 +00:00
Douglas Gregor ff331c1572 Remove the vast majority of the Destroy methods from the AST library,
since we aren't going to be calling them ever.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109377 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-25 18:17:45 +00:00
Eli Friedman 9557f5387a Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109358 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-24 21:35:09 +00:00
Eli Friedman 0f2b97d1b0 PR7698: Make sure we correctly handle the initialization of an array with
dependent size.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109356 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-24 21:19:15 +00:00
Chris Lattner b7690b4258 turn down the logical bitwise confusion warning to not warn
when the RHS of the ||/&& is ever 0 or 1.  This handles a variety of
creative idioms for "true" used in C programs and fixes many false 
positives at the expense of a few false negatives.  This fixes
rdar://8230351.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-24 01:10:11 +00:00
John McCall 5a18039787 Support catching Objective C pointers in C++ under the non-fragile NeXT runtime.
Diagnose attempts to do this under the GNU or fragile NeXT runtimes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-24 00:37:23 +00:00
Douglas Gregor f178dcab50 Be careful; even though we had a proper name at the beginning of
Sema::ActOnDeclarator doesn't mean that the Decl we ended up creating
has a useful name. <rdar://problem/8229910>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109296 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-24 00:10:38 +00:00
John McCall acb7039ca3 We never want to pop the translation unit DC, so assert if this happens.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109280 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23 22:45:07 +00:00
Fariborz Jahanian eb024acef8 Allow __func__ and __FUNCTION__ and __PRETTY_FUNCTION__ inside blocks.
Radar 8218839.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109272 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23 21:53:24 +00:00
Eli Friedman 0fab8cd9bd Fix for PR7694: make sure to pass in a RecordType to CheckBaseClassAccess;
fixes crashes on both valid and invalid code.  The diagnostic here could
potentially be improved, but it's good enough as-is.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109257 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23 19:25:41 +00:00
Douglas Gregor f609462227 Vectors are not integer types, so the type system should not classify
them as such. Type::is(Signed|Unsigned|)IntegerType() now return false
for vector types, and new functions
has(Signed|Unsigned|)IntegerRepresentation() cover integer types and
vector-of-integer types. This fixes a bunch of latent bugs.

Patch from Anton Yartsev!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109229 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23 15:58:24 +00:00
Bill Wendling 67a213b1ef Remove unneeded iostream include.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109219 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23 07:19:31 +00:00
Fariborz Jahanian 69d5624644 Warn when property ivar lookup finds a global variable
of same name. In nonfragile-abi2, lookup accesses a synthesized
ivar. This is a transition warning.  Radar 8225011.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109197 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-22 23:33:21 +00:00
Fariborz Jahanian 3fe104154d atch for implementation of objective-c's -Wselector
warning flag in clang. Little more to do
for a PCH issue. Radar 6507158.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109129 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-22 18:24:20 +00:00
Ted Kremenek 042411cc44 Upgrade "'X' is unavailable" from a warning to an error. This matches GCC's behavior. Note that
GCC emits a warning instead of an error when using an unavailable Objective-C protocol, so now
Clang's behavior is more strict in this case, but more consistent.  We will need to see how much
this fires on real code and determine whether this case should be downgraded to a warning.

Fixes <rdar://problem/8213093>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109033 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 20:43:11 +00:00
Fariborz Jahanian 0a2eb5685a Added extra check when looking for location of '=' in
a copy initialization.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109025 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 18:40:47 +00:00
Fariborz Jahanian 10f8e31956 Fix source location of the initializer in
a copy initialization. Back out hack in objc rewriter.
fixes radar 8213998.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109024 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 18:31:47 +00:00
Ted Kremenek 1e51c200b1 Hookup checking for invalid length modifiers in scanf format strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108907 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 20:04:47 +00:00
Ted Kremenek 6ecb950c65 Add 'ConversionSpecifier' root class in 'analyze_format_string' namespace and
derived 'PrintfConversionSpecifier' from this class.  We will do the same for
'ScanfConversionSpecifier'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108903 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 20:04:27 +00:00
Ted Kremenek 35d353b47b Rename 'ConsumedSoFarArg' -> 'nArg' and 'OutIntPtrArg' to 'nArg' (scanf and printf checking).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108900 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 20:04:10 +00:00
Ted Kremenek 649aecf556 Rename diagnostic so that it can be reused with scanf checking. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108896 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 20:03:43 +00:00
Argyrios Kyrtzidis 2c853e401c Hide FunctionTemplateDecl's specializations folding set as implementation detail and introduce
FunctionTemplateDecl::findSpecialization.

Redeclarations of specializations will not cause the previous decl to be removed from the set,
the set will keep the canonical decl. findSpecialization will return the most recent redeclaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108834 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 13:59:58 +00:00
Argyrios Kyrtzidis cc0b1bc979 Hide the specializations folding sets of ClassTemplateDecl as an implementation detail (InsertPos
leaks though) and add methods to its interface for adding/finding specializations.

Simplifies its users a bit and we no longer need to replace specializations in the folding set with
their redeclarations. We just return the most recent redeclarations.

As a bonus, it fixes http://llvm.org/PR7670.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108832 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 13:59:28 +00:00
Sebastian Redl 906082edf2 Update ImplicitCastExpr to be able to represent an XValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108807 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 04:20:21 +00:00
Ted Kremenek baa400654b Don't warn when a '%%' or '%*d' (scanf) is used in a format string with positional arguments, since
these don't actually consume an argument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108757 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 22:01:06 +00:00
Ted Kremenek c09b6a59e0 Hook up 'invalid conversion' warning for scanf format strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108750 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 21:25:57 +00:00
Fariborz Jahanian 84ef4b20b3 Categories cannot synthesize property ivars,
and a minor cleanup.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108707 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 16:14:33 +00:00
Zhongxing Xu 7a42054b18 Fix construction of AnalysisContext. Thanks Daniel.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108694 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 13:16:50 +00:00
Argyrios Kyrtzidis e3041be307 Fix http://llvm.org/PR7660
A ParmVarDecl instantiated from a FunctionProtoType may have Record as DeclContext,
in which case isStaticDataMember() will erroneously return true.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108692 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 10:14:41 +00:00
Chandler Carruth 8d13d221cf Fix a goof in my previous patch -- not all of the builtins return a value, some
fixed return types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108657 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-18 20:54:12 +00:00
Peter Collingbourne 8a6c0f1a48 When instantiating function definitions set parameter names to those used in template
The rationale is that we are copying the entire definition including
parameter names which may differ between the declaration and the
definition.

This is particularly important if any parameters are unnamed in the
declaration, as a DeclRef to an unnamed ParmVarDecl would cause the
pretty printer to produce invalid output.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108643 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-18 16:45:46 +00:00
Chandler Carruth db4325b098 Improve the representation of the atomic builtins in a few ways. First, we make
their call expressions synthetically have the "deduced" types based on their
first argument. We only insert conversions in the AST for arguments whose
values require conversion to match the value type expected. This keeps PR7600
closed by maintaining the return type, but avoids assertions due to unexpected
implicit casts making the type unsigned (test case added from Daniel).

The magic is moved into the codegen for the atomic builtin which inserts the
casts as needed at the IR level to raise the type to an integer suitable for
the LLVM intrinsic. This shouldn't cause any real change in functionality, but
now we can make the builtin be more truly polymorphic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108638 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-18 07:23:17 +00:00
Chris Lattner 9638eef7e3 BUILD_ARCHIVE is the default for libraries, no need to set it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108633 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-18 00:14:47 +00:00
Eli Friedman 8d438087bd Check for casts to an incomplete type in C. Improves diagnostics for cast to
incomplete union (PR5692) and incomplete enum, and fixes obscure
accepts-invalid on cast to incomplete struct.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108630 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-17 20:43:49 +00:00
Fariborz Jahanian ad51e74030 Patch to synthesize property ivars on demand as
part of the new property synthesis by default.
wip.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108599 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-17 00:59:30 +00:00
Anders Carlsson 0ea4dfd0eb When checking whether to bind an expression to a temporary, don't bind Obj-C message send expressions who call methods that return references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108559 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 21:18:37 +00:00
Ted Kremenek b7c21018ec Hook up warning for an incomplete scanlist in scanf format strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108542 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 18:28:03 +00:00
Douglas Gregor f9f97a0ea1 When performing template name lookup for a dependent member access
expression such as the "foo" in "this->blah.foo<1, 2>", and we can't
look into the type of "this->blah" (e.g., because it is dependent),
look into the local scope of a template of the same name. Fixes
<rdar://problem/8198511>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108531 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 16:54:17 +00:00
Douglas Gregor a0ebd60bfd Revert Microsoft-specific override of the "typedef requires a name"
diagnostic. Instead, put it and the "declaration does not declare
anything" warning into -Wmissing-declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108527 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 15:40:40 +00:00
Douglas Gregor 0c99ec6d22 Suppress the "typedef requires a name" warning in Microsoft-extensions mode
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108526 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 15:18:19 +00:00
John McCall c9068d7dd9 Treat template parameters as part of the declaration-specifiers for the
purpose of access control.  Fixes PR7644.

I can't actually find anything directly justifying this, but it seems obvious.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108521 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 08:13:16 +00:00
Daniel Dunbar ddc6ff6b9a Sema: Fix a bug with #pragma options align=reset, reset against an empty stack
is well defined, it resets to the default alignment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108508 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 04:54:16 +00:00
Chandler Carruth b21fc4a4c1 Butcher a perfectly reasonable diagnostic to pacify old versions of SWIG.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108505 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 04:32:28 +00:00
Ted Kremenek 826a3457f7 Add most of the boilerplate support for scanf format string checking. This includes
handling the parsing of scanf format strings and hooking the checking into Sema.
Most of this checking logic piggybacks on what was already there for checking printf format
strings, but the checking logic has been refactored to support both.

What is left to be done is to support argument type checking in format strings and of course
fix the usual tail of bugs that will follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108500 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 02:11:22 +00:00
Ted Kremenek bee05c1206 Add builtin definition for scanf, including extending the builtin encoding to
represent builtins that have the "scanf" attribution (via the format attribute) just
like we do with printf functions.  Follow-up work is needed to add similar support
for fscanf et al.

This is to support format-string checking for scanf functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108499 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 02:11:15 +00:00
Douglas Gregor 35e12c90c1 Make the "unused result" warning a warning about run-time behavior, so
that we don't warn when there isn't going to be any computation anyway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108442 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 18:47:04 +00:00
Chris Lattner 23ef3e4f04 restrict the && -> & warning to cover a case daniel noted.
Don't warn about "logically bool" expressions on the RHS,
even if they fold to a constant.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108388 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 00:26:43 +00:00
Douglas Gregor 66a8c9a6b1 When determining whether an overload set with explicit template
arguments only resolves to a single specialization, make sure to look
through using declarations. Fixes PR7641.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108376 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 23:20:53 +00:00
Douglas Gregor 0167f3c255 When there are extra or missing template parameter lists in a template
definition, we're likely going to end up breaking the invariants of
the template system, e.g., that the depths of template parameter lists
match up with the nesting template of the template. So, make sure we
mark such ill-formed declarations as invalid or don't even build them
at all.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108372 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 23:14:12 +00:00
Fariborz Jahanian d3635b9681 Don't error when doing default property synthesis
and some are already synthesized by user declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108341 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 18:11:52 +00:00
Douglas Gregor 797efb51ce Only filter out names reserved for the implementation (e.g., __blah or
_Foo) from code-completion results when they come from a system
header.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108338 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 17:44:04 +00:00
Fariborz Jahanian 9ccd725104 Consider obective-c pointer arguments as valid sentinel args
as well. Fixes radar 7975788.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108333 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 16:37:51 +00:00
Douglas Gregor e39a389451 Introduce a new cast kind for an "lvalue bitcast", which handles
reinterpret_casts (possibly indirectly via C-style/functional casts)
on values, e.g., 

  int i;
  reinterpret_cast<short&>(i);

The IR generated for this is essentially the same as for

  *reinterpret_cast<short*>(&i).

Fixes PR6437, PR7593, and PR7344. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108294 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 23:17:26 +00:00
Fariborz Jahanian ae415dc21e Check on property attributes which are declared
in class extensions (radar 8171968).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108283 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 22:04:56 +00:00
Fariborz Jahanian 55a17c057c Set DeclContext of ParamVarDecl only. No need
to set that of VarDecl for block variables
(they are already set). Per Doug's comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108273 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 21:05:02 +00:00
Fariborz Jahanian e7ffbe233e More block instantiation stuff. Set variable/param DeclContext
to block context when first instantiating them.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108266 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 20:05:58 +00:00
Chris Lattner 90a8f27f14 Add a warning to catch a bug recently caught by code review, like this:
t2.c:2:12: warning: use of logical && with constant operand; switch to bitwise &
      or remove constant [-Wlogical-bitwise-confusion]
  return x && 4;
           ^  ~

wording improvement suggestions are welcome.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108260 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 19:41:32 +00:00
Chris Lattner 3d4b482b5f 80 column issues.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108257 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 19:22:31 +00:00
Douglas Gregor 6398235d78 Whenever we're creating an expression that is typically an rvalue
(e.g., a call, cast, etc.), immediately adjust the expression's type
to strip cv-qualifiers off of all non-class types (in C++) or all
types (in C). This effectively extends my previous fix for PR7463,
which was restricted to calls, to other kinds of expressions within
similar characteristics. I've audited every use of
getNonReferenceType() in the code base, switching to the newly-renamed
getNonLValueExprType() where necessary. 

Big thanks to Eli for pointing out just how incomplete my original fix
for PR7463 actually was. We've been handling cv-qualifiers on rvalues
wrong for a very, very long time. Fixes PR7463.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108253 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 18:40:04 +00:00
Douglas Gregor 4bd40318cb Downgrade the "when type is in parentheses, array cannot have dynamic
size" error for code like 

  new (int [size])

to a warning, add a Fix-It to remove the parentheses, and make this
diagnostic work properly when it occurs in a template
instantiation. <rdar://problem/8018245>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108242 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 15:54:32 +00:00
Douglas Gregor de80ec1fa9 Improve diagnostics for the "type qualifier on return type has no
effect warning" by printing the qualifiers we saw and correctly
pluralizing the message, e.g.,

test/SemaCXX/conditional-expr.cpp:295:3: warning: 'const volatile' type
      qualifiers on return type have no effect
  const volatile Enum g2() {
  ^~~~~ ~~~~~~~~





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108236 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 08:50:30 +00:00
Douglas Gregor 5291c3cec0 When forming a function call or message send expression, be sure to
strip cv-qualifiers from the expression's type when the language calls
for it: in C, that's all the time, while C++ only does it for
non-class types. 

Centralized the computation of the call expression type in
QualType::getCallResultType() and some helper functions in other nodes
(FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant
callers of getResultType() to getCallResultType().

Fixes PR7598 and PR7463, along with a bunch of getResultType() call
sites that weren't stripping references off the result type (nothing
stripped cv-qualifiers properly before this change).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108234 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 08:18:22 +00:00
Douglas Gregor aef01998af Diagnose typedef of an operator name. Fixes PR7462
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108233 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 06:37:01 +00:00
Douglas Gregor a131d0fc0a Complain when an unnamed enumeration has no enumerations (in
C++). Fixes PR7466.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108231 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 06:24:26 +00:00
Fariborz Jahanian 8dd0c56264 Instantiate attributes when first building an instantiated
VarDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108218 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 00:16:40 +00:00
Douglas Gregor 669eed8d67 Provide a special diagnostic for attempts to explicitly specialize
class templates within class scope (which is ill-formed), and recover
by dropping the explicit specialization entirely. Fixes the infinite
loop in PR7622.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108217 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 00:10:04 +00:00
Sebastian Redl f9ea1f392a Produce an error on encountering a pointer or reference to a qualified function type. Fixes PR7470.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108209 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 23:11:43 +00:00
Fariborz Jahanian cad8d31117 Copy over attributes to instantiated variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108195 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 21:12:19 +00:00
Fariborz Jahanian 84ca008a46 Compute Type dependent-ness of BlockDeclRefExpr
on the fly when constructing it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108166 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 18:12:03 +00:00
Fariborz Jahanian 52bc56a296 Move setting of Dependent Type to BlockDeclRefExpr's
constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108157 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 17:26:57 +00:00
Chandler Carruth 64d092c232 Fix another aspect of PR7047, macro expansions. Previously, this was hacked
around by exempting enums from the check, but this doesn't handle a lot of
cases. A better approach is to directly check if the operator comes from
a macro expansion.

I've removed a reference to the rdar that originally led to the enum
suppression when removing it's overly contrived test case. Let me know if that
number or a more reasilistic test case involving enums is still needed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108128 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 06:23:38 +00:00
Dale Johannesen 720b6392f9 Fix compile error. Per Fariborz.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-10 19:53:56 +00:00
Chandler Carruth 999194739e Lay the ground work for resoving PR7047. This doesn't actually fix it because
default arguments to template parameters don't have a DeclContext when
instantiated, and so we can't detect that we're in an instantiation context as
opposed to the definition context. However, it fixes the more commonly-occuring
cases in TMP code that use devolve to this type of tautology after
substitution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108044 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-10 12:30:03 +00:00
Fariborz Jahanian 833f42e327 BlockDeclRefExpr of a dependent type must
be a dependent expression when its is built.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108026 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 22:21:32 +00:00
Fariborz Jahanian 5750b81beb Instantiation of byref variable in
block literal expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108019 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 21:27:28 +00:00
Sebastian Redl c61bb20561 Slightly improve the diagnostic when using a qualified function typedef to declare nonmember or static member functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108018 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 21:26:08 +00:00
Chandler Carruth 7479ef6b5d Rip out the floating point return type handling from the atomic builtin. It's
wrong, and we don't handle floating point value type arguments yet anyways.
Will add correct logic for both when I finish the patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108004 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 19:19:40 +00:00
Chandler Carruth d201457cc7 Fix PR7600, and correctly convert the result of an atomic builtin to the
expected value type. This is necessary as the builtin is internally represented
as only operating on integral types.

Also, add a FIXME to add support for floating point value types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108002 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 18:59:35 +00:00
Fariborz Jahanian a729da2c29 Instantiation of block literal expressions. wip.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108000 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 18:44:02 +00:00
Douglas Gregor a0068fc643 Introduce -f{no-}spell-checking options to enable/disable
spell-checking. By default, spell-checking is enabled for Clang
(obviously) but disabled in CIndex for performance reasons.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107992 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 17:35:33 +00:00
Douglas Gregor 40ed9a13f5 Support code completion for parameter names in Objective-C method
declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107933 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 23:37:41 +00:00
Douglas Gregor 1f5537aaac Introduce a new code-completion point prior to an identifier in the
selector of an Objective-C method declaration, e.g., given

  - (int)first:(int)x second:(int)y;

this code completion point triggers at the location of "second". It
will provide completions that fill out the method declaration for any
known method, anywhere in the translation unit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107929 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 23:20:03 +00:00
Sebastian Redl cddc69fc3f When looking for an entity's Scope, don't consider scopes that can't contain declarations. Fixes PR7594.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107927 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 23:07:34 +00:00
Douglas Gregor 590c7d5e79 During code completion, give the "nil" and "NULL" macros the same
priority as other constants. And, if we're in a place where we prefer
a pointer type, consider "nil" and "NULL" to be close matches.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107910 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 20:55:51 +00:00
Douglas Gregor bf9fb88e29 Allow C-style casts and reinterpret_casts between block pointers and
either integer values or other pointers. Fixes <rdar://problem/8134521>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107905 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 20:27:32 +00:00
Douglas Gregor 24bae92f08 When performing substitution of template arguments within the body of
a template, be sure to include the template arguments from the
injected-class-name. Fixes PR7587.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107895 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 18:37:38 +00:00
Chandler Carruth 7d5c45ed9d Add support for differentiating between attributes ignored when handled and
unknown attributes that we discard. Add a diagnostic group for unknown
attribute warnings to allow turning these off when we don't care. Also
consolidates the tests for this case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107864 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 09:42:26 +00:00
Douglas Gregor ed8abf1832 Reinstate the fix for PR7556. A silly use of isTrivial() was
suppressing copies of objects with trivial copy constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107857 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 06:14:04 +00:00
Douglas Gregor 84745677f6 Revert r107828 and r107827, the fix for PR7556, which seems to be
breaking bootstrap on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107837 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 23:37:33 +00:00
Sebastian Redl c0fee50ce4 Rip out the C++0x-specific handling of destructor names. The specification is still in flux and unclear, and our interim workaround was broken. Fixes PR7467.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107835 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 23:17:38 +00:00
Douglas Gregor 09acc9863f A using declaration can redeclare a typedef to the same type. These
typedefs won't have the same canonical declaration (since they are
distinct), so we need to check for this case specifically. Fixes
<rdar://problem/8018262>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107833 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 23:08:52 +00:00
Douglas Gregor 016a4a90c8 Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect its
newly-narrowed scope. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107828 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 22:43:56 +00:00
Douglas Gregor 63ef464c3f Do not use CXXZeroValueInitExpr for class types. Instead, use
CXXConstructExpr/CXXTemporaryObjectExpr/CXXNewExpr as
appropriate. Fixes PR7556, and provides a slide codegen improvement
when copy-initializing a POD class type from a value-initialized
temporary. Previously, we weren't eliding the copy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107827 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 22:35:13 +00:00
Nate Begeman 3e31552aed Fix an issue with opencl init list checking.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107824 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 22:26:56 +00:00
Argyrios Kyrtzidis 06a54a38be Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH.
Makes de-serialization of the function body even more "lazier".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107768 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 11:31:19 +00:00
Chris Lattner 8b5dec3002 implement PR7569, warning about assignment to null, which
people seem to write when they want a deterministic trap.
Suggest instead that they use a volatile pointer or 
__builtin_trap.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107756 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 06:14:23 +00:00
Nick Lewycky 03d98c5d59 Fix multiple emission of the this-> fixit for each instantiation by fixing the
AST during the instantiation. Fixes PR7417!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107690 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06 19:51:49 +00:00
Douglas Gregor 7e9b57b9db Correctly set the location of the "template" keyword for a class
template specialization, from Peter Collingbourne.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107682 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06 18:33:12 +00:00
Douglas Gregor af57280ff8 Remove my egregious hack that forced deserialization of visible
declarations when implicitly declaring the default constructor, copy
constructor, destructor, and copy-assignment operators of a
class. Argiris fixed the underlying problem in r107596.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107681 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06 18:29:01 +00:00
Chris Lattner c721ae85ba fix a bug I introduced in r107624
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107626 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-05 19:36:34 +00:00
Chris Lattner fd79a9d403 rearrange some logic, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107624 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-05 19:17:26 +00:00
Argyrios Kyrtzidis 006113841b Don't try to install the __[u]int128_t identifier if it is already installed by PCHReader.
Currently, adding it to visible decls of a PCH'ed translation unit has no effect because
adding visible decls before deserialization has no effect (the decls won't be visible).
This will be fixed in a future commit; then it will force deserialization of visible decls, so avoid pointlessly installing it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107595 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-04 21:44:19 +00:00
John McCall 5efd91a3b5 Mark the operator delete associated with a virtual destructor as referenced.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107573 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-03 18:33:00 +00:00
Douglas Gregor 1827403a71 Lazily declare default constructors. We now delay the construction of
declarations for implicit default constructors, copy constructors,
copy assignment operators, and destructors. On a "simple" translation
unit that includes a bunch of C++ standard library headers, we
generate relatively few of these implicit declarations now:

  4/159 implicit default constructors created
  18/236 implicit copy constructors created
  70/241 implicit copy assignment operators created
  0/173 implicit destructors created

And, on this translation unit, this optimization doesn't really
provide any benefit. I'll do some more performance measurements soon,
but this completes the implementation work for <rdar://problem/8151045>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107551 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-03 00:47:00 +00:00
Douglas Gregor 225843186e Lazily declare implicit copy constructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107543 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-02 23:41:54 +00:00
Douglas Gregor e5eee5a52d Introduce a new routine, LookupConstructors(), and use it for all
constructor-name lookup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107536 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-02 23:12:18 +00:00
Douglas Gregor a376d10acf Lazily declare copy-assignment operators.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107521 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-02 21:50:04 +00:00
Douglas Gregor 4923aa25eb Lazily declare the implicitly-declared destructor in a C++ class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107510 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-02 20:37:36 +00:00
Douglas Gregor 23c94dbb66 Move the "current scope" state from the Parser into Action. This
allows Sema some limited access to the current scope, which we only
use in one way: when Sema is performing some kind of declaration that
is not directly driven by the parser (e.g., due to template
instantiatio or lazy declaration of a member), we can find the Scope
associated with a DeclContext, if that DeclContext is still in the
process of being parsed. 

Use this to make the implicit declaration of special member functions
in a C++ class more "scope-less", rather than using the NULL Scope hack.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107491 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-02 17:43:08 +00:00
Douglas Gregor db89f289a2 Add a new routine Sema::LookupDestructor and make all destructor-lookup calls use that routine
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107444 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 22:47:18 +00:00
Douglas Gregor eb8c670d29 Provide exception specifications for implicitly-declared default constructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107437 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 22:31:05 +00:00
Douglas Gregor 32df23e749 Move the implicit declaration of a default constructor into a separate
routine; no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107434 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 22:02:46 +00:00
Douglas Gregor 0d405db2d8 Provide exception specifications for implicitly-declared copy constructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107429 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 20:59:04 +00:00
Douglas Gregor fabd43a5e3 Move the implicit declaration of a constructor out to a separate
method. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107415 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 19:09:28 +00:00
Douglas Gregor 598a8543ec Teach DeclareImplicitCopyConstructor how to cope with virtual bases
and multi-dimensional array fields. Fixes several bugs found by
inspection.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107411 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 18:27:03 +00:00
Douglas Gregor 4a0c26f57f Move declaration of a class's implicit copy constructor into a
separate function. Aside from making the loops infinitely faster, no
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107407 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 17:57:27 +00:00
Douglas Gregor b87786f045 Provide an exception-specification for an implicitly-declared
copy-assignment operator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107406 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 17:48:08 +00:00
Douglas Gregor d3c359041b Move the implicit declaration of a class's copy-assignment operator
into a separate routine. No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107402 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 16:36:15 +00:00
Douglas Gregor 4681ca8400 Make loops infinitely faster. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107398 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 15:29:53 +00:00
Douglas Gregor 1d110e05e0 Remove unnecessary ASTContext parameter from
CXXRecordDecl::getDestructor(); no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107394 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 14:13:13 +00:00
Douglas Gregor d92ec474fa Reinstate fix for PR7526, which was failing because, now that we
aren't dropping all exception specifications on destructors, the
exception specifications on implicitly-declared destructors were
detected as being wrong (which they were). 

Introduce logic to provide a proper exception-specification for
implicitly-declared destructors. This also fixes PR6972.

Note that the other implicitly-declared special member functions also
need to get exception-specifications. I'll deal with that in a
subsequent commit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107385 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 05:10:53 +00:00
Douglas Gregor 4712c02c15 When performing copy initialization via user-defined conversions,
don't allow two user-defined conversions. Fixes PR6595 (again).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107379 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 03:43:00 +00:00
Douglas Gregor 4b662a5684 Revert r107374, which broke bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107378 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 03:28:42 +00:00
Douglas Gregor 2fef752aeb When building the type of a destructor, make sure to keep the
exception specification. Fixes PR7526.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107374 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 02:33:15 +00:00
Douglas Gregor 2f9d8740f5 Extend the "cannot convert from base class pointer to derived class
pointer" diagnostic to handle references, too.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107372 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 02:14:45 +00:00