Douglas Gregor [Fri, 16 Oct 2009 20:01:17 +0000 (20:01 +0000)]
Keep track of whether declararions were loaded from a precompiled
header or not via a new "PCHLevel" field in Decl. We currently use
this information to help CIndex filter out declarations that came from
a precompiled header (rather than from an AST file). Further down the
road, it can be used to help implement multi-level precompiled
headers.
Douglas Gregor [Fri, 16 Oct 2009 18:18:30 +0000 (18:18 +0000)]
Add support for a chain of stat caches in the FileManager, rather than
only supporting a single stat cache. The immediate benefit of this
change is that we can now generate a PCH/AST file when including
another PCH file; in the future, the chain of stat caches will likely
be useful with multiple levels of PCH files.
John McCall [Fri, 16 Oct 2009 00:14:28 +0000 (00:14 +0000)]
Remove the ConstantArrayType subtypes. This information is preserved in the
TypeLoc records for declarations; it should not be necessary to represent it
directly in the type system.
Please complain if you were using these classes and feel you can't replicate
previous functionality using the TypeLoc API.
Douglas Gregor [Thu, 15 Oct 2009 22:53:21 +0000 (22:53 +0000)]
Make the remaining explicit-instantiation semantic action use
CheckSpecializationInstantiationRedecl to check for
redeclarations/instantiations. Also fixes a longstanding issue where
our explicit-instantiation location information wasn't as good as it
could have been.
John McCall [Thu, 15 Oct 2009 22:37:38 +0000 (22:37 +0000)]
ConcreteTypeLoc subclasses which call getInnerTypeLoc() should get a
compile-time error now; moreover, remove the need for an explicit hasInnerType()
call. Thanks to Doug Gregor for the metaprogramming approach.
Daniel Dunbar [Thu, 15 Oct 2009 20:02:44 +0000 (20:02 +0000)]
Driver: Default to using PTH for C++ precompiled header support, PCH for C++
isn't implemented yet.
- <rdar://problem/7297571> Clang should use pretokenized headers for C++ PCH
files
Douglas Gregor [Thu, 15 Oct 2009 17:21:20 +0000 (17:21 +0000)]
Simplify checking of explicit template specialization/explicit
instantiation redeclaration semantics for function template
specializations and member functions of class template
specializations. Also, record the point of instantiation for
explicit-instantiated functions and static data members.
Apply heuristics to cut back on number of candidate
sets of builtin operators. Currently, it is applied
to '++' and '->*' operators. I need to apply it to others
as well. Also, heuristics need be applied to
BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants.
This is WIP.
Douglas Gregor [Thu, 15 Oct 2009 15:54:05 +0000 (15:54 +0000)]
Check the interactions between explicit instantiations and template
specializations. Work in progress; there's more cleanup required to
actually use the new CheckSpecializationInstantiationRedecl checker
uniformly.
Douglas Gregor [Thu, 15 Oct 2009 14:05:49 +0000 (14:05 +0000)]
Diagnose explicit instantiations of function templates and member
functions/static data members of class template specializations that
do not have definitions. This is the latter part of [temp.explicit]p4;
the former part still needs more testing.
Douglas Gregor [Thu, 15 Oct 2009 12:53:22 +0000 (12:53 +0000)]
More explicit template instantiation. Now we're checking for more
cases where an explicit instantiation requires a definition; the
remainder of these checks will come with the implementation of
paragraph 4 of [temp.explicit].
John McCall [Thu, 15 Oct 2009 03:50:32 +0000 (03:50 +0000)]
Better living through metaprogramming. Create a base class which abstracts
most of the unsafe boilerplate out of TypeLoc. Create a QualifiedLoc class
to represent the idea that we *might* start representing source locations
of qualifiers. Dealing with qualifiers explicitly like this also lets us
efficiently ignore them in all the concrete cases.
This should make it obvious and easy to add new TypeLoc subclasses.
Ted Kremenek [Thu, 15 Oct 2009 01:40:34 +0000 (01:40 +0000)]
Per an astute observation from Zhongxing Xu, remove a "special case" logic in
RegionStoreManager::Retrieve() that was intended to handle conflated uses of pointers as integers.
It turns out this isn't needed, and resulted in inconsistent behavior when creating symbolic values on the following test case in 'tests/Analysis/misc-ps.m':
typedef struct _BStruct { void *grue; } BStruct;
void testB_aux(void *ptr);
void testB(BStruct *b) {
{
int *__gruep__ = ((int *)&((b)->grue));
int __gruev__ = *__gruep__;
testB_aux(__gruep__);
}
{
int *__gruep__ = ((int *)&((b)->grue));
int __gruev__ = *__gruep__;
if (~0 != __gruev__) {}
}
}
When the code was analyzed with '-arch x86_64', the value assigned to '__gruev__' be would be a
symbolic integer, but for '-arch i386' the value assigned to '__gruev__' would be a symbolic region
(a blob of memory). With this change the value created is always a symbolic integer.
Since the code being removed was added to support analysis of code calling
OSAtomicCompareAndSwapXXX(), I also modified 'test/Analysis/NSString.m' to analyze the code in both
'-arch i386' and '-arch x86_64', and also added some complementary test cases to test the presence
of leaks when using OSAtomicCompareAndSwap32Barrier()/OSAtomicCompareAndSwap64Barrier() instead of
just their absence. This code change reveals that previously both RegionStore and BasicStore were
handling these cases wrong, and would never cause the analyzer to emit a leak in these cases (false
negatives). Now RegionStore gets it right, but BasicStore still gets it wrong (and hence it has been
disabled temporarily for this test case).
Douglas Gregor [Wed, 14 Oct 2009 23:50:59 +0000 (23:50 +0000)]
CheckTemplateSpecializationScope isn't going to be used for explicit
instantiations, since the requirements are too different from those
for template specializations. Simplify it slightly.
Douglas Gregor [Wed, 14 Oct 2009 23:41:34 +0000 (23:41 +0000)]
Additional semantic checking for explicit template instantiations,
focusing on the scope- and qualifier-related semantic requirements in
C++ [temp.explicit]p2.
Mike Stump [Wed, 14 Oct 2009 18:14:51 +0000 (18:14 +0000)]
Shift the vcall slots for non-virtual bases of a virtual base, up into
the virtual base so they can be reused properly. Don't reuse vcall
slots across a virtual boundary. WIP. I have a testcase, but there
are still things that need to be fixed before the testcase can go in.
Douglas Gregor [Wed, 14 Oct 2009 17:30:58 +0000 (17:30 +0000)]
When mapping from an injected-class-name to its corresponding
template, make sure to get the template that corresponds to *this*
declaration of the class template or specialization, rather than the
canonical specialization. Fixes PR5187.
Rafael Espindola [Wed, 14 Oct 2009 17:09:44 +0000 (17:09 +0000)]
Add support for having different c++ search dirs with -m32 and -m64. So far
this is only used in darwin10, 64 bit ubuntu 9.10 and 64 bit openSUSE 11.1.
Douglas Gregor [Wed, 14 Oct 2009 16:50:13 +0000 (16:50 +0000)]
Implement support for overloaded operator uses that result to a call
to a member operator template. We missed updating this call site when
adding support for function templates; bug exposed by a test for
PR5072.
Sebastian Redl [Wed, 14 Oct 2009 14:59:48 +0000 (14:59 +0000)]
Use partial diagnostics properly in call to RequireCompleteType. Among other things, this means we get a note on the declaration of the incomplete type when it is used in an exception specification.
Chris Lattner [Wed, 14 Oct 2009 05:55:45 +0000 (05:55 +0000)]
fix some cfstring related issues:
1) -fwritable-string does affect the non-utf16 version of cfstrings
just not the utf16 ones.
2) utf16 strings should always be marked constant, as the __TEXT segment
is readonly.
3) The name of the global doesn't matter, remove it from TargetInfo.
4) Trust the asmprinter to drop cstrings into the right section, like llvmgcc does now.
Ted Kremenek [Wed, 14 Oct 2009 00:27:24 +0000 (00:27 +0000)]
retain/release checker: Recognize that calls to
'CVPixelBufferCreateWithPlanarBytes()' and
'CVPixelBufferCreateWithBytes' (Core Video API) can indirectly release
a pixel buffer object via a callback.
Douglas Gregor [Tue, 13 Oct 2009 23:27:22 +0000 (23:27 +0000)]
Improve diagnostics when the parser encounters a declarator with an
unknown type name, e.g.,
foo::bar x;
when "bar" does not refer to a type in "foo".
With this change, the parser now calls into the action to perform
diagnostics and can try to recover by substituting in an appropriate
type. For example, this allows us to easily diagnose some missing
"typename" specifiers, which we now do:
test/SemaCXX/unknown-type-name.cpp:29:1: error: missing 'typename'
prior to dependent type name 'A<T>::type'
A<T>::type A<T>::f() { return type(); }
^~~~~~~~~~
typename
Douglas Gregor [Tue, 13 Oct 2009 21:16:44 +0000 (21:16 +0000)]
Unify our diagnostic printing for errors of the form, "we didn't like
what we found when we looked into <blah>", where <blah> is a
DeclContext*. We can now format DeclContext*'s in nice ways, e.g.,
"namespace N", "the global namespace", "'class Foo'".
This is part of PR3990, but we're not quite there yet.
Anders Carlsson [Tue, 13 Oct 2009 21:02:07 +0000 (21:02 +0000)]
Pass the right SourceLocation to Actions.ActOnOverloadedOperatorReferenceExpr and Actions.ActOnConversionOperatorReferenceExpr. Update incomplete-call.cpp test.