Ted Kremenek [Wed, 7 Oct 2009 00:42:52 +0000 (00:42 +0000)]
Change ExplodedNode to have its NodeGroups all BumpPtrAllocated, avoiding malloc() traffic when adding successors/predecessors to a node. This was done by introducing BumpVector, which is essentially SmallVector with all memory being BumpPtrAllocated (this can certainly be cleaned up or moved into llvm/ADT).
This change yields a 1.8% speed increase when running the analyzer (with -analyzer-store=region) on a small benchmark file.
Douglas Gregor [Wed, 7 Oct 2009 00:13:32 +0000 (00:13 +0000)]
Refactor checking of the scope of explicit template specialization
declarations and explicit template instantiations, improving
diagnostics and making the code usable for function template
specializations (as well as class template specializations and partial
specializations).
Patch to implement C++ [over.built]p11 of overload resolution.
Doug, please review. There is a FIXME in the test case with a question
which is unrelated to this patch (that is, error is issued
before set of builtins are added to the candidate list).
Douglas Gregor [Tue, 6 Oct 2009 21:27:51 +0000 (21:27 +0000)]
Test explicit specialization for all of the various cases where
explicit specializations can occur. Also, fix a minor recovery bug
where we should allow declarations coming from the parser to be NULL.
Douglas Gregor [Tue, 6 Oct 2009 17:59:45 +0000 (17:59 +0000)]
Refactor the code that walks a C++ inheritance hierarchy, searching
for bases, members, overridden virtual methods, etc. The operations
isDerivedFrom and lookupInBases are now provided by CXXRecordDecl,
rather than by Sema, so that CodeGen and other clients can use them
directly.
Ted Kremenek [Tue, 6 Oct 2009 03:44:49 +0000 (03:44 +0000)]
Fix crash introduced by r83358 where a symbol could be eagerly
evaluated to an APSInt with a different bitwidth than the other
operand in a binary expression.
Ted Kremenek [Tue, 6 Oct 2009 01:39:48 +0000 (01:39 +0000)]
Fix: <rdar://problem/7275774> Static analyzer warns about NULL pointer when
adding assert
This fix required a few changes:
SimpleSValuator:
- Eagerly replace a symbolic value with its constant value in EvalBinOpNN
when it is constrained to a constant. This allows us to better constant fold
values along a path.
- Handle trivial case of '<', '>' comparison of pointers when the two pointers
are exactly the same.
Refixed pr5086 by letting Expr::isNullPointerConstant
handle checking for a null pointer for a zero-valued
enumerator; moving the test case from CodeGen to Sema.
Mike Stump [Mon, 5 Oct 2009 23:40:59 +0000 (23:40 +0000)]
This is slightly contentious, but, if llvm has gone to addressable
units, we should as well. The problem is the non-predictability of
the dimension of the values. I'd love for the dimension to be part of
the static type system... but in C++ it is kinda annoying to do.
tweaked my last patch to 1) preserve the protocol in
extension class's protocol list so its AST is complete.
2) Because of this no need to issue warning on unimplemeted
methods coming from the extended class protocols
because warning is issued when class definition is seen.
Douglas Gregor [Mon, 5 Oct 2009 21:07:28 +0000 (21:07 +0000)]
Encode the Clang branch and Subversion revision into a PCH file, and
assume that PCH files from different Clang revisions are not
compatible. Addresses <rdar://problem/7266572>.
Douglas Gregor [Mon, 5 Oct 2009 20:33:49 +0000 (20:33 +0000)]
Provide a common set of routines in Version.h that return Subversion
branch/revision information. Use that information in the driver,
rather than one-off branch/revision computation.
Steve Naroff [Mon, 5 Oct 2009 17:58:19 +0000 (17:58 +0000)]
- Fix assert in clang_getCursorDecl (having to do with recently added ObjC_ProtocolRef).
- Make sure CHECK: lines in test case match the expected output.
Add a -nostdclanginc flag to clang-cc that prevents it from searching
its own binary-relative headers. Useful when using clang's preprocessor
with gcc.
Anders Carlsson [Fri, 2 Oct 2009 02:15:20 +0000 (02:15 +0000)]
When building constant structs, check if the resulting LLVM struct will be bigger than the record layout size and use a packed struct if that's the case. Fixes PR5108.
Douglas Gregor [Thu, 1 Oct 2009 23:51:25 +0000 (23:51 +0000)]
Make sure to free the explicit template arguments provided for an
explicit instantiation. Also, tighten up reference-count checking to
help catch these issues earlier. Fixes PR5069.
Douglas Gregor [Thu, 1 Oct 2009 23:25:31 +0000 (23:25 +0000)]
When the return type of a function is dependent, don't perform any
of the flow-control checks for falling off the end of a function,
since the return type may instantiate to void. Similarly, if a
return statement has an expression and the return type of the function
is void, don't complain if the expression is type-dependent, since
that type could instantiate to void.
Douglas Gregor [Thu, 1 Oct 2009 20:44:19 +0000 (20:44 +0000)]
CodeGen may see out-of-line declarations of the various special member
functions when they are explicitly declared, e.g., via a function
template specialization or explicit template instantiation
declaration. Don't try to synthesize bodies for the special member
functions in this case; rather, check whether we have an implicit
declaration and, if so, synthesize the appropriate function
body. Fixes PR5084.
Douglas Gregor [Wed, 30 Sep 2009 22:13:51 +0000 (22:13 +0000)]
Improve template argument deduction in the case where the parameter
type is a template-id (e.g., basic_ostream<CharT, Traits>) and the
argument type is a class that has a derived class matching the
parameter type. Previously, we were giving up on template argument
deduction too early.
Douglas Gregor [Wed, 30 Sep 2009 21:46:01 +0000 (21:46 +0000)]
When overload resolution fails for an overloaded operator, show the
overload candidates (but not the built-in ones). We still rely on the
underlying built-in semantic analysis to produce the initial
diagnostic, then print the candidates following that diagnostic.
One side advantage of this approach is that we can perform more validation
of C++'s operator overloading with built-in candidates vs. the
semantic analysis for those built-in operators: when there are no
viable candidates, we know to expect an error from the built-in
operator handling code. Otherwise, we are not modeling the built-in
semantics properly within operator overloading. This is checked as:
assert(Result.isInvalid() &&
"C++ binary operator overloading is missing
candidates!");
if (Result.isInvalid())
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
The assert() catches cases where we're wrong in a +Asserts build. The
"if" makes sure that, if this happens in a production clang
(-Asserts), we still build the proper built-in operator and continue
on our merry way. This is effectively what happened before this
change, but we've added the assert() to catch more flies.
Mike Stump [Wed, 30 Sep 2009 02:43:10 +0000 (02:43 +0000)]
Improve debugging information for BlockDeclRefExpr. WIP. Given this
scheme, we can switch the previous scheme over to using this code
path. There's a bit of simplifications yet to do as well.
John McCall [Tue, 29 Sep 2009 23:03:30 +0000 (23:03 +0000)]
Desugaring optimizations. Add single-step desugaring methods to all
concrete types. Use unqualified desugaring for getAs<> and sundry.
Fix a few users to either not desugar or use qualified desugar, as seemed
appropriate. Removed Type's qualified desugar method, as it was easy
to accidentally use instead of QualType's.