Produce good looking diagnostics on ambiguous built-in operators.
Now we produce things like:
bug1.cpp:21:11: error: use of overloaded operator '->*' is ambiguous
int i = c->*pmf; // expected-error {{use of overloaded operator '->*' is ambiguous}} \
~^ ~~~
bug1.cpp:21:11: note: built-in candidate operator ->* ('struct A volatile *', 'int const struct A::*')
bug1.cpp:21:11: note: built-in candidate operator ->* ('struct A volatile *', 'int restrict struct A::*')
...
Still need to look at an issue (indicated as FIXME in the test case).
Steve Naroff [Thu, 8 Oct 2009 23:45:10 +0000 (23:45 +0000)]
- Fixup SortCodeCompleteResult() to properly sort keywords on Mac OS (compare was system dependent). Worked on Linux, failed on Mac OS (which caused the recently added testcase to fail on Linux).
- Sort results in testcase.
Mike Stump [Thu, 8 Oct 2009 23:00:00 +0000 (23:00 +0000)]
"Someone pointed out that in my previous Targets.cpp patch I didn't
handle the long size difference for one of the Windows targets." Patch
by John Thompson.
Mike Stump [Thu, 8 Oct 2009 22:55:36 +0000 (22:55 +0000)]
This fixes support for complex literals, reworked to avoid a goto, and
to add a flag noting the presence of a Microsoft extension suffix (i8,
i16, i32, i64). Patch by John Thompson.
Mike Stump [Thu, 8 Oct 2009 21:57:41 +0000 (21:57 +0000)]
In VC++, the *printf functions put an extra "0" in the exponent part
of a floating point number. This add regular expressions to account
for this. Patch by John Thompson.
Douglas Gregor [Thu, 8 Oct 2009 15:54:21 +0000 (15:54 +0000)]
Don't complain about out-of-line explicit specializations of member
function and member function templates that are not definitions. Add
more tests to ensure that explicit specializations of member function
templates prevent instantiation.
Douglas Gregor [Thu, 8 Oct 2009 15:14:33 +0000 (15:14 +0000)]
Improve checking for specializations of member classes of class
templates, and keep track of how those member classes were
instantiated or specialized.
Make sure that we don't try to instantiate an explicitly-specialized
member class of a class template, when that explicit specialization
was a declaration rather than a definition.
Douglas Gregor [Thu, 8 Oct 2009 07:24:58 +0000 (07:24 +0000)]
For instantiations of static data members of class templates, keep
track of the kind of specialization or instantiation. Also, check the
scope of the specialization and ensure that a specialization
declaration without an initializer is not a definition.
Douglas Gregor [Thu, 8 Oct 2009 00:14:38 +0000 (00:14 +0000)]
Only perform an implicit instantiation of a function if its template
specialization kind is TSK_ImplicitInstantiation. Previously, we would
end up implicitly instantiating functions that had explicit
specialization declarations or explicit instantiation declarations
(with no corresponding definitions).
Douglas Gregor [Wed, 7 Oct 2009 23:56:10 +0000 (23:56 +0000)]
Keep track of whether a member function instantiated from a member
function of a class template was implicitly instantiated, explicitly
instantiated (declaration or definition), or explicitly
specialized. The same MemberSpecializationInfo structure will be used
for static data members and member classes as well.
John McCall [Wed, 7 Oct 2009 23:34:25 +0000 (23:34 +0000)]
Refactoring around friend class templates. Better error message for friend enums.
Don't create a new declaration for friend classes if a declaration already exists.
Douglas Gregor [Wed, 7 Oct 2009 22:35:40 +0000 (22:35 +0000)]
Type checking for specializations of member functions of class
templates. Previously, these weren't handled as specializations at
all. The AST for representing these as specializations is still a work
in progress.
Fixes problem in finding visible convertion functions of a class
where matching conversion types in base classes were still visible.
Plus refactoring and cleanup.
Added a test case.
Anders Carlsson [Wed, 7 Oct 2009 01:06:45 +0000 (01:06 +0000)]
Add a MangleContext and pass it to all mangle functions. It will be used for keeping state, such as identifiers assigned to anonymous structs as well as scope encoding.
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.