Douglas Gregor [Mon, 9 May 2011 20:45:16 +0000 (20:45 +0000)]
When determining whether we need to instantiate a function type,
also consider whether any of the parameter types (as written, prior to
decay) are dependent. Fixes PR9880 and <rdar://problem/9408413>.
Anders Carlsson [Sun, 8 May 2011 17:25:05 +0000 (17:25 +0000)]
Don't emit complete constructors for abstract classes. Also, don't emit
complete destructors for abstract classes unless the destructor is virtual
and thus needs to be in the vtable.
Douglas Gregor [Sun, 8 May 2011 06:09:53 +0000 (06:09 +0000)]
Relax the conversion rules for Objective-C GC qualifiers a
bit by allowing __weak and __strong to be added/dropped as part of
implicit conversions (qualification conversions in C++). A little
history: GCC lets one add/remove/change GC qualifiers just about
anywhere, implicitly. Clang did roughly the same before, but we
recently normalized the semantics of qualifiers across the board to
get a semantics that we could reason about (yay). Unfortunately, this
tightened the screws a bit too much for GC qualifiers, where it's
common to add/remove these qualifiers at will.
Overall, we're still in better shape than we were before: we don't
permit directly changing the GC qualifier (e.g., __weak -> __strong),
so type safety is improved. More importantly, we're internally
consistent in our handling of qualifiers, and the logic that allows
adding/removing GC qualifiers (but not adding/removing address
spaces!) only touches two obvious places.
Douglas Gregor [Sat, 7 May 2011 22:06:45 +0000 (22:06 +0000)]
In C++, allow us to emit a global as 'constant' even if it has class
type, so long as it is known to have a constant initializer and the
class type is a POD class. Fixes <rdar://problem/9306265>.
Francois Pichet [Sat, 7 May 2011 19:04:49 +0000 (19:04 +0000)]
Don't fail at parsing __declspec(property(get=get_func_name)). Just skip everything inside property() for now while we wait for the BoostPro people to provide a complete patch.
Douglas Gregor [Fri, 6 May 2011 23:28:47 +0000 (23:28 +0000)]
When checking for a prior declaration of the name of a namespace, skip
any names that aren't in the appropriate identifier namespaces. Fixes
an embarrassing bug where we give a redefinition error due to an
Objective-C category (<rdar://problem/9388207>).
Douglas Gregor [Fri, 6 May 2011 21:43:30 +0000 (21:43 +0000)]
Keep track of the file ID corresponding to the original file used to
build a precompiled header. Use this information to eliminate the call
to SourceManager::getLocation() while loading a precompiled preamble,
since SourceManager::getLocation() itself causes unwanted
deserialization.
Francois Pichet [Fri, 6 May 2011 20:48:22 +0000 (20:48 +0000)]
Add support for Microsoft __if_exists and __if_not_exists construct inside function definition.
Allow to include or exclude code depending on if a symbol exists or not. Just like a #ifdef but for C/C++ symbols.
More doc: http://msdn.microsoft.com/en-us/library/x7wy9xh3(v=VS.100).aspx
Support at class and namespace scopes will be added later.
Sean Hunt [Fri, 6 May 2011 20:44:56 +0000 (20:44 +0000)]
Modify some deleted function methods to better reflect reality:
- New isDefined() function checks for deletedness
- isThisDeclarationADefinition checks for deletedness
- New doesThisDeclarationHaveABody() does what
isThisDeclarationADefinition() used to do
- The IsDeleted bit is not propagated across redeclarations
- isDeleted() now checks the canoncial declaration
- New isDeletedAsWritten() does what it says on the tin.
- isUserProvided() now correct (thanks Richard!)
Eli Friedman [Fri, 6 May 2011 18:04:18 +0000 (18:04 +0000)]
Don't emit nsw flags for vector operations; there's basically no benefit, and a lot of downside (like PR9850, which is about clang's xmmintrin.h making an unexpected transformation on an expression involving _mm_add_epi32).
Eli Friedman [Fri, 6 May 2011 17:27:27 +0000 (17:27 +0000)]
Add an implementation of thunks for varargs methods. The implementation is a bit messy, but it is correct as long as the method in question doesn't use indirect gotos. A couple of possible alternative implementations are outlined in FIXME's in this patch. rdar://problem/8077308 .
Douglas Gregor [Fri, 6 May 2011 16:33:08 +0000 (16:33 +0000)]
Introduce a new libclang parsing flag,
CXTranslationUnit_NestedMacroInstantiations, which indicates whether
we want to see "nested" macro instantiations (e.g., those that occur
inside other macro instantiations) within the detailed preprocessing
record. Many clients (e.g., those that only care about visible tokens)
don't care about this information, and in code that uses preprocessor
metaprogramming, this information can have a very high cost.
Axel Naumann [Fri, 6 May 2011 15:24:04 +0000 (15:24 +0000)]
Reset the emitted initializers.
This enables incremental codegen, where the initializer array can be removed from the module, such that only new initializers will be emitted and run.
Move logic for passing down -mrelax-all / -relax-all into a common
function. Extend the logic to check if the input was compiled.
Use -relax-all as default only if -O0 is used for compilation.
Fixes bug 9290.
Sean Hunt [Fri, 6 May 2011 01:42:00 +0000 (01:42 +0000)]
Do defaulted constructors properly.
Explictly defaultedness is correctly reflected on the AST, but there are
no changes to how that affects the definition of functions or much else
really.
Richard Smith [Thu, 5 May 2011 22:36:10 +0000 (22:36 +0000)]
Slight tweak to alias template error handling: don't guess that a template-id in an alias declaration was meant to be a specialization. Use a generic, but more accurate, diagnostic.
Richard Smith [Thu, 5 May 2011 22:07:51 +0000 (22:07 +0000)]
Update www: we now mangle references to function parameters properly. Also, this is really more a decltype issue rather than a late-specified return type issue.
Douglas Gregor [Thu, 5 May 2011 20:27:22 +0000 (20:27 +0000)]
When the environment variable LIBCLANG_RESOURCE_USAGE is set, teach
libclang to emit information about resource usage after parsing, code
completion, etc.
When instantiating a block expression, the instantiated
blockScopeInfo's CapturesCXXThis field need get set as
well. // rdar://9362021. John M. please review.
Douglas Gregor [Thu, 5 May 2011 16:13:52 +0000 (16:13 +0000)]
Scoped enumerations should not be treated as integer types (in the C
sense). Fixes <rdar://problem/9366066> by eliminating an inconsistency
between C++ overloading (which handled scoped enumerations correctly)
and C binary operator type-checking (which didn't).
Douglas Gregor [Thu, 5 May 2011 15:50:42 +0000 (15:50 +0000)]
When providing code completions for an Objective-C property access,
also include methods with zero-argument selectors. Implements
<rdar://problem/9048332>.
Douglas Gregor [Thu, 5 May 2011 00:13:13 +0000 (00:13 +0000)]
With invalid overloaded operators, we can get into funny cases where
the overloading of member and non-member functions results in arity
mismatches that don't fit well into our overload-printing scheme. This
only happens for invalid code (which breaks the arity invariants for
these cases), so just suppress the diagnostic rather than inventing
anything new. Fixes <rdar://problem/9222009>.
Douglas Gregor [Wed, 4 May 2011 23:50:46 +0000 (23:50 +0000)]
When adding KVC code completions, keep track of all of the selectors
that we've previously seen, both in declared methods and from previous
KVC completions, to eliminate duplicates. Fixes <rdar://problem/9162207>.
Sean Hunt [Wed, 4 May 2011 23:29:54 +0000 (23:29 +0000)]
there i fixed it
Increase robustness of the delegating constructor cycle detection
mechanism. No more infinite loops on invalid or logic errors leading to
false results. Ensure that this is maintained correctly accross
serialization.
Douglas Gregor [Wed, 4 May 2011 23:05:40 +0000 (23:05 +0000)]
Clean up Sema::BuildCXXNestedNameSpecifier()'s creation of TypeLoc
information. Rather than looking at the declaration kind to figure out
what TypeLoc to build, look at the type; it makes so much more
sense. Fixes <rdar://problem/9086649>.
We can use this to produce nice diagnostics (and try to fixit-and-recover) in
various cases where we might see "MyFunction" instead of "MyFunction()". The
changes in SemaExpr are an example of how to use isExprCallable.
Douglas Gregor [Wed, 4 May 2011 21:55:00 +0000 (21:55 +0000)]
When converting an integral template argument value to a non-type
template parameter of type 'bool', force the value to be zero or
one. Fixes <rdar://problem/9169404>.
Bill Wendling [Wed, 4 May 2011 21:37:25 +0000 (21:37 +0000)]
Pack ivar offsets together.
Ivar offsets for synthesized ivars are wrong, which could end up with a large
number of dirty pages because of ivar fixups at runtime. When we pack all of the
synthesized ivars into the same section, it limits the number of dirty pages
created. Place them in the "__DATA,__objc_ivar" section.
<rdar://problem/9374905>
More ms_struct bitfield stuff:
Adjacent bit fields are packed into the same 1-, 2-, or
4-byte allocation unit if the integral types are the same
size. // rdar://8823265.
Axel Naumann [Wed, 4 May 2011 12:59:24 +0000 (12:59 +0000)]
From Vassil Vassilev:
Like in r126648, provide (empty) default implementation for pure virtual getMemoryBufferSizes(). Not all use cases have meaningful implementations.
Axel Naumann [Wed, 4 May 2011 09:25:56 +0000 (09:25 +0000)]
Add C++ include paths for libstdc++ with Ubuntu 11.04 and Debian's libstdc++6-4.5, as collected from http://packages.ubuntu.com/search?mode=exactfilename&suite=natty§ion=all&arch=any&searchon=contents&keywords=c%2B%2Blocale.h and http://packages.debian.org/wheezy/armel/libstdc++6-4.5-dev/filelist
Fixes compilation with clang++ on Ubuntu 11.04.
Sean Hunt [Wed, 4 May 2011 05:57:24 +0000 (05:57 +0000)]
Implement a better version of delegating constructor cycle detection.
This is more efficient as it's all done at once at the end of the TU.
This could still get expensive, so a flag is provided to disable it. As
an added bonus, the diagnostics will now print out a cycle.
The PCH test is XFAILed because we currently can't deal with a note
emitted in the header and I, being tired, see no other way to verify the
serialization of delegating constructors. We should probably address
this problem /somehow/ but no good solution comes to mind.
John McCall [Wed, 4 May 2011 01:45:19 +0000 (01:45 +0000)]
Type prefixes of unresolved-names should only be mangled as unresolved-types
if they match that production, i.e. if they're template type parameters
or decltypes (or, as an obvious case not yet described in the ABI document,
if they're template template parameters applied to template arguments).
Ted Kremenek [Wed, 4 May 2011 01:38:46 +0000 (01:38 +0000)]
Enhance clang_getCXTUResourceUsage() to return the amount of memory used by the Preprocessor's bump allocator as well as those from the PreprocessingRecord.
Douglas Gregor [Wed, 4 May 2011 00:25:33 +0000 (00:25 +0000)]
When tag lookup finds something ambiguous, and we're defining a new
tag, filter out those ambiguous names that we found if they aren't
within the declaration context where this newly-defined tag will be
visible.
This is basically a hack, because we really need to fix the lookup of
tag declarations in this case to not find things it
shouldn't. However, it's better than what we had before, and it fixes
<rdar://problem/9168556>.
Douglas Gregor [Wed, 4 May 2011 00:14:37 +0000 (00:14 +0000)]
Introduce a new libclang API, clang_isFileMultipleIncludeGuarded(),
which determines whether a particular file is actually a header that
is intended to be guarded from multiple inclusions within the same
translation unit.
Introduce ASTUnit::LoadFromCompilerInvocationAction that allows one to create an ASTUnit
from a CompilerInvocation along with an ASTFrontendAction to invoke, and without all the goo
about the precompiled preamble.
Sean Hunt [Tue, 3 May 2011 23:05:34 +0000 (23:05 +0000)]
Ensure that destructors are properly inovked when an exception leaves
the body of a delegating constructor call.
This means that the delegating constructor implementation should be
complete and correct, though there are some rough edges (diagnostic
quality with the cycle detection and using a deleted destructor).
Sean Hunt [Tue, 3 May 2011 20:43:02 +0000 (20:43 +0000)]
Move the AST modifications to after the cycle detection in
lib/Sema/SemaDeclCXX.cpp to avoid getting stuck in an infinite loop. See
the comment for more explanation.
Douglas Gregor [Tue, 3 May 2011 20:37:33 +0000 (20:37 +0000)]
Extend -Wnon-pod-memset to also encompass memcpy() and memmove(),
checking both the source and the destination operands, renaming the
warning group to -Wnon-pod-memaccess and tweaking the diagnostic text
in the process.