Commit Graph

16654 Commits

Author SHA1 Message Date
Ted Kremenek 16e6026f01 Fix InitListExpr::getSourceRange() to work in the case of no locations for '(' and ')'. This can happen
in the case of transparent unions.

llvm-svn: 118472
2010-11-09 02:11:40 +00:00
Argyrios Kyrtzidis 8909686b22 Fix miscompilation regarding VLAs; subscription of VLA pointers was incorrect.
Fixes rdar://8644873 & http://llvm.org/PR8567.

llvm-svn: 118468
2010-11-09 01:30:48 +00:00
John McCall 478382521e When re-using a vtable slot for the nearest overridden method, just because
there's no return adjustment from the overridden to the overrider doesn't
mean there isn't a return adjustment from the overrider to the final
overrider.  This matters if we're emitting a virtual this-adjustment thunk
because the overrider virtually inherits from the class providing the
nearest overridden method.  Do the appropriate return adjustment in this case.

Fixes PR7611.

llvm-svn: 118466
2010-11-09 01:18:05 +00:00
Nick Lewycky 14d88eb41f Fix warning about unused variable 'Fn' in no-asserts builds. Also reflow this
block so that it looks more like the rest of the file. No functional change.

llvm-svn: 118459
2010-11-09 00:19:31 +00:00
Nick Lewycky 6147891648 Don't lose track of previous-declarations when instantiating a class template.
Fixes PR8001.

llvm-svn: 118454
2010-11-08 23:29:42 +00:00
Fariborz Jahanian 94ad274c24 Provide a precise builtin declaration for objc_msgSend
to avoid a bogus warning. Fixes //rdar: //8632525

llvm-svn: 118451
2010-11-08 22:53:18 +00:00
Douglas Gregor dc520b0f08 If an instance method messages is sending to an expression of type Class,
and we statically can compute a bound on the actual type (e.g.,
because it's a send to the the magic "class" instance method), code
complete as if we were performing a class message send to that class.

llvm-svn: 118443
2010-11-08 21:12:30 +00:00
John McCall f71b45367f Document Clang's support for attributes on individual enumerators and
tweak the documentation for deprecation-with-message.  Provide __has_feature
tests for both.  rdar://problem/8605692

llvm-svn: 118435
2010-11-08 19:48:17 +00:00
Roman Divacky b45d2672f7 Add a forgotten break. Found by Rafael Espindola!
llvm-svn: 118433
2010-11-08 19:39:10 +00:00
Argyrios Kyrtzidis 8566356acb When building a compound literal, check that the base element of the array is complete.
Fixes rdar://8620582 & http://llvm.org/PR7905

llvm-svn: 118428
2010-11-08 19:14:19 +00:00
Fariborz Jahanian 086a24a2be Fixes a rewrite bug, rewriting nested property usage
inside blocks. Fixes //rdar: //8608293.

llvm-svn: 118425
2010-11-08 18:37:50 +00:00
Roman Divacky 137426a42f Use integrated-as for processing .s files on FreeBSD. Copied
from Linux/OpenBSD code.

llvm-svn: 118419
2010-11-08 17:46:39 +00:00
Douglas Gregor bd6b17f4ef Improve our handling of C++ [class.copy]p3, which specifies that a
constructor template will not be used to copy a class object to a
value of its own type. We were eliminating all constructor templates
whose specializations look like a copy constructor, which eliminated
important candidates. Fixes PR8182.

llvm-svn: 118418
2010-11-08 17:16:59 +00:00
Ted Kremenek 14715b7f2f Only enable the ObjCAtSyncChecker when the translation unit uses Objective-C.
llvm-svn: 118414
2010-11-08 16:52:54 +00:00
Douglas Gregor bcd625305b When attempting reference binding to an overloaded function, also
consider that we might be trying to bind a reference to a class type,
which involves a constructor call. Fixes PR7425.

llvm-svn: 118407
2010-11-08 15:20:28 +00:00
Rafael Espindola c5688628d8 Pass "-z relro" as two arguments. This works with both gnu ld and gold.
Patch by Frits van Bommel.

llvm-svn: 118406
2010-11-08 14:48:47 +00:00
Douglas Gregor e81f58e180 Properly diagnose invalid casts to function references. Patch by
Faisal Vali, tweaked by me. Fixes PR8230.

llvm-svn: 118400
2010-11-08 03:40:48 +00:00
Rafael Espindola 96aef794ba Use the integrated assembler when procession .s files on OpenBSD and Linux.
Original patch for OpenBSD by Vladimir Kirillov.

llvm-svn: 118386
2010-11-07 23:13:01 +00:00
Douglas Gregor 1ccc8416a0 Remove broken support for variadic templates, along with the various
abstractions (e.g., TemplateArgumentListBuilder) that were designed to
support variadic templates. Only a few remnants of variadic templates
remain, in the parser (parsing template type parameter packs), AST
(template type parameter pack bits and TemplateArgument::Pack), and
Sema; these are expected to be used in a future implementation of
variadic templates.

But don't get too excited about that happening now.

llvm-svn: 118385
2010-11-07 23:05:16 +00:00
Rafael Espindola 1c76c59bbc Add support for -rdynamic.
llvm-svn: 118384
2010-11-07 22:57:16 +00:00
Rafael Espindola c8f008f649 Use ld directly on linux. Changes from the previous try:
*) Try to detect as much as possible from the system itself, not the distro.
   This should make it easier to port to a new distro and more likely to
   work on a unknown one.
