Douglas Gregor [Sat, 24 Jul 2010 00:42:07 +0000 (00:42 +0000)]
Put a newline at the end of the padded buffers used for the
precompiled preamble. This will suppress the -pedantic "no newline at
end of file" warning.
Douglas Gregor [Sat, 24 Jul 2010 00:38:13 +0000 (00:38 +0000)]
Once we've built (or reused) a precompiled preamble, create the
appropriately-padded main file buffer (that has spaces in the extra
"reserved" space) and thread that buffer through to the parsing
function. This still does nothing.
Return type of a setter call caused by
use of property-dot syntax using 'super' as receiver
is 'void'. This fixes a bug in generating correct
API for setter call. Fixes radar 8203426.
Douglas Gregor [Sat, 24 Jul 2010 00:10:38 +0000 (00:10 +0000)]
Be careful; even though we had a proper name at the beginning of
Sema::ActOnDeclarator doesn't mean that the Decl we ended up creating
has a useful name. <rdar://problem/8229910>
Douglas Gregor [Fri, 23 Jul 2010 23:58:40 +0000 (23:58 +0000)]
Once we've built a precompiled preamble, keep track of the details of
that preamble (the preamble text, preamble file, reserved main file
size). Check these details when we try to rebuild the precompiled
preamble, and when nothing has changed, re-use the precompiled
preamble.
This code is still very much a WIP, and can't even properly be tested
because we have no way to use the precompiled preamble yet. "Trust me"
Tom Care [Fri, 23 Jul 2010 23:04:53 +0000 (23:04 +0000)]
Added an path-sensitive unreachable code checker to the experimental analyzer checks.
- Created a new class to do post-analysis
- Updated several test cases with unreachable code to expect a warning
- Added some general tests
John McCall [Fri, 23 Jul 2010 21:56:41 +0000 (21:56 +0000)]
Revise cleanup IR generation to fix a major bug with cleanups (PR7686)
as well as some significant asymptotic inefficiencies with threading
multiple jumps through deep cleanups.
There is no need to use separate dir name for AT_comp_dir attribute. Using absolute path for filename allows clients to query complete file location info from gdb breakpoints. Save constructed full file name.
Eli Friedman [Fri, 23 Jul 2010 19:25:41 +0000 (19:25 +0000)]
Fix for PR7694: make sure to pass in a RecordType to CheckBaseClassAccess;
fixes crashes on both valid and invalid code. The diagnostic here could
potentially be improved, but it's good enough as-is.
Douglas Gregor [Fri, 23 Jul 2010 15:58:24 +0000 (15:58 +0000)]
Vectors are not integer types, so the type system should not classify
them as such. Type::is(Signed|Unsigned|)IntegerType() now return false
for vector types, and new functions
has(Signed|Unsigned|)IntegerRepresentation() cover integer types and
vector-of-integer types. This fixes a bunch of latent bugs.
Warn when property ivar lookup finds a global variable
of same name. In nonfragile-abi2, lookup accesses a synthesized
ivar. This is a transition warning. Radar 8225011.
John McCall [Thu, 22 Jul 2010 22:44:38 +0000 (22:44 +0000)]
Ted pointed out that this test case could be using access control instead of
__attribute__((unavailable)). I've done so, but unfortunately there's still a case
of redundant diagnostics.
Douglas Gregor [Thu, 22 Jul 2010 20:22:31 +0000 (20:22 +0000)]
Improve performance during cursor traversal when a region of interest
is present.
Rather than using clang_getCursorExtent(), which requires
us to lex the token at the ending position to determine its
length. Then, we'd be comparing [a, b) source ranges that cover the
characters in the range rather than the normal behavior for Clang's
source ranges, which covers the tokens in the range. However, relexing
causes us to read the source file (which may come from a precompiled
header), which is rather unfortunate and affects performance.
In the new scheme, we only use Clang-style source ranges that cover
the tokens in the range. At the entry points where this matters
(clang_annotateTokens, clang_getCursor), we make sure to move source
locations to the start of the token.
Make a bunch of new data structures for the new analysis
engine of the new translation unit. State marshal is there but no real
work is done. End nodes are passed back.
Fix '<rdar://problem/8214263> MakeCXCursor null dereference when body of block is invalid' by checking that the body of a BlockDecl is null before constructing a CXCursor.
Daniel Dunbar [Thu, 22 Jul 2010 00:40:31 +0000 (00:40 +0000)]
Driver/Darwin: Always allow blocks on Darwin, so that users can conditionally
use blocks even when targetting older systems (using runtime checks and weak
linking).
Upgrade "'X' is unavailable" from a warning to an error. This matches GCC's behavior. Note that
GCC emits a warning instead of an error when using an unavailable Objective-C protocol, so now
Clang's behavior is more strict in this case, but more consistent. We will need to see how much
this fires on real code and determine whether this case should be downgraded to a warning.
Sebastian Redl [Wed, 21 Jul 2010 20:07:32 +0000 (20:07 +0000)]
Promote some macro-related stuff to per-file data. Fix a cache-inefficient nested loop by inverting the nesting. Store the size of each file in the chain; will need this later for statement offsets.
Douglas Gregor [Wed, 21 Jul 2010 18:52:53 +0000 (18:52 +0000)]
Introduce a new C API function, clang_parseTranslationUnit(), which
will eventually replace
clang_createTranslationUnitFromSourceFile(). The only addition in
clang_parseTranslationUnit() is a set of flags that can control how
the translation unit is loaded. More interesting flags will be coming.
Fix a rewriter bug which originates in SemaInit involving
Constructor Initialization which computes Source Location
differently now. Fixes radar 8213998.
John McCall [Wed, 21 Jul 2010 06:13:08 +0000 (06:13 +0000)]
Switch some random local-decl cleanups over to using lazy cleanups. Turn on
the block-release unwind cleanup: we're never going to test it if we don't turn
it on.
John McCall [Wed, 21 Jul 2010 05:47:49 +0000 (05:47 +0000)]
Switch finally cleanups over to being lazy cleanups. We get basically nothing
from the laziness features here except better block ordering, but it removes yet
another CleanupBlock use.
Douglas Gregor [Wed, 21 Jul 2010 01:10:17 +0000 (01:10 +0000)]
Implement zero-initialization for array new when there is an
initializer of (). Make sure to use a simple memset() when we can, or
fall back to generating a loop when a simple memset will not
suffice. Fixes <rdar://problem/8212208>, a regression due to my work
in r107857.
John McCall [Wed, 21 Jul 2010 00:41:47 +0000 (00:41 +0000)]
Convert the ObjC @synchronized cleanups to laziness. This is not actually
a big deal, except that I want to eliminate the shared-code EH cleanups
in preparation for a significant algorithmic fix.
Chris Lattner [Tue, 20 Jul 2010 21:07:09 +0000 (21:07 +0000)]
Follow the implementation approach suggested by PR6687,
which generates more efficient and more obviously conformant
code. We now test for overflow of the multiply then force
the result to -1 if so. On X86, this generates nice code
like this:
Chris Lattner [Tue, 20 Jul 2010 20:19:24 +0000 (20:19 +0000)]
implement rdar://5739832 - operator new should check for overflow in multiply,
causing clang to compile this code into something that correctly throws a
length error, fixing a potential integer overflow security attack:
void *test(long N) {
return new int[N];
}
int main() {
test(1L << 62);
}
We do this even when exceptions are disabled, because it is better for the
code to abort than for the attack to succeed.
This is heavily based on a patch that Fariborz wrote.