Ted Kremenek [Fri, 15 May 2009 21:14:16 +0000 (21:14 +0000)]
Add hack to scan-build to fix PR 4215
(http://llvm.org/bugs/show_bug.cgi?id=4215): When xcodebuild is invoked with
-sdk iphonesimulator3.0, use gcc-4.2 instead of the system default gcc.
Douglas Gregor [Fri, 15 May 2009 18:53:42 +0000 (18:53 +0000)]
Template instantiation for "if" statements. Also:
- Skip semantic analysis of the "if" condition if it is type-dependent.
- Added the location of the "else" keyword into IfStmt, so that we can
provide it for type-checking after template instantiation.
Chris Lattner [Fri, 15 May 2009 16:08:43 +0000 (16:08 +0000)]
Fix processing of -Ufoo to not inject "#undef foo 1" into the predefines
buffer. This caused exciting nonsense like this:
$ clang t.c -fsyntax-only -UMACRO
In file included from <built-in>:104:
<command line>:1:14: warning: extra tokens at end of #undef directive [-Wextra-tokens]
#undef MACRO 1
^
//
1 diagnostic generated.
Mike Stump [Fri, 15 May 2009 00:29:54 +0000 (00:29 +0000)]
Fixup debug information for the location information for __block
variables. For this to work, the backend needs to handle more complex
forms for locations.
Presently when selection finds something it doesn't understand, it
just avoids generating any information, which is safe, just
incomplete. Radar 6867696
Douglas Gregor [Thu, 14 May 2009 23:26:13 +0000 (23:26 +0000)]
Introduce basic support for instantiating the definitions of member
functions of class templates. Only compound statements and expression
statements are currently implemented.
Douglas Gregor [Thu, 14 May 2009 21:44:34 +0000 (21:44 +0000)]
Introduce a stack of instantiation scopes that are used to store the mapping from variable declarations that occur within templates to their instantiated counterparts
Douglas Gregor [Thu, 14 May 2009 21:06:31 +0000 (21:06 +0000)]
Link FunctionDecls instantiated from the member functions of a class
template to the FunctionDecls from which they were instantiated. This
is a necessary first step to support instantiation of the definitions
of such functions, but by itself does essentially nothing.
Daniel Dunbar [Thu, 14 May 2009 16:42:16 +0000 (16:42 +0000)]
Skip the asm prefix when storing the name in block info.
- Otherwise we emit internal names with embedded '\01' characters,
which confuses some tools.
- Ideally all the code which wants to get a "display name" for the
given function should follow one code path, but this should be a
monotonic improvement for now.
Douglas Gregor [Thu, 14 May 2009 16:41:31 +0000 (16:41 +0000)]
In C++, warn when something previously declared as a "struct" is later
declared as a "class", or vice-versa. This warning is under the
control of -Wmismatched-tags, which is off by default.
Daniel Dunbar [Thu, 14 May 2009 01:45:24 +0000 (01:45 +0000)]
We need to specify the "linkage name" to the subprogram now that we
emit the correct "display name". I suspect we need more work here, see
FIXME for example.
Douglas Gregor [Thu, 14 May 2009 00:28:11 +0000 (00:28 +0000)]
Implement explicit instantiations of member classes of class templates, e.g.,
template<typename T>
struct X {
struct Inner;
};
template struct X<int>::Inner;
This change is larger than it looks because it also fixes some
a problem with nested-name-specifiers and tags. We weren't requiring
the DeclContext associated with the scope specifier of a tag to be
complete. Therefore, when looking for something like "struct
X<int>::Inner", we weren't instantiating X<int>.
This, naturally, uncovered a problem with member pointers, where we
were requiring the left-hand side of a member pointer access
expression (e.g., x->*) to be a complete type. However, this is wrong:
the semantics of this expression does not require a complete type (EDG
agrees).
Daniel Dunbar [Wed, 13 May 2009 21:34:08 +0000 (21:34 +0000)]
Add a test case to showcase a difference in #pragma pack handling
compared to gcc. This is worrisome, but I believe we are doing the
"correct" thing, and if I recall correctly I previously verified this
versus MSVC.
Ted Kremenek [Wed, 13 May 2009 21:07:32 +0000 (21:07 +0000)]
Add some basic type checking for attributes ns_returns_retained and
cf_returns_retained. Currently this attribute can now be applied to any
Objective-C method or C function that returns a pointer or Objective-C object
type.
Modify the tablegen definition of diagnostic 'warn_attribute_wrong_decl_type' to
expect that the diagnostics infrastructure will add quotes around the attribute
name when appropriate. Alonq with this change, I modified the places where this
warning is issued to passed the attribute's IdentifierInfo* instead of having a
hard-coded C constant string.
Douglas Gregor [Wed, 13 May 2009 20:28:22 +0000 (20:28 +0000)]
Explicit instantiations of templates now instantiate the definitions
of class members (recursively). Only member classes are actually
instantiated; the instantiation logic for member functions and
variables are just stubs.
Anders Carlsson [Wed, 13 May 2009 19:49:53 +0000 (19:49 +0000)]
Disable access control by default. It can be enabled with the -faccess-control option. When we have better support for it, we can enable it by default again.
Daniel Dunbar [Wed, 13 May 2009 18:54:26 +0000 (18:54 +0000)]
ABI handling: Fix invalid assertion, it is possible for a valid
coercion to be specified which truncates padding bits. It would be
nice to still have the assert, but we don't have any API call for the
unpadding size of a type yet.
Douglas Gregor [Wed, 13 May 2009 18:28:20 +0000 (18:28 +0000)]
Improve the semantic checking for explicit instantiations of
templates. In particular:
- An explicit instantiation can follow an implicit instantiation (we
were improperly diagnosing this as an error, previously).
- In C++0x, an explicit instantiation that follows an explicit
specialization of the same template specialization is ignored. In
C++98, we just emit an extension warning.
- In C++0x, an explicit instantiation must be in a namespace
enclosing the original template. C++98 has no such requirement.
Also, fixed a longstanding FIXME regarding the integral type that is
used for the size of a constant array type when it is being instantiated.
Ted Kremenek [Wed, 13 May 2009 18:16:01 +0000 (18:16 +0000)]
Fix crasher reported in PR 4209 caused by an invalid summary
generation when EvalObjCMessageExpr() did not resolve the
ObjCInterfaceDecl* for a receiver when the receiver's symbolic value
wasn't being explicitly tracked.
Chris Lattner [Wed, 13 May 2009 05:13:44 +0000 (05:13 +0000)]
Fix rdar://6880951 by rejecting vectors of vectors.
It seems dubious to me that isIntegerType() returns true for
vectors of integers, but not complex integers. This should
probably be rethought, I'll file a bugzilla.
Chris Lattner [Wed, 13 May 2009 04:00:12 +0000 (04:00 +0000)]
Fix rdar://6881069, a crash on a form of vector_size that we
don't support. While it would be nice to support this eventually,
this form is not common at all (just seen in gcc testsuite) and
it might be better to model vector_size as a type attribute anyway.
For now just emit a nice error on it.
Chris Lattner [Wed, 13 May 2009 02:50:56 +0000 (02:50 +0000)]
Fix rdar://6880259 - invalid function name in block call (__NSConcreteGlobalBlock2)
by using the appropriate CGM interface instead of directly creating a global.
Chris Lattner [Wed, 13 May 2009 00:55:26 +0000 (00:55 +0000)]
When we expect two arguments but have zero, make sure to add
two empty arguments. Also, add an assert so that this bug
manifests as an assertion failure, not a valgrind problem.
This fixes rdar://6880648 - [cpp] crash in ArgNeedsPreexpansion
Douglas Gregor [Wed, 13 May 2009 00:25:59 +0000 (00:25 +0000)]
Semantic analysis for explicit instantiation of class templates. We
still aren't instantiating the definitions of class template members,
and core issues 275 and 259 will both affect the checking that we do
for explicit instantiations (but are not yet implemented).
Chris Lattner [Tue, 12 May 2009 21:44:00 +0000 (21:44 +0000)]
improve the diagnostic for uses of the GCC "global variable in a register" extension.
This implements rdar://6880449 - improve diagnostic for usage of "global register variable" GCC extension
Douglas Gregor [Tue, 12 May 2009 21:31:51 +0000 (21:31 +0000)]
Refactor the parsing of declarations so that template declarations can
parse just a single declaration and provide a reasonable diagnostic
when the "only one declarator per template declaration" rule is
violated. This eliminates some ugly, ugly hackery where we used to
require thatn the layout of a DeclGroup of a single element be the
same as the layout of a single declaration.