Douglas Gregor [Wed, 29 Sep 2010 04:25:11 +0000 (04:25 +0000)]
Move the management of the set of conversion functions in a C++ class
into CXXRecordDecl. The only part that we do not handle this way are
using declarations, since that would require extra name lookup that we
don't currently want to pay for. This fixes <rdar://problem/8459981>,
so that LLDB can build a CXXRecordDecl and magically get all of the
right bits set.
Douglas Gregor [Wed, 29 Sep 2010 00:15:42 +0000 (00:15 +0000)]
Move the maintenance of CXXRecordDecl::DefinitionData's Abstract bit
completely into CXXRecordDecl, by adding a new completeDefinition()
function. This required a little reshuffling of the final-overrider
checking code, since the "abstract" calculation in the presence of
abstract base classes needs to occur in
CXXRecordDecl::completeDefinition() but we don't want to compute final
overriders more than one in the common case.
Douglas Gregor [Tue, 28 Sep 2010 20:38:10 +0000 (20:38 +0000)]
Centralize the management of CXXRecordDecl::DefinitionData's Empty bit
in CXXRecordDecl itself. Yes, this is also part of <rdar://problem/8459981>.
This reinstates r114924, with one crucial bug fix: we were ignoring
the implicit fields created by anonymous structs/unions when updating
the bits in CXXRecordDecl, which means that a class/struct containing
only an anonymous class/struct would be considered "empty". Hilarity
follows.
Sebastian Redl [Tue, 28 Sep 2010 20:23:00 +0000 (20:23 +0000)]
Move ExternalSemaSource::ReadMethodPool's implementation to Sema.cpp so that the header can get away with forward declarations only for ObjCMethodList and Selector. Fixes <rdar://8467631>.
Douglas Gregor [Tue, 28 Sep 2010 19:45:33 +0000 (19:45 +0000)]
Reinstate r114921, which I've exonerated via a self-host build.
Centralize the management of CXXRecordDecl::DefinitionData's Aggregate
and PlainOldData bits in CXXRecordDecl itself. Another milepost on the
road toward <rdar://problem/8459981>.
Douglas Gregor [Tue, 28 Sep 2010 17:48:56 +0000 (17:48 +0000)]
When we have two identifiers in a row in Objective-C, make sure to
verify that we aren't in a message-send expression before digging into
the identifier or looking ahead more tokens. Fixes a regression
(<rdar://problem/8483253>) I introduced with bracket insertion.
svn merge -c -114929 https://llvm.org/svn/llvm-project/cfe/trunk
--- Reverse-merging r114929 into '.':
U include/clang/Sema/Sema.h
U include/clang/AST/DeclCXX.h
U lib/Sema/SemaDeclCXX.cpp
U lib/Sema/SemaTemplateInstantiateDecl.cpp
U lib/Sema/SemaDecl.cpp
U lib/Sema/SemaTemplateInstantiate.cpp
U lib/AST/DeclCXX.cpp
svn merge -c -114925 https://llvm.org/svn/llvm-project/cfe/trunk
--- Reverse-merging r114925 into '.':
G include/clang/AST/DeclCXX.h
G lib/Sema/SemaDeclCXX.cpp
G lib/AST/DeclCXX.cpp
svn merge -c -114924 https://llvm.org/svn/llvm-project/cfe/trunk
--- Reverse-merging r114924 into '.':
G include/clang/AST/DeclCXX.h
G lib/Sema/SemaDeclCXX.cpp
G lib/Sema/SemaDecl.cpp
G lib/AST/DeclCXX.cpp
U lib/AST/ASTContext.cpp
svn merge -c -114921 https://llvm.org/svn/llvm-project/cfe/trunk
--- Reverse-merging r114921 into '.':
G include/clang/AST/DeclCXX.h
G lib/Sema/SemaDeclCXX.cpp
G lib/Sema/SemaDecl.cpp
G lib/AST/DeclCXX.cpp
Douglas Gregor [Tue, 28 Sep 2010 00:00:00 +0000 (00:00 +0000)]
Centralize the management of CXXRecordDecl::DefinitionData's
HasTrivialConstructor, HasTrivialCopyConstructor,
HasTrivialCopyAssignment, and HasTrivialDestructor bits in
CXXRecordDecl's methods. This completes all but the Abstract bit and
the set of conversion functions, both of which will require a bit of
extra work. The majority of <rdar://problem/8459981> is now
implemented (but not all of it).
Douglas Gregor [Mon, 27 Sep 2010 23:39:06 +0000 (23:39 +0000)]
Centralize the management of CXXRecordDecl::DefinitionData's
Polymorphic bit in CXXRecordDecl itself. Yes, this is also part of
<rdar://problem/8459981>.
Douglas Gregor [Mon, 27 Sep 2010 23:16:44 +0000 (23:16 +0000)]
Centralize the management of CXXRecordDecl::DefinitionData's Aggregate
and PlainOldData bits in CXXRecordDecl itself. Another milepost on the
road toward <rdar://problem/8459981>.
Douglas Gregor [Mon, 27 Sep 2010 22:48:58 +0000 (22:48 +0000)]
Centralize the handling of CXXRecordDecl::DefinitionData's
DeclaredDestructor and UserDeclaredDestructor bits in CXXRecordDecl
itself. Another step on the road to <rdar://problem/8459981>.
Douglas Gregor [Mon, 27 Sep 2010 22:37:28 +0000 (22:37 +0000)]
Kill FunctionDecl's IsCopyAssignment bit; it duplicated what could
already be determined by isCopyAssignmentOperator(), and was set too
late in the process for all clients to see the appropriate
value. Cleanup only; no functionality change.
Douglas Gregor [Mon, 27 Sep 2010 22:06:20 +0000 (22:06 +0000)]
Centralize the handling of
CXXRecordDecl::DefinitionData::DeclaredCopyAssignment, for
copy-assignment operators. Another step toward <rdar://problem/8459981>.
Bill Wendling [Mon, 27 Sep 2010 21:22:25 +0000 (21:22 +0000)]
Revert my patch changing the MMX "shift" intrinsics that take immediates into
"shift with non-immediate" intrinsics. It gets here because we they aren't
immediates anymore.
Douglas Gregor [Mon, 27 Sep 2010 21:17:54 +0000 (21:17 +0000)]
Clean up the handling of the DeclaredDefaultConstructor and
DeclaredCopyConstructor bits in CXXRecordDecl's DefinitionData
structure. Rather than having Sema call addedConstructor or set the
bits directly at semi-random places, move all of the logic for
managing these bits into CXXRecordDecl itself and tie the
addedConstructor call into DeclContext::addDecl().
This makes it easier for AST-building clients to get the right bits
set in DefinitionData, and is one small part of <rdar://problem/8459981>.
Issue warning for trivial cases of nonnull attributes
(on functions with no pointer arguments) but only when
the attribute has not been coming from a macro
instantiation in a header file. Fixes first part
of radar 6857843.
Marcin Swiderski [Sat, 25 Sep 2010 11:05:21 +0000 (11:05 +0000)]
In preparation for adding generation of destructors for objects with automatic storage added:
- LocalScope class with iterator used to pointing into it,
- fat doxygen comment for LocalScope indended usage,
- BlockScopePosPair class used for storing jump targets/sources (for: goto, break, continue), that replaces raw CFGBlock pointer used earlier for this purpose.
Fix a NYI in IRGen which was due to incorrect AST
for property reference expression (of c++ object type)
in the conditional expression. Fixes // rdar://8291337
Douglas Gregor [Fri, 24 Sep 2010 23:29:12 +0000 (23:29 +0000)]
When setting the globally-visible declarations for a particular
identifier, we may have a Sema object but no translation unit scope
(because parsing is finished). In this case, we still need to update
the IdResolver, which might still be used when writing a PCH
containing another PCH (without chaining). This bug manifested as a
failure with precompiled preambles.
Also, add a little environment-variable-sensitive logging for
libclang.
Douglas Gregor [Fri, 24 Sep 2010 21:18:36 +0000 (21:18 +0000)]
Teach libclang to enable multithreading in LLVM, since libclang clients are likely to be multithreaded. Also move the printing of timers to somewhere better for multithreaded libclang clients
Default synthesized ivars don't really have a location in the source. Using the location of the @implementation
is just confusing for clients that want to use SourceLocations for syntactic references.
Douglas Gregor [Thu, 23 Sep 2010 23:01:17 +0000 (23:01 +0000)]
Synchronize globally-cached code completion results with the results
provided when the optimization is disabled. In particular, split
the completion context CCC_Other into two contexts: CCC_Other, which
means that it's an undisclosed context for which any other results are
unwelcome, and CCC_Recovery, which is used in recovery cases.
Since we're now using the completion context within the completion
results builder, make sure that it's always set to something.
For properties declared in a @protocol and redeclared in a class extension, use the class extension
as the lexical DeclContext for the @property declaration that gets auto-created for the @interface.
Fix bogus compiler errors when declaring anonymous union, outside a class, with
members with the same name as a decl outside the scope where the members are actually introduced.
Fixes http://llvm.org/PR6741
If -fcolor-diagnostics is explicitly passed to the driver respect that even if the driver is of the opinion that
stderr can't handle them. (see http://llvm.org/PR8150)
Patch by Frits van Bommel!
Refactor GRExprEngine::VisitCall() to use EvalArguments(), just like VisitCXXMemberCallExpr(). Ideally we should unify these code paths as much as possible, since they only differ by a few details.
Daniel Dunbar [Thu, 23 Sep 2010 01:54:28 +0000 (01:54 +0000)]
IRgen/ABI/ARM: Trust the backend to pass vectors correctly for the given ABI.
- Therefore, we can lower out the NEON wrapper structs and pass the vectors
directly. This makes a huge difference in the cleanliness of the IR after
optimization.
- I will trust, but verify, via future ABITest testing (for APCS-GNU, at
least).
-Wpadded warns when undesired padding is introduced in a struct. (rdar://7469556)
-Wpacked warns if a struct is given the packed attribute, but the packed attribute has no effect
on the layout or the size of the struct. Such structs may be mis-aligned for little benefit.
The warnings are emitted at the point where layout is calculated, that is at RecordLayoutBuilder.
To avoid calculating the layouts of all structs regardless of whether they are needed or not,
I let the layouts be lazily constructed when needed. This has the disadvantage that the above warnings
will be emitted only when they are used for IR gen, and not e.g with -fsyntax-only:
$ cat t.c
struct S {
char c;
int i;
};
void f(struct S* s) {}
$ clang -fsyntax-only -Wpadded t.c
$ clang -c -Wpadded t.c -o t.o
t.c:3:7: warning: padding struct 'struct S' with 3 bytes to align 'i' [-Wpadded]
int i;
^
1 warning generated.
This is a good tradeoff between providing the warnings and not calculating layouts for all
structs in case the user has enabled a couple of rarely used warnings.
Correctly register the class extension as the lexical DeclContext for ObjC methods declared with @property in class extensions.
This matches the behavior for setters.
Also pass the class extension to ProcessPropertyDecl as the lexical DeclContext, even when not redeclaring the @property.
This fixes the remaining issues in <rdar://problem/7410145>.
For ObjCPropertyDecls in class extensions, use the class extension as the lexical DeclContext for newly created
ObjCMethodDecls. Further, use the location of the new property declaration as the location of new ObjCMethodDecls
(if they didn't previously exist).
This fixes more of the issues reported in <rdar://problem/7410145>.