*) The distro enum now doesn't include the arch. Just use the existing
   host detection support in LLVM.
*) Correctly handle --sysroot.

A small regression is that now clang will pass bitcode file to the linker.
This is necessary for the gold plugin support to work.

It might be better to detect this at configure/cmake time, but doing it in
c++ first is a lot easier.

llvm-svn: 118382
2010-11-07 20:14:31 +00:00
Anders Carlsson 2ceb347e8b A union cannot contain static data members or data members of reference type.
llvm-svn: 118381
2010-11-07 19:13:55 +00:00
Ted Kremenek 6a15337ded Change the StringSet used by CalculateHiddenNames() to use a BumpPtrAllocator.
llvm-svn: 118372
2010-11-07 06:11:36 +00:00
Ted Kremenek b4ea9a843a Fix memory leak of IdentifierIterator object.
llvm-svn: 118371
2010-11-07 06:11:33 +00:00
John McCall 2faab302e0 ARM EH uses a different personality function in C.
llvm-svn: 118366
2010-11-07 02:35:25 +00:00
Anders Carlsson 3fd50319d3 Don't warn when matching %p to nullptr.
llvm-svn: 118344
2010-11-06 14:58:53 +00:00
John McCall cdf7ef5437 Simplify the logic for emitting guard variables for template static
data members by delaying the emission of the initializer until after
linkage and visibility have been set on the global.  Also, don't
emit a guard unless the variable actually ends up with vague linkage,
and don't use thread-safe statics in any case.

llvm-svn: 118336
2010-11-06 09:44:32 +00:00
Craig Silverstein 8e3d95e7df Add PPCallbacks for #if/#ifdef/etc.
The callback info for #if/#elif is not great -- ideally it would give
us a list of tokens in the #if, or even better, a little parse tree.
But that's a lot more work.  Instead, clients can retokenize using
Lexer::LexFromRawLexer().

Reviewed by nlewycky.

llvm-svn: 118318
2010-11-06 01:19:03 +00:00
Argyrios Kyrtzidis 7d391557cc When determining which template partial specialization is more specialized,
make sure to setup the instantiation stack. Fixes rdar://8620775 & http://llvm.org/PR8234

llvm-svn: 118314
2010-11-05 23:25:18 +00:00
Douglas Gregor 25edf4302f When searching for an instantiated declaration requires instantiation
of its parent context, be sure to update the parent-context pointer
after instantiation. Fixes two anonymous-union instantiation issues in
<rdar://problem/8635664>.

llvm-svn: 118313
2010-11-05 23:22:45 +00:00
Douglas Gregor 266bb5fd5b Check for an invalid field earlier in a constructor's initialization
of that field. Otherwise, we can end up building and later trying to
instantiate a dependent member initializer that will fail at
instantiation time. 

Unfortunately, I've only managed to trigger this bug with very large
sources, so there's no test case :(

llvm-svn: 118306
2010-11-05 22:21:31 +00:00
Argyrios Kyrtzidis b0ca9eb294 Don't write an empty DIAG_USER_MAPPINGS record.
llvm-svn: 118305
2010-11-05 22:20:49 +00:00
Argyrios Kyrtzidis 452707c125 Read/write from/to PCH the diagnostic mappings that the user set so that e.g. #pragma clang diagnostic can be used in a PCH.
Fixes rdar://8435969.

