Fix PR 7475 by enhancing the static analyzer to also invalidate bindings for non-static global variables
when calling a function/method whose impact on global variables we cannot accurately estimate.
This change introduces two new MemSpaceRegions that divide up the memory space of globals, and causes
RegionStore and BasicStore to consult a binding to the NonStaticGlobalsMemSpaceRegion when lazily
determining the value of a global.
Jordy Rose [Thu, 1 Jul 2010 20:09:55 +0000 (20:09 +0000)]
Add an ivar to SymbolReaper for the current statement, and then stop passing the current statement around everywhere. Preparation for symbolic extents.
Douglas Gregor [Thu, 1 Jul 2010 17:57:27 +0000 (17:57 +0000)]
Move declaration of a class's implicit copy constructor into a
separate function. Aside from making the loops infinitely faster, no
functionality change.
Douglas Gregor [Thu, 1 Jul 2010 05:10:53 +0000 (05:10 +0000)]
Reinstate fix for PR7526, which was failing because, now that we
aren't dropping all exception specifications on destructors, the
exception specifications on implicitly-declared destructors were
detected as being wrong (which they were).
Introduce logic to provide a proper exception-specification for
implicitly-declared destructors. This also fixes PR6972.
Note that the other implicitly-declared special member functions also
need to get exception-specifications. I'll deal with that in a
subsequent commit.
Daniel Dunbar [Thu, 1 Jul 2010 00:16:31 +0000 (00:16 +0000)]
Revert "IRgen: Make sure any prolog instructions get debug info.", the lexical
scope hasn't been set up yet so this isn't valid. It was just a cleanup to the
IR, so I'm going to ignore it for now.
Douglas Gregor [Thu, 1 Jul 2010 00:00:45 +0000 (00:00 +0000)]
Implement C++ DR481, which clarifies that the scope of template
parameters starts at the end of the template-parameter rather than at
the point where the template parameter name is encounted. For example,
given:
Daniel Dunbar [Wed, 30 Jun 2010 23:56:13 +0000 (23:56 +0000)]
Driver/Darwin: Add one -L for the DarwinClang toolchain to point into the gcc
library directory, as we still rely on a few libraries that are hiding there (in
particular libstdc++.dylib).
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.