Douglas Gregor [Sun, 1 Jan 2012 20:30:41 +0000 (20:30 +0000)]
Wire up redeclaration chains for Objective-C protocols, so that both
forward declarations and definitions of an Objective-C protocol are
represented within a single chain of ObjCProtocolDecls.
Douglas Gregor [Sun, 1 Jan 2012 19:51:50 +0000 (19:51 +0000)]
Introduce the core infrastructure needed to model redeclaration chains
for Objective-C protocols, including:
- Using the first declaration as the canonical declaration
- Using the definition as the primary DeclContext
- Making sure that all declarations have a pointer to the definition
data, and that we know which declaration is the definition
- Serialization support for redeclaration chains and for adding
definitions to already-serialized declarations.
However, note that we're not taking advantage of much of this code
yet, because we're still re-using ObjCProtocolDecls.
Douglas Gregor [Sun, 1 Jan 2012 19:29:29 +0000 (19:29 +0000)]
Move the data that corresponds to the definition of a protocol into a
separately-allocated DefinitionData structure. Introduce various
functions that will help with the separation of declarations from
definitions (isThisDeclarationADefinition(), hasDefinition(),
getDefinition()).
Douglas Gregor [Sun, 1 Jan 2012 18:09:12 +0000 (18:09 +0000)]
Use declaresSameEntity() when comparing ObjCProtocolDecls, and
getCanonicalDecl() when putting ObjCProtocolDecls into a set. This is
groundwork for making ObjCProtocolDecl redeclarable.
Douglas Gregor [Sat, 31 Dec 2011 04:05:44 +0000 (04:05 +0000)]
Implement support for module requirements, which indicate the language
features needed for a particular module to be available. This allows
mixed-language modules, where certain headers only work under some
language variants (e.g., in C++, std.tuple might only be available in
C++11 mode).
Richard Smith [Fri, 30 Dec 2011 21:15:51 +0000 (21:15 +0000)]
Unrevert r147271, reverted in r147361.
Also temporarily remove the assumption from IR gen that we can emit IR for every
constant we can fold, since it isn't currently true in C++11, to fix PR11676.
Original comment from r147271:
constexpr: perform zero-initialization prior to / instead of performing a
constructor call when appropriate. Thanks to Eli for spotting this.
Richard Smith [Thu, 29 Dec 2011 21:57:33 +0000 (21:57 +0000)]
Change the diagnostics which said 'accepted as an extension' to instead say
'is an extension'. The former is inappropriate and confusing when building with
-Werror/-pedantic-errors.
Craig Topper [Thu, 29 Dec 2011 16:10:46 +0000 (16:10 +0000)]
Add popcnt feature flag to match gcc. This flag is implied when sse42 is enabled, but can be disabled separately. Move popcnt intrinsics to popcntintrin.h to match gcc.
Zhongxing Xu [Wed, 28 Dec 2011 04:38:46 +0000 (04:38 +0000)]
Enable the user to control whether CXXConstructExpr will be added as a
block-level expr. Currently CXXConstructExpr is always added as a block-level
expr. This caused two problems for the analyzer (and potentially for the
CFG-based codegen).
1. We have no way to know whether a ctor call is base or complete.
2. We have no way to know the destination object being contructed.
Douglas Gregor [Tue, 27 Dec 2011 22:43:10 +0000 (22:43 +0000)]
Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl
covers both declarations (@class) and definitions (@interface) of an
Objective-C class.
Rafael Espindola [Tue, 27 Dec 2011 21:15:28 +0000 (21:15 +0000)]
Fix the visibility of methods of explicit template instantiation definition
when using -fvisibility-inlines-hidden. This matches gcc's behavior and
documentation.
Richard Smith [Sun, 25 Dec 2011 21:17:58 +0000 (21:17 +0000)]
Fix constexpr handling to allow 'extern constexpr' variable declarations. We no
longer have access to the source locations we need to produce the
'replace constexpr with const' fixits, so they're gone for now.
Richard Smith [Sat, 24 Dec 2011 21:56:24 +0000 (21:56 +0000)]
Always implicitly declare move assignment operations for dynamic classes, in
case they override virtual functions from a base class. Also fix -print-stats
counting of move assignment/construction.
Nico Weber [Fri, 23 Dec 2011 20:58:04 +0000 (20:58 +0000)]
Fix several issues related to specializations and explicit instantiations.
Explicit instantiations following specializations are no-ops and hence have
no PointOfInstantiation. That was done correctly in most cases, but for a
specialization -> instantiation decl -> instantiation definition chain, the
definition didn't realize that it was a no-op. Fix that.
Also, when printing diagnostics for these no-ops, get the diag location from
the decl name location.
Add many test cases, one of them not yet passing (but it failed the same way
before this change). Fixes http://llvm.org/pr11558 and more.
objective-c: Use class definition AST in several situations when
building related objc ASTs which require a class definition AST.
These were uncovered when testing objc rewriter.
Douglas Gregor [Fri, 23 Dec 2011 00:23:59 +0000 (00:23 +0000)]
When building a module with an umbrella header, warn about any headers
found within that umbrella directory that were not actually included
by the umbrella header. They should either be referenced in the module
map or included by the umbrella header.
Douglas Gregor [Thu, 22 Dec 2011 21:40:42 +0000 (21:40 +0000)]
Serialize the AST reader's mapping from canonical declarations to the
set of (previously-canonical) declaration IDs to the module file, so
that future AST reader instances that load the module know which
declarations are merged. This is important in the fairly tricky case
where a declaration of an entity, e.g.,
@class X;
occurs before the import of a module that also declares that
entity. We merge the declarations, and record the fact that the
declaration of X loaded from the module was merged into the (now
canonical) declaration of X that we parsed.
Douglas Gregor [Thu, 22 Dec 2011 19:44:59 +0000 (19:44 +0000)]
If we end up merging an Objective-C class with an existing Objective-C
class that comes from a different module file, make sure that we load
all of the pending declarations for the original declaration.
Kevin Enderby [Thu, 22 Dec 2011 19:31:58 +0000 (19:31 +0000)]
Last part of support for generating dwarf for assembly source files. This gets
the clang driver to enable this when assembling a .s file. rdar://9275556
Douglas Gregor [Thu, 22 Dec 2011 01:48:48 +0000 (01:48 +0000)]
When deserializing an Objective-C class, check whether we have another
declaration of that same class that either came from some other module
or occurred in the translation unit loading the module. In this case,
we need to merge the two redeclaration chains immediately so that all
such declarations have the same canonical declaration in the resulting
AST (even though they don't in the module files we've imported).
Focusing on Objective-C classes until I'm happy with the design, then
I'll both (1) extend this notion to other kinds of declarations, and
(2) optimize away this extra checking when we're not dealing with
modules. For now, doing this checking for PCH files/preambles gives us
better testing coverage.
Ted Kremenek [Thu, 22 Dec 2011 01:30:46 +0000 (01:30 +0000)]
Enhance AnalysisDeclContext::getReferencedBlockVars() to understand PseudoObjExprs. It turns out
that the information collected by this method is a super set of the captured variables in BlockDecl.
In Lexer::getCharAndSizeSlow[NoWarn] make sure we don't go over the end of the buffer
when the end of the buffer is immediately after an escaped newline.