llvm-svn: 118303
2010-11-05 22:10:18 +00:00
Benjamin Kramer 396dcf356f Put class into an anonymous namespace.
llvm-svn: 118293
2010-11-05 19:56:37 +00:00
Fariborz Jahanian 90d2e57ff7 Proper rewriting of block envokation with
qualified ObjC pointer types in its argument list.
// rdar: //8608902

llvm-svn: 118286
2010-11-05 18:34:46 +00:00
Anders Carlsson e981a8c231 Expressions of type std::nullptr_t can be used as sentinels.
llvm-svn: 118276
2010-11-05 15:21:33 +00:00
Anders Carlsson 7da7cc568f Implement [over.ics.rank]p4: A conversion that does not convert an std::nullptr_t to bool is better than one than does.
llvm-svn: 118269
2010-11-05 00:12:09 +00:00
John McCall 954b5de0d8 Use the real keyword location when rebuilding an elaborated type instead of
making something up.  Fixes PR8129.

llvm-svn: 118258
2010-11-04 19:04:38 +00:00
Argyrios Kyrtzidis 4b52007c35 Don't be so eager to replace UsingDecls in a DeclContext's lookup table;
check that the TargetNestedNameDecl is the same first.

llvm-svn: 118239
2010-11-04 08:48:52 +00:00
Anders Carlsson ba37e1eb49 std::nullptr_t is a fundamental type for RTTI purposes.
llvm-svn: 118238
2010-11-04 05:28:09 +00:00
Anders Carlsson 2683fd6f8c Mangle std::nullptr_t as specified by the Itanium C++ ABI.
llvm-svn: 118236
2010-11-04 04:31:32 +00:00
Argyrios Kyrtzidis 9a94d9b876 Don't instantiate members not belonging in the semantic context of the template.
e.g. for:

    template <int i> class A {
      class B *g;
    };

'class B' has the template as lexical context but semantically it is
introduced in namespace scope.

Fixes rdar://8611125 & http://llvm.org/PR8505

llvm-svn: 118235
2010-11-04 03:18:57 +00:00
Anders Carlsson a95069c52f It's OK to use nullptr in relational operators if the other side is a null pointer constant.
llvm-svn: 118234
2010-11-04 03:17:43 +00:00
Douglas Gregor cc10cbfbc7 add a comment to my last commit
llvm-svn: 118212
2010-11-04 00:14:23 +00:00
Douglas Gregor 3ade5704fe When canonicalizing nested-name-specifiers involving dependent names
or dependent specializations, rip apart the dependent name/dependent
specialization to recanonicalize its pieces, because
nested-name-specifiers store "dependent-type::identifier" differently
than types do. Fixes PR7419.

llvm-svn: 118211
2010-11-04 00:09:33 +00:00
Fariborz Jahanian 733dde6035 Fixes a rewriting bug when type in a block argument type
is a objc qualified class type. // rdar: //8608902

llvm-svn: 118208
2010-11-03 23:50:34 +00:00
Fariborz Jahanian 147e1cbb49 Patch to rewrite objc qualified types which occur in
block pointer type arguments. Partial fix for 
// rdar: //8608902

llvm-svn: 118205
2010-11-03 23:29:24 +00:00
Argyrios Kyrtzidis 71731d6b05 Implement -working-directory.
When -working-directory is passed in command line, file paths are resolved relative to the specified directory.
This helps both when using libclang (where we can't require the user to actually change the working directory)
and to help reproduce test cases when the reproduction work comes along.

--FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains
 the working directory value if set).
--FileSystemOptions are passed around to various interfaces that perform file operations.
--Opening & reading the content of files should be done only through FileManager. This is useful in general since
 file operations will be abstracted in the future for the reproduction mechanism.

FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same
FileManager but with different FileSystemOptions.

Addresses rdar://8583824.

llvm-svn: 118203
2010-11-03 22:45:23 +00:00
Nick Lewycky 07e97c594d Make this error less specific but also less likely to cause confusion. Fixes
PR7702.

llvm-svn: 118181
2010-11-03 17:52:57 +00:00
Douglas Gregor b37c9af75d When producing overload candidates for binary built-in operators, keep
the sets of available conversions for the first and second arguments
separate. This is apparently the indent of C++ [over.built], and
reduces the number of overload candidates generated, eliminating some
ambiguities. Fixes PR8477.

llvm-svn: 118178
2010-11-03 17:00:07 +00:00