Chandler Carruth [Mon, 28 Feb 2011 07:25:18 +0000 (07:25 +0000)]
Fix a tiny goof in the Driver's logic which caused the explicit presence
of -fexceptions to disably C++ exceptions. The correct code was in the
ObjC branch, this just mirrors that logic on the C++ side of things.
Thanks to John Wiegley for pointing this out.
The previous name was inaccurate as this token in fact appears at
the end of every preprocessing directive, not just macro definitions.
No functionality change, except for a diagnostic tweak.
Anders Carlsson [Mon, 28 Feb 2011 02:27:16 +0000 (02:27 +0000)]
Add a -fcxx-exceptions flag to the frontend, which can be used to enable
C++ exceptions, even when exceptions have been turned off using -fno-exceptions.
Make the -fobjc-exceptions flag do the same thing, but for Objective-C exceptions.
C++ and Objective-C exceptions can also be disabled using -fno-cxx-excptions and
-fno-objc-exceptions.
Ken Dyck [Mon, 28 Feb 2011 02:01:38 +0000 (02:01 +0000)]
Retry r126357. Use CharUnits for the Size and DataSize calculations when
they are known to be exact multiples of the width of the char type. Add a
test case to CodeGen/union.c that would have caught the problem with the
previous attempt. No change in functionality intended.
Chris Lattner [Mon, 28 Feb 2011 01:02:29 +0000 (01:02 +0000)]
make switch condition constant folding much more aggressive, handling
compound statements and break statements. This implements enough to
handle PR9322 and rdar://6970405.
Chris Lattner [Mon, 28 Feb 2011 00:22:07 +0000 (00:22 +0000)]
First tiny step to implementing PR9322: build infrastructure for only emitting the
live case of a switch statement when switching on a constant. This is terribly
limited, but enough to handle the trivial example included. Before we would
emit:
This improves -O0 compile time (less IR to generate and shove through the code
generator) and the clever linux kernel people found a way to fail to build if we
don't do this optimization. This step isn't enough to handle the kernel case
though.
Douglas Gregor [Mon, 28 Feb 2011 00:04:36 +0000 (00:04 +0000)]
When we encounter a dependent template name within a
nested-name-specifier, e.g.,
T::template apply<U>::
represent the dependent template name specialization as a
DependentTemplateSpecializationType, rather than a
TemplateSpecializationType with a dependent TemplateName.
Douglas Gregor [Sun, 27 Feb 2011 22:46:49 +0000 (22:46 +0000)]
Eliminate a silly little Parse/Sema dance when parsing typename
specifiers such as
typename T::template apply<U>
Previously, we would turn T::template apply<U> into a
TemplateSpecializationType. Then, we'd reprocess that
TemplateSpecializationType and turn it into either a
TemplateSpecializationType wrapped in an ElaboratedType (when we could
resolve "apply" to a template declaration) or a
DependentTemplateSpecializationType. We now produce the same ASTs but
without generating the intermediate TemplateSpecializationType.
The end goal here is to avoid generating TemplateSpecializationTypes
with dependent template-names, ever. We're not there yet.
Sean Hunt [Sat, 26 Feb 2011 19:13:13 +0000 (19:13 +0000)]
Implement delegating constructors partially.
This successfully performs constructor lookup and verifies that a
delegating initializer is the only initializer present.
This does not perform loop detection in the initialization, but it also
doesn't codegen delegating constructors at all, so this won't cause
runtime infinite loops yet.
John McCall [Sat, 26 Feb 2011 08:07:02 +0000 (08:07 +0000)]
Pretty up the emission of field l-values and use volatile and TBAA when
loading references as part of that. Use 'char' TBAA when accessing
(immediate!) fields of a may_alias struct; fixes PR9307.
John McCall [Sat, 26 Feb 2011 05:39:39 +0000 (05:39 +0000)]
Provide a bit saying that a builtin undergoes custom type-checking, then
don't let calls to such functions go down the normal type-checking path.
Test this out with __builtin_classify_type and __builtin_constant_p.
Ted Kremenek [Fri, 25 Feb 2011 22:00:40 +0000 (22:00 +0000)]
Enhance scan-build to print out available analyses using new checker registration model.
This isn't totally complete. Right now scan-build uses some heuristics to determine
which checkers are enabled by default, but it cannot always tell which checkers
are not enabled.
Douglas Gregor [Fri, 25 Feb 2011 20:49:16 +0000 (20:49 +0000)]
Push nested-name-specifier source location information into
DependentScopeDeclRefExpr. Plus, give NestedNameSpecifierLoc == and !=
operators, since we're going to need 'em elsewhere.
Chandler Carruth [Fri, 25 Feb 2011 19:41:05 +0000 (19:41 +0000)]
Remove the FIXME I introduced last night, and pull the logic for
marking selected overloads into the callers. This allows a few callers
to skip it altogether (they would have anyways because they weren't
interested in successful overloads) or defer until after further checks
take place much like the check required for PR9323 to avoid marking
unused copy constructors.
Douglas Gregor [Fri, 25 Feb 2011 18:19:59 +0000 (18:19 +0000)]
Push nested-name-specifier source-location information into
pseudo-destructor expressions. Also, clean up some
template-instantiation and type-checking issues with
pseudo-destructors.
Chandler Carruth [Fri, 25 Feb 2011 08:52:25 +0000 (08:52 +0000)]
Rough fix for PR9323 that prevents Clang from marking copy constructor
declarations as referenced when in fact we're not going to even form
a call in the AST. This is significant because we attempt to allow as an
extension classes with intentionally private and undefined copy
constructors to have temporaries bound to references, and so shouldn't
warn about the lack of definition for that copy constructor when the
class is internal.
Doug, John wasn't really satisfied with the presence of overloading at
all. This is a stop-gap and there may be a better solution. If you can
give me some hints for how you'd prefer to see this solved, I'll happily
switch things over.
John McCall [Fri, 25 Feb 2011 04:19:13 +0000 (04:19 +0000)]
Tame an assert; the scope depth of a jump destination does not
necessarily enclose the innermost normal cleanup depth, because
the top of the jump scope stack might be an EH cleanup or EH scope.
Fixes PR9303.
Douglas Gregor [Fri, 25 Feb 2011 02:25:35 +0000 (02:25 +0000)]
Use NestedNameSpecifierLoc within out-of-line variables, function, and
tag definitions. Also, add support for template instantiation of
NestedNameSpecifierLocs.
Douglas Gregor [Fri, 25 Feb 2011 00:36:19 +0000 (00:36 +0000)]
Update UsingDecl, UnresolvedUsingTypenameDecl, and
UnresolvedUsingValueDecl to use NestedNameSpecifierLoc rather than the
extremely-lossy NestedNameSpecifier/SourceRange pair it used to use,
improving source-location information.
Various infrastructure updates to support NestedNameSpecifierLoc:
- AST/PCH (de-)serialization
- Recursive AST visitor
- libclang traversal (including the first tests of this
functionality)
Chandler Carruth [Fri, 25 Feb 2011 00:05:02 +0000 (00:05 +0000)]
Fix the rest of PR9316 along with some other bugs spotted by inspection.
I tried to add test cases for these, but I can't because variables
aren't warned on the way functions are and the codegen layer appears to
use different logic for determining that 'a' and 'g' in the test case
should receive C mangling. I've included the test so that if we ever
switch the codegen layer to use these functions, we won't regress due to
latent bugs.
[analyzer] Allow a checker to be hidden even if its package is hidden & enabled.
For example, if 'core.experimental.UnreachableCode' is hidden, it should not be enabled with 'core.experimental'.
Note that this requires llvm commit r126436.