Douglas Gregor [Wed, 30 Jun 2010 22:01:08 +0000 (22:01 +0000)]
New language-compatibility page, including language-compatibility information for the various language dialects Clang supports in a single, easy-to-find page
Daniel Dunbar [Wed, 30 Jun 2010 21:40:01 +0000 (21:40 +0000)]
libclang: When invoking external clang process to get code completion results,
pass -ccc-clang-cxx to force C++ support (even if the binary was built without
it).
Daniel Dunbar [Wed, 30 Jun 2010 21:27:58 +0000 (21:27 +0000)]
IRgen: Fix debug info regression in r106970; when we eliminate the return value
store make sure to move the debug metadata from the store (which is actual
'return' statement location) to the return instruction (which otherwise would
have the function end location as its debug info).
- Tested by gdb test suite.
Chris Lattner [Wed, 30 Jun 2010 19:14:05 +0000 (19:14 +0000)]
Reapply:
r107173, "fix PR7519: after thrashing around and remembering how all this stuff"
r107216, "fix PR7523, which was caused by the ABI code calling ConvertType instead"
This includes a fix to make ConvertTypeForMem handle the "recursive" case, and call
it as such when lowering function types which have an indirect result.
Zhanyong Wan [Wed, 30 Jun 2010 18:34:52 +0000 (18:34 +0000)]
Fix RecursiveASTVisitor to traverse the ctor initializer list before
traversing the ctor body when traversing a CXXConstructorDecl.
Reviewed by chandlerc and csilvers.
Douglas Gregor [Wed, 30 Jun 2010 17:24:13 +0000 (17:24 +0000)]
Complain about the application of a transparent_union attribute to a
union whose first field has integral vector type. Also, clean up this
diagnostic a bit. Thanks to Eli for spotting this change in semantics
last week.
Charles Davis [Wed, 30 Jun 2010 08:09:57 +0000 (08:09 +0000)]
Mangle arrays in the Microsoft C++ Mangler. It's not quite finished (it
doesn't mangle array parameters right), but I think that should be fixed
in Sema (Doug, John, what do you think?).
Also, stub out the remaining mangleType() routines.
Ted Kremenek [Wed, 30 Jun 2010 07:28:52 +0000 (07:28 +0000)]
Correctly implement the CheckerVisit optimization introduced in r106884, but this time actually used the cached checker list when calling back to Checker visit methods. This reduces the analysis time for sqlite3.c by 8%.
Daniel Dunbar [Wed, 30 Jun 2010 06:30:56 +0000 (06:30 +0000)]
Headers: Define __INT64_TYPE__ in terms of getInt64Type(), which isn't always
'long'. The practical upshot is so that the uint64_t we define in our stdint.h
ends up being compatible with that defined by gcc (at least on Darwin), which
otherwise could lead to type incompatibilities with other system headers.
Chandler Carruth [Wed, 30 Jun 2010 02:59:29 +0000 (02:59 +0000)]
Reapply r107235, this time with both my typo fixed, and a logical bug fixed.
Previously we relied on the presence of a member which needs no initialization
to prevent us from creating an additional initialization of the outer anonymous
union field. We have already correctly marked that field as initialized by the
member of the union (repeatedly due to the original bug this patch fixes) so we
simply need to bail out.
Chandler Carruth [Wed, 30 Jun 2010 02:06:16 +0000 (02:06 +0000)]
Revert r107235, it had a silly typo in it, and fixing the typo breaks something
else. Get the build bots happy while I debug. Very sorry for the delay fixing
this...
Chandler Carruth [Wed, 30 Jun 2010 00:54:29 +0000 (00:54 +0000)]
Fix PR7402: We were creating implicit member initializers for every field in an
anonymous union under the presumption that they didn't do anything. While this
is true, our checks for redundant initialization of an anonymous union still
fire when these overlap with explicit user initialization. A cleaner approach
is to avoid initializing multiple members of a union altogether, but this still
is in a rather fuzzy are especially when C++0x allows non-POD types into
unions.
Douglas Gregor [Wed, 30 Jun 2010 00:20:43 +0000 (00:20 +0000)]
Implement C++ DR299, which allows an implicit conversion from a class
type to an integral or enumeration type in the size of an array new
expression, e.g.,
Chandler Carruth [Tue, 29 Jun 2010 23:50:44 +0000 (23:50 +0000)]
Retain the source location of the constructor when building an implicit member
initialization. I tried several ideas but couldn't come up with a test case for
this that didn't rely on a Clang bug to report a diagnostic after template
instantiation of the constructor due to the implicit initializers. Suggestions
welcome. This fixes the source location aspect of PR7402.
Douglas Gregor [Tue, 29 Jun 2010 23:25:20 +0000 (23:25 +0000)]
Re-improve recovery when the condition of a switch statement does not
have integral or enumeration type, so that we still check the contents
of the switch body. My previous patch made this worse; now we're back
to where we were previously.
Douglas Gregor [Tue, 29 Jun 2010 23:17:37 +0000 (23:17 +0000)]
Factor the conversion from a switch condition to an integral or
enumeration type out into a separate, reusable routine. The only
functionality change here is that we recover a little more
aggressively from ill-formed switch conditions.
This commit 'introduces' a slightly different way to restore the state of the AST object.
It makes PCHDeclReader/PCHDeclWriter friends and gives them access to the private members of the object.
The rationale is to avoid using/modifying the AST interfaces for PCH read/write so that to:
-Avoid complications with objects that have side-effects during creation or when using some setters.
-Not 'pollute' the AST interface with methods only used by the PCH reader/writer
-Allow AST objects to be read-only.
Daniel Dunbar [Tue, 29 Jun 2010 22:44:21 +0000 (22:44 +0000)]
IRgen: Assignment to Objective-C properties shouldn't reload the value, for
complex values either. Previously we did this properly for regular assignment,
but not for compound assignment.
- Also, tidy up assignment code a bit to look more like the scalar path.
Chris Lattner [Tue, 29 Jun 2010 22:39:04 +0000 (22:39 +0000)]
fix PR7523, which was caused by the ABI code calling ConvertType instead
of ConvertTypeRecursive when it needed to in a few cases, causing pointer
types to get resolved at the wrong time.
Daniel Dunbar [Tue, 29 Jun 2010 22:00:45 +0000 (22:00 +0000)]
IRgen: Assignment to Objective-C properties shouldn't reload the value (which
would trigger an extra method call).
- While in the area, I also changed Clang to not emit an unnecessary load from
'x' in cases like 'y = (x = 1)'.
Ted Kremenek [Tue, 29 Jun 2010 21:58:54 +0000 (21:58 +0000)]
Tweaker Checker::VisitEndAnalysis to have 'hasWorkRemaining' also
be true if some paths were aborted because they exceeded
the maximum loop unrolling count.
Ted Kremenek [Tue, 29 Jun 2010 20:25:42 +0000 (20:25 +0000)]
Add test case for <rdar://problem/4289832>. Clang actuallys gets
the test case right (for the noreturn warning) because the CFG
doesn't support @try yet, but the test case is now present when
we do properly implement CFG support for @try...@catch.
Douglas Gregor [Tue, 29 Jun 2010 19:27:42 +0000 (19:27 +0000)]
When typo correction produces a result that is not of the kind we're
looking for, reset the name within the LookupResult structure in
addition to clearing out the results. Fixes PR7508.
Chris Lattner [Tue, 29 Jun 2010 19:21:36 +0000 (19:21 +0000)]
change ABIArgInfo to hold its llvm type with PATypeHolder so that
it doesn't dangle as types get refined. This fixes Shootout-C++/lists1
and probably also PR7522.
This patch fixes a bug whereby, clang skipped
unimplemented property warning for properties
coming from class's conformin protocol. It also
simplifies the algorithm in the process.
Fixes radar 8035776.
Chris Lattner [Tue, 29 Jun 2010 17:56:33 +0000 (17:56 +0000)]
fix PR7519: after thrashing around and remembering how all this stuff
works, the fix is quite simple: just make sure to call ConvertTypeRecursive
when the function type being lowered is in the midst of ConvertType.
Daniel Dunbar [Tue, 29 Jun 2010 16:38:33 +0000 (16:38 +0000)]
Driver/Darwin: Only run dsymutil when we are also compiling/assembling as part
of the compilation.
- <rdar://problem/8141387> clang is always invoking dsymutil
Jeffrey Yasskin [Tue, 29 Jun 2010 15:27:35 +0000 (15:27 +0000)]
Delete assert in ComputeKeyFunction. The function runs fine without it, since
there's an explicit guard on isPolymorphic, and virtual bases don't affect the
key function calculation. This allows people to call
ASTContext::getKeyFunction on arbitrary classes.
Chris Lattner [Tue, 29 Jun 2010 06:01:59 +0000 (06:01 +0000)]
Change X86_64ABIInfo to have ASTContext and TargetData ivars to
avoid passing ASTContext down through all the methods it has.
When classifying an argument, or argument piece, as INTEGER, check
to see if we have a pointer at exactly the same offset in the
preferred type. If so, use that pointer type instead of i64. This
allows us to compile A function taking a stringref into something
like this:
Chris Lattner [Tue, 29 Jun 2010 01:08:48 +0000 (01:08 +0000)]
Pass the LLVM IR version of argument types down into computeInfo.
This is somewhat annoying to do this at this level, but it avoids
having ABIInfo know depend on CodeGenTypes for a hint.
Nothing is using this yet, so no functionality change.
Chris Lattner [Tue, 29 Jun 2010 00:06:42 +0000 (00:06 +0000)]
make the argument passing stuff in the FCA case smarter still, by
avoiding making the FCA at all when the types exactly line up. For
example, before we made:
Ted Kremenek [Mon, 28 Jun 2010 23:54:17 +0000 (23:54 +0000)]
Per Doug's suggestion, move check for invalid SourceLocation into
cxloc::translateSourceLocation() (thus causing all clients of this
function to have the same behavior).
Chris Lattner [Mon, 28 Jun 2010 23:44:11 +0000 (23:44 +0000)]
Change CGCall to handle the "coerce" case where the coerce-to type
is a FCA to pass each of the elements as individual scalars. This
produces code fast isel is less likely to reject and is easier on
the optimizers.
For example, before we would compile:
struct DeclGroup { long NumDecls; char * Y; };
char * foo(DeclGroup D) {
return D.NumDecls+D.Y;
}
Fix up ClassTemplateSpecializationDecl: For implicit instantiations
("set<int> x;"), we don't want to recurse at all, since the
instatiated class isn't written in the source code anywhere. (Note
the instatiated *type* -- set<int> -- is written, and will still get a
callback of TemplateSpecializationType). For explicit instantiations
("template set<int>;"), we do need a callback, since this is the only
callback that's made for this instantiation. We use
getTypeAsWritten() to distinguish.
We will still need to figure out how to handle template
specializations, which probably are still not quite correct.
Modify the way sub-statements are stored and retrieved from PCH.
Before this commit, sub-stmts were stored as encountered and when they were placed in the Stmts stack we had to know what index
each stmt operand has. This complicated supporting variable sub-stmts and sub-stmts that were contained in TypeSourceInfos, e.g.
x = sizeof(int[1]);
would crash PCH.
Now, sub-stmts are stored in reverse order, from last to first, so that when reading them, in order to get the next sub-stmt we just
need to pop the last stmt from the stack. This greatly simplified the way stmts are written and read (just use PCHWriter::AddStmt and
PCHReader::ReadStmt accordingly) and allowed variable stmt operands and TypeSourceInfo exprs.
Chris Lattner [Mon, 28 Jun 2010 19:56:59 +0000 (19:56 +0000)]
X86-64:
pass/return structs of float/int as float/i32 instead of double/i64
to make the code generated for ABI cleaner. Passing in the low part
of a double is the same as passing in a float.
Add support for traversing initializer lists (in constructors), which
we ignoring before. To give access to the names on the initializer,
which aren't a type or an expr or a decl, I've introduced a new
TraverseInitializer. By default, it just traverses on the expr that
the name is being initialized to.
Reviewed by chandlerc. Tested via clang's 'make test'.
Sebastian Redl [Mon, 28 Jun 2010 15:09:07 +0000 (15:09 +0000)]
Introduce Expr::Classify and Expr::ClassifyModifiable, which determine the classification of an expression under the C++0x taxology (value category). Reimplement isLvalue and isModifiableLvalue using these functions. No regressions in the test suite from this, and my rough performance check doesn't show any regressions either.
Chandler Carruth [Mon, 28 Jun 2010 08:39:25 +0000 (08:39 +0000)]
Partial fix for PR7267 based on comments by John McCall on an earlier patch.
This is more targeted, as it simply provides toggle actions for the parser to
turn access checking on and off. We then use these to suppress access checking
only while we parse the template-id (included scope specifier) of an explicit
instantiation and explicit specialization of a class template. The
specialization behavior is an extension, as it seems likely a defect that the
standard did not exempt them as it does explicit instantiations.
This allows the very common practice of specializing trait classes to work for
private, internal types. This doesn't address instantiating or specializing
function templates, although those apparently already partially work.
The naming and style for the Action layer isn't my favorite, comments and
suggestions would be appreciated there.
Chandler Carruth [Mon, 28 Jun 2010 00:30:51 +0000 (00:30 +0000)]
Suppress diagnosing access violations while looking up deallocation functions
much as we already do for allocation function lookup. Explicitly check access
for the function we actually select in one case that was previously missing,
but being caught behind the blanket diagnostics for all overload candidates.
This fixs PR7436.