Commit Graph

33505 Commits

Author SHA1 Message Date
DeLesley Hutchins db917bdea2 Thread safety analysis: add support for attributes on constructors.
llvm-svn: 142665
2011-10-21 18:06:53 +00:00
Fariborz Jahanian 2512747959 objective-c: Diagnose redeclaration of private
ivars in class extensions. // rdar://10309454

llvm-svn: 142664
2011-10-21 18:03:52 +00:00
Sean Callanan 715736c007 Added documentation for the recently-added
addDecl() and makeDeclVisibleInContextInternal()
functions, and made the latter private since it
does not and should not have external clients.

llvm-svn: 142655
2011-10-21 16:15:18 +00:00
DeLesley Hutchins 3d312b175a Refactoring and code cleanup.
llvm-svn: 142654
2011-10-21 16:14:33 +00:00
Douglas Gregor fbf8752597 When performing name lookup for the previous declaration of a field,
be sure to consider all of the possible lookup results. We were
assert()'ing (but behaving correctly) for unresolved values. Fixes
PR11134 / <rdar://problem/10290422>.

llvm-svn: 142652
2011-10-21 15:47:52 +00:00
Peter Collingbourne 99eddc3d92 Permit auto SCS on parameter declarations, C++03 [dcl.stc]p2
llvm-svn: 142649
2011-10-21 11:55:09 +00:00
Nick Lewycky 90a47b127b Try to be exceedingly clever and make this test work properly whether it's run
under bash or under cmd.exe.

llvm-svn: 142637
2011-10-21 04:04:49 +00:00
Douglas Gregor 60060d6f8f Treat the Microsoft/Borland keyword "__except" as a context-sensitive
keyword, because both libstdc++ and libc++ use "__except" as an
identifier. Fixes <rdar://problem/10322555>.

llvm-svn: 142636
2011-10-21 03:57:52 +00:00
Nick Lewycky 99cc8c01ee Massage this test a little so it works when run inside the Google environment.
llvm-svn: 142635
2011-10-21 03:07:40 +00:00
Sean Callanan 95e74be193 I added a new function to DeclContext called
addDeclInternal().  This function suppresses any
calls to FindExternalVisibleDeclsByName() while
a Decl is added to a DeclContext.  This behavior
is required for the ASTImporter, because in the
case of the LLDB client the ASTImporter would be
called recursively to import the visible decls,
which leads to assertions because the recursive
call is seeing partially-formed types.

I also modified the ASTImporter to use
addDeclInternal() in all places where it would
otherwise use addDecl().  This fix should not
affect the rest of Clang, passes Clang's
testsuite, and fixes several serious LLDB bugs.

llvm-svn: 142634
2011-10-21 02:57:43 +00:00
Nick Lewycky ba743b75cb Take DW_AT_comp_dir from $PWD when it's present and starts with a '/'. This is
closer to what GCC does, except that GCC also checks that the inodes for $PWD
and '.' match.

llvm-svn: 142633
2011-10-21 02:32:14 +00:00
Richard Smith fe2750db42 Add -Wc++98-compat diagnostics for jumps which bypass initialization of non-POD
but trivially constructible and destructible variables in C++11 mode. Also
incidentally improve the precision of the wording for jump diagnostics in C++98
mode.

llvm-svn: 142619
2011-10-20 21:42:12 +00:00
Douglas Gregor 7f4fbecbe2 When fixing up the storage class for an anonymous union, don't mark
the anonymous union as valid: our fixes have Fix-Its.

llvm-svn: 142616
2011-10-20 20:40:00 +00:00
Ted Kremenek 77a0eb20ab Add test case for analyzer crash reported in <rdar://problem/10308201> (which is already fixed in mainline).
llvm-svn: 142606
2011-10-20 19:33:06 +00:00
Richard Smith f411196d15 'extern template' is a C++11 feature. Add an Extension for C++98 (this matches
gcc's behaviour), and a -Wc++98-compat-pedantic warning for C++11.

llvm-svn: 142597
2011-10-20 18:35:58 +00:00
Douglas Gregor f4ef4d2ec5 There's no point in marking a declaration invalid just because it
shadows a template parameter. Complain about the shadowing (or not,
under -fms-extensions), but don't invalidate the declaration. Merely
forget about the template parameter declaration.

llvm-svn: 142596
2011-10-20 17:58:49 +00:00
Argyrios Kyrtzidis 9006807dcd [libclang] Don't use C++-style comments in c-index-test.c.
llvm-svn: 142590
2011-10-20 17:21:46 +00:00
Douglas Gregor 44e5a0a72b Diagnose class template (partial) specializations that occur in the
*wrong* class scope. This is one of the problems behind
<rdar://problem/9676205>.

llvm-svn: 142588
2011-10-20 16:41:18 +00:00
Douglas Gregor f65d8ffca7 When we parse something that looks like a templated friend tag but
actually just has an extraneous 'template<>' header, strip off the
'template<>' header and treat it as a normal friend tag. Fixes PR10660
/ <rdar://problem/9958322>.

llvm-svn: 142587
2011-10-20 15:58:54 +00:00
Ted Kremenek 337c5b880c Further refine the diagnostic categories for ARC diagnostics. Addresses <rdar://problem/10245086>.
llvm-svn: 142571
2011-10-20 05:07:47 +00:00
Richard Smith 91c7bbde4b Add -Wc++98-compat warning for enumerations in nested name specifiers.
llvm-svn: 142568
2011-10-20 03:28:47 +00:00
David Blaikie 733f7bb81f FixIt insert 'static' for anonymous unions at global or namespace scope.
llvm-svn: 142566
2011-10-20 02:49:08 +00:00
David Blaikie 6f686fc271 Add a fixit to remove storage specifiers on anonymous enums.
llvm-svn: 142565
2011-10-20 02:10:55 +00:00
David Blaikie 357cd4e715 Fix all 80 col violations in include/clang/Basic, plus any trailing whitespace in the files I'm touching anyway.
llvm-svn: 142564
2011-10-20 01:45:20 +00:00
Richard Smith 4e9ea71dab Make the -verify bits in this test actually test something, and fix a few cases
where the test didn't work.

llvm-svn: 142563
2011-10-20 01:41:28 +00:00
Eli Friedman 7bba3ef862 Define __STDC__ in -fms-extensions mode; defining it is consistent with gcc, and not defining it causes the system headers on multiple platforms to break with -fms-extensions because they assume the lack of a definition of __STDC__ implies a traditional (pre-ANSI) preprocessor. PR10324 and <rdar://problem/10313809> .
llvm-svn: 142554
2011-10-19 23:46:05 +00:00
David Blaikie 30d15445ed 80 cols (one I created in my last commit, plus a bunch of others that were already there)
llvm-svn: 142552
2011-10-19 22:56:21 +00:00
David Blaikie 0a8e8999d6 Don't provide errors for anonymous unions when they're actually anonymous classes.
llvm-svn: 142551
2011-10-19 22:43:29 +00:00
Richard Smith 09f76ee63c Improve the diagnostic when a comma ends up at the end of a declarator group
instead of a semicolon (as sometimes happens during refactorings). When such a
comma is seen at the end of a line, and is followed by something which can't
possibly be a declarator (or even something which might be a plausible typo for
a declarator), suggest that a semicolon was intended.

llvm-svn: 142544
2011-10-19 21:33:05 +00:00
Richard Smith f720df0ed6 -Wc++98-compat: warn on nontrivial types used in unions and anonymous structs.
llvm-svn: 142541
2011-10-19 20:41:51 +00:00
Matt Beaumont-Gay 4b489fa629 Only warn at self-initialization if some later use is always uninitialized.
llvm-svn: 142538
2011-10-19 18:53:03 +00:00
Richard Smith c620f554b9 -Wc++98-compat: diagnose if a reference is bound to a prvalue which does not
have an unambiguous accessible copying constructor; this is ill-formed in C++98.

llvm-svn: 142533
2011-10-19 16:55:56 +00:00
Rafael Espindola 5450f218a6 Fix the signatures of vfork, __sigsetjmp and sigsetjmp.
Patch by Dimitry Andric.

llvm-svn: 142531
2011-10-19 14:50:34 +00:00
Hans Wennborg cc8ce7b1d7 Break out ssize_t test from Sema/format-strings-fixit.c
Move to a separate test that sets a specific target triple
so that the type of ssize_t is known.

llvm-svn: 142481
2011-10-19 07:55:50 +00:00
Douglas Gregor e248eea214 Improve the warning for cv-qualifiers on free functions, from Ahmed Charles!
llvm-svn: 142478
2011-10-19 06:04:55 +00:00
Douglas Gregor 5fdc4de718 Add support for constant arrays, from Anders Waldenborg!.
llvm-svn: 142477
2011-10-19 05:51:43 +00:00
Douglas Gregor 89861066ed Add TypeKind.CONSTANTARRAY, from Anders Waldenborg!
llvm-svn: 142476
2011-10-19 05:50:34 +00:00
Douglas Gregor d59d02cc38 Fix error message for unknown type kind, from Anders Waldenborg!
llvm-svn: 142475
2011-10-19 05:49:29 +00:00
Douglas Gregor 32df3664be This new field was introduced in clang-c in r141277
Python needs this in its structure definition so it allocates enough
memory. From Anders Waldenborg!

llvm-svn: 142474
2011-10-19 05:47:46 +00:00
David Blaikie 651c73ce78 Fix pr9789, assert-on-invalid while instantiating an (invalid) class template with a non-final parameter pack. Also improve the warning for non-final parameter packs in this scenario so it only fires once, rather than once for every template parameter after the non-final parameter pack.
llvm-svn: 142473
2011-10-19 05:19:50 +00:00
Douglas Gregor dab63c1434 Tweak this test to test more directly what we want, and hopefully work around the brokenness of code completion under -fdelayed-template-parsing
llvm-svn: 142472
2011-10-19 04:17:22 +00:00
Argyrios Kyrtzidis 4e8b13613b Don't forget to complete the objc interface before asking for information,
otherwise lldb will suffer.

llvm-svn: 142471
2011-10-19 02:25:16 +00:00
Richard Smith a066ccfcf1 Add a -Wc++98-compat warning for friend functions of class templates which would
be implicitly instantiated (resulting in a redefinition) in C++98.

llvm-svn: 142468
2011-10-19 00:54:10 +00:00
Eric Christopher 7ec8ec8581 Add block information for ObjC @catch blocks.
Fixes rdar://10282889

llvm-svn: 142467
2011-10-19 00:44:01 +00:00
Eric Christopher a9d3497b5e Add a new subclass of RunCleanupScopes that also handles creating new
lexical blocks for debug info.

llvm-svn: 142466
2011-10-19 00:43:52 +00:00
Peter Collingbourne a48f33f951 Move static array parameter checks to SemaExpr, per Doug's request
llvm-svn: 142465
2011-10-19 00:16:45 +00:00
Richard Smith 38c0e0417c -Wc++98-compat: warn if a SFINAE substitution in C++11 suppresses an access
control diagnostic.

llvm-svn: 142463
2011-10-19 00:07:01 +00:00
Fariborz Jahanian 7f73302b4f objc: allow class name qualified with protocols in
iboutletcollection attribute. But ignore protocol
list. // rdar://10296078

llvm-svn: 142459
2011-10-18 23:13:50 +00:00
Anna Zaks d009bfac0c [analyzer] Move predecessor into the NodeBuilder context.
llvm-svn: 142454
2011-10-18 23:06:48 +00:00
Anna Zaks a99b41f37f [analyzer] Make NodeBuilder and Pred node loosely coupled
NodeBuilder should not assume it's dealing with a single predecessor. Remove predecessor getters. Modify the BranchNodeBuilder to not be responsible for doing auto-transitions (which depend on a predecessor).

llvm-svn: 142453
2011-10-18 23:06:44 +00:00
Anna Zaks 1dd965eaa5 [analyzer] Remove StmtNodeBuilder from CheckerContext
It now only depends on a generic NodeBuilder instead. As part of this change, make the generic node builder results finalized by default.

llvm-svn: 142452
2011-10-18 23:06:38 +00:00
Anna Zaks 88d9462b73 [analyzer] Subclassing StmtBuilder from the NodeBuilder
llvm-svn: 142451
2011-10-18 23:06:33 +00:00
Anna Zaks e83ddcc4ec [analyzer] Remove dead code.
ExprEngineBuilders is not used.

llvm-svn: 142450
2011-10-18 23:06:29 +00:00
Anna Zaks ea96f5b852 [analyzer] Remove redundant method + whitespace.
llvm-svn: 142449
2011-10-18 23:06:25 +00:00
Anna Zaks 6d285c58ec [analyzer] Modularize builder use in processBranch.
Take advantage of the new builders for branch processing. As part of this change pass generic NodeBuilder (instead of BranchNodeBuilder) to the BranchCondition callback and remove the unused methods form BranchBuilder.

llvm-svn: 142448
2011-10-18 23:06:21 +00:00
Anna Zaks eebbbc7253 [analyzer] Pull Pred out of NodeBuilderContext.
Each builder will have a different one, so it doesn't make sense to keep it in the context.

llvm-svn: 142447
2011-10-18 23:06:16 +00:00
Anna Zaks 2e2eb49f7f [analyzer] Rely only on NodeBuilder inside CheckerContext.
llvm-svn: 142446
2011-10-18 23:06:11 +00:00
Anna Zaks 1ee9f11631 [analyzer] Remove redundant assignment operator.
llvm-svn: 142445
2011-10-18 23:06:08 +00:00
Anna Zaks ce5e97efdd [analyzer] NodeBuilder Refactoring: Subclass BranchNodeBuilder from NodeBuilder.
llvm-svn: 142444
2011-10-18 23:06:04 +00:00
Anna Zaks fc0189aadc [analyzer] Node Builder refactoring: Introduce a simple Node Builder responsible for generating the node frontier.
Currently we have a bunch of different node builders which provide some common
functionality but are difficult to refactor. Each builder generates nodes of
different kinds and calculates the frontier nodes, which should be propagated
to the next step (after the builder dies).

Introduce a new NodeBuilder which provides very basic node generation facilities
but takes care of the second problem. The idea is that all the other builders
will eventually use it. Use this builder in CheckerContext instead of
StmtNodeBuilder (the way the frontier is propagated to the StmtBuilder
is a hack and will be removed later on).

llvm-svn: 142443
2011-10-18 23:05:58 +00:00
John McCall 59207978e6 More metaprogramming with builtin types.
llvm-svn: 142433
2011-10-18 22:28:37 +00:00
Argyrios Kyrtzidis 72a3cf0a4a [libclang] Make sure we do a correct invalid check in clang_getExpansionLocation.
llvm-svn: 142430
2011-10-18 21:59:54 +00:00
Douglas Gregor 7c0fc61faa Minor tweak to test
llvm-svn: 142427
2011-10-18 21:43:22 +00:00
Richard Smith c82397332d -Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 2.
llvm-svn: 142426
2011-10-18 21:39:00 +00:00
Douglas Gregor c1939d3967 Remove unused data member
llvm-svn: 142425
2011-10-18 21:25:15 +00:00
Douglas Gregor e5c79d5ea8 Provide result types for code completions that describe built-in
expressions (this, sizeof, etc.).

llvm-svn: 142424
2011-10-18 21:20:17 +00:00
John McCall 91aee685d8 Add a __has_feature check for arc_cf_code_audited.
llvm-svn: 142423
2011-10-18 21:18:53 +00:00
John McCall e314e27c58 Macro metaprogramming for builtin types.
llvm-svn: 142420
2011-10-18 21:02:43 +00:00
Richard Smith 0bf8a492fd -Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 1.
llvm-svn: 142419
2011-10-18 20:49:44 +00:00
Daniel Dunbar b274318bba Frontend: Support -iframework.
llvm-svn: 142418
2011-10-18 20:40:38 +00:00
Richard Smith aed32b4d8c Simplify RecordDeclCXX::setBases slightly. No functional change.
Add test that a variadic base list which expands to 0 bases doesn't make the
class a non-aggregate. This test passed before the change, too.

llvm-svn: 142411
2011-10-18 20:08:55 +00:00
Fariborz Jahanian 2f31b33f34 objc: more changes in use of IBOutletCollection attribute.
'Class' is disallowed as argument.  If the argument is missing, 
NSObject is assumed. // rdar://10296078

llvm-svn: 142409
2011-10-18 19:54:31 +00:00
Argyrios Kyrtzidis 05c65fbdb6 [arcmt] Rewrite attributes in extensions as well. rdar://9992142
llvm-svn: 142407
2011-10-18 19:49:19 +00:00
Argyrios Kyrtzidis b51684d7a1 Set the objc "property attributes as written" for extension properties as well.
llvm-svn: 142406
2011-10-18 19:49:16 +00:00
Richard Smith c30493db3c In C++11, a class's members are allowed to be nominated as friends.
llvm-svn: 142393
2011-10-18 18:33:57 +00:00
Argyrios Kyrtzidis 058b451d87 [driver] Make the driver to link the simulator arclite lib when passing -mios-simulator-version-min.
rdar://10218700

llvm-svn: 142372
2011-10-18 17:40:15 +00:00
Fariborz Jahanian 6b70865ec0 objc: diagnose invalid argument to an
iboutletcollection attribute intead of crashing.
// rdar://10296078

llvm-svn: 142364
2011-10-18 17:11:10 +00:00
Argyrios Kyrtzidis 098c4eabd2 [libclang] Since an objc extension semantically continues the interface of the class
don't use unique USRs for them, otherwise we fail to associate @implementation methods
with the methods in extensions.

llvm-svn: 142361
2011-10-18 16:50:06 +00:00
Douglas Gregor 09deffa067 Make it possible to compute the type of 'this' without capturing
it. Refactoring to be used in a moment.

llvm-svn: 142360
2011-10-18 16:47:30 +00:00
Douglas Gregor 4205feffcd Add code completions for C++0x expressions
llvm-svn: 142357
2011-10-18 16:29:03 +00:00
Argyrios Kyrtzidis 0c7735e525 [libclang] Index implicit property references.
llvm-svn: 142355
2011-10-18 15:50:50 +00:00
Argyrios Kyrtzidis 1c7dcd04b8 [libclang] When printing the diagnostic print it with a new line.
llvm-svn: 142354
2011-10-18 15:13:14 +00:00
Argyrios Kyrtzidis 321e30216a [libclang] Index method references.
llvm-svn: 142353
2011-10-18 15:13:11 +00:00
Benjamin Kramer 80ca407610 Use llvm::Triple's methods to parse FreeBSD version numbers.
Who could've thought that FreeBSD would ever reach version 10!
Patch from Dimitry Andric.

llvm-svn: 142349
2011-10-18 10:10:08 +00:00
Hans Wennborg a5d653c7dd Another attempt at fixing format-strings-fixit.c.
Use "%f" as format string to make sure it doesn't match size_t, etc.
whatever they might be typedeffed to, so that the fixit always applies.

llvm-svn: 142348
2011-10-18 09:30:37 +00:00
Hans Wennborg 95c49c6c32 Disable the ssize_t test in format-strings-fixit.c.
Turns out this part of the test from r142342 wasn't portable.
The errors on the bots look like this:

E:\bb-win7\cmake-clang-i686-msys\build\tools\clang\test\Sema\Output\format-strings-fixit.c.tmp:58:13: error: conversion specifies type 'unsigned int' but the argument has type 'ssize_t' (aka 'long')
  printf("%zd", (ssize_t) 42);
          ~~^   ~~~~~~~~~~~~
          %zd

Obviously we can't typedef ssize_t to someting that doesn't have the same size as size_t and expect it to work.

But it's also weird that the format string "%zd" gets interpreted as "unsigned int" when it should clearly be signed.

llvm-svn: 142345
2011-10-18 08:58:16 +00:00
Hans Wennborg f99d04f841 Suggest %zu for size_t args to printf.
For PR11152. Make PrintSpecifier::fixType() suggest "%zu" for size_t, etc.
rather than looking at the underlying type and suggesting "%llu" or other
platform-specific length modifiers. Applies to C99 and C++11.

llvm-svn: 142342
2011-10-18 08:10:06 +00:00
David Blaikie cc5f8f0d9e Switch to the C++11 warning flags in tests.
Patch by Ahmed Charles!

llvm-svn: 142340
2011-10-18 05:54:07 +00:00
David Blaikie 8317245f9c Update documentation to use "C++11" instead of "C++0x"
llvm-svn: 142339
2011-10-18 05:49:30 +00:00
Douglas Gregor d793e7c3f7 Don't format the code completion for parameters of block literal
arguments as block literal arguments; the block literal argument code
completion should only go one level deep. Fixes <rdar://problem/10291294>.

llvm-svn: 142335
2011-10-18 04:23:19 +00:00
Richard Smith 83c19296ff Add -Wc++11-compat warning for an inline specifier on an explicit instantiation.
llvm-svn: 142333
2011-10-18 03:44:03 +00:00
Douglas Gregor f333f8c40d When transforming the arguments for a C++ "new" expression, make sure
to drop the implicitly-generated value initialization expression used
for initializing scalars. Fixes <rdar://problem/10283928>.

llvm-svn: 142330
2011-10-18 02:43:19 +00:00
Richard Smith 050d261ec7 Refactor the checking for explicit template instantiations being performed in
the right namespace in C++11 mode. Teach the code to prefer the 'must be in
precisely this namespace' diagnostic whenever that's true, and fix a defect
which resulted in the -Wc++11-compat warning in C++98 mode sometimes being
omitted.

llvm-svn: 142329
2011-10-18 02:28:33 +00:00
John McCall 43d4dd49bf Argyrios says this change is required for safety under PTH.
Me, I believe him.

llvm-svn: 142327
2011-10-18 01:36:41 +00:00
Eli Friedman 66005df1f1 Revert accidental commit.
llvm-svn: 142326
2011-10-18 01:18:41 +00:00
Eli Friedman 5e9534b0ae Rewrite parts of MS ABI C++ layout. Based on work by r4start; I ended up doing this while I was trying to review his patch.
llvm-svn: 142325
2011-10-18 00:55:28 +00:00
John McCall 95ff270ee9 Fix several bugs with #pragma clang arc_cf_code_audited and macros.
llvm-svn: 142324
2011-10-18 00:44:04 +00:00
Argyrios Kyrtzidis 697729a7de Revert r142311, -mios-simulator-version-min does not work correctly.
llvm-svn: 142322
2011-10-18 00:22:49 +00:00
John McCall 1bb357929d In hasPlaceholderType(Kind) and isSpecificPlaceholderType(Kind), assert
that the parameter is actually a placeholder type kind.

llvm-svn: 142312
2011-10-17 23:48:15 +00:00
Argyrios Kyrtzidis 7e16493c9b Remove the hack where we sniff the __IPHONE_OS_VERSION_MIN_REQUIRED define.
We can use -mios-simulator-version-min now. rdar://10218700

llvm-svn: 142311
2011-10-17 23:41:26 +00:00
Richard Smith 9fcc5c31c4 Perform lvalue-to-rvalue conversions on __builtin_offsetof array argument index
before typechecking, as suggested by John.

llvm-svn: 142308
2011-10-17 23:29:39 +00:00
Argyrios Kyrtzidis ffe8b1c7be [arcmt] In ARC default for properties is 'strong' so just remove a 'retain' if possible,
instead of changing it to 'strong'. rdar://9984862.

llvm-svn: 142304
2011-10-17 23:14:16 +00:00
Richard Smith b15c11c819 Add -Wc++98-compat warnings for uses of the new keywords 'alignof', 'char16_t',
'char32_t', 'constexpr', 'decltype', 'noexcept', 'nullptr' and 'static_assert'.

llvm-svn: 142302
2011-10-17 23:06:20 +00:00
Nick Lewycky 1d617acef9 Wire up support for the controlling the extended dwarf .file directive. With
r142300 but not this patch, clang -S may emit .s files that assemblers other
than llvm-mc can't parse.

llvm-svn: 142301
2011-10-17 23:05:52 +00:00
Matt Beaumont-Gay cb6e5c16ef Silence a -Wc++0x-narrowing warning
llvm-svn: 142292
2011-10-17 22:19:09 +00:00
Rafael Espindola 70b8d76e64 Implement -static-libstdc++ for linux.
llvm-svn: 142290
2011-10-17 22:14:51 +00:00
Argyrios Kyrtzidis 317ebfe18e Try fixing MSVC compiler errors.
llvm-svn: 142289
2011-10-17 22:12:24 +00:00
Eli Friedman cc66a2b067 Add missing newline.
llvm-svn: 142285
2011-10-17 21:48:31 +00:00
Ted Kremenek a08713ce86 Move about 20 random diagnostics under -W flags. Patch by Ahmed Charles!
llvm-svn: 142284
2011-10-17 21:47:53 +00:00
Eli Friedman a4c2602b71 Initial implementation of __atomic_is_lock_free. The input is the size of an atomic type rather than an atomic type itself just to save some implementation pain; I can change that if it seems worthwhile.
I think this is the last hook needed for <atomic> besides defines for ATOMIC_CHAR_LOCK_FREE and friends.

llvm-svn: 142281
2011-10-17 21:44:23 +00:00
Rafael Espindola cc35432550 Implement -static-libgcc on linux and refactor the code responsible for adding
libgcc to the link line into a helper function.

llvm-svn: 142269
2011-10-17 21:39:04 +00:00
DeLesley Hutchins 30abeb1680 Substitute for arguments in method calls -- functionality
llvm-svn: 142267
2011-10-17 21:38:02 +00:00
DeLesley Hutchins a088f67bee Substitute for arguments in method calls -- refactoring
llvm-svn: 142260
2011-10-17 21:33:35 +00:00
Richard Smith b12bf69769 Refactor __attribute__ parsing, and add a diagnostic if the r_paren at the end
of an attrib is missing. gcc does not allow the closing parenthesis to be omitted.

llvm-svn: 142255
2011-10-17 21:20:17 +00:00
Benjamin Kramer 9941d72d05 Code completion chunks are pod-like.
llvm-svn: 142252
2011-10-17 21:17:53 +00:00
Tanya Lattner 49b3841398 The comparison of two vectors should return a signed result. hasIntegerRepresentation() used to always return false for vectors, but since it was changed, it also
changed the return type of a compare of two unsigned vectors to be unsigned. This patch removes the check for hasIntegerRepresentation since its not needed and returns the appropriate signed type.
I added a new test case and updated exisiting test cases that assumed an unsigned result.

llvm-svn: 142250
2011-10-17 21:00:38 +00:00
Fariborz Jahanian 502d2eee09 obj-c++: Fix a IRGen crash when getter is a reference type.
Fix is in Sema. // rdar://10153365

llvm-svn: 142249
2011-10-17 21:00:22 +00:00
Eli Friedman 15b1a7be1e Add missing case to switch.
llvm-svn: 142246
2011-10-17 20:46:28 +00:00
John McCall 444bd25dff Strip qualifiers off the type of an implicit property defined by
only a setter.

llvm-svn: 142236
2011-10-17 20:05:43 +00:00
Argyrios Kyrtzidis dc199a3152 [libclang] Introduce a new high level API for indexing clients that assumes
more of the work involved in indexing a translation unit and simplifies client
implementations.

Only C/ObjC for now, C++ (and comments) to come.

llvm-svn: 142233
2011-10-17 19:48:19 +00:00
Argyrios Kyrtzidis bd8b150dfc Introduce ASTConsumer::HandleTopLevelDeclInObjCContainer which accepts
top-level declarations that occurred inside an ObjC container.

This is useful to keep track of such decls otherwise when e.g. a function
is declared inside an objc interface, it is not passed to HandleTopLevelDecl
and it is not inside the DeclContext of the interface that is returned.

llvm-svn: 142232
2011-10-17 19:48:13 +00:00
Argyrios Kyrtzidis 690dccd9d4 Have ObjCMethodDecl::getCanonicalDecl take into account redeclared methods.
llvm-svn: 142231
2011-10-17 19:48:09 +00:00
Argyrios Kyrtzidis 1f4bee5601 Keep track when a ObjC interface/protocol was initially created as a forward reference.
llvm-svn: 142230
2011-10-17 19:48:06 +00:00
Douglas Gregor 7d75bf652b Controlling macros are identifiers, not declarations.
llvm-svn: 142225
2011-10-17 18:53:12 +00:00
John McCall 4124c4924d Teach the ARC compiler to not require __bridge casts when
passing/receiving CF objects at +0 to/from Objective-C methods
or audited C functions.

llvm-svn: 142219
2011-10-17 18:40:02 +00:00
John McCall 8a6b59ad97 Add a new placeholder type to represent "unbridged"
casts in ARC.

No semantic analysis yet.

llvm-svn: 142208
2011-10-17 18:09:15 +00:00
John McCall a072f5d454 Add a helper function for determining whether an expression
has placeholder type.

llvm-svn: 142203
2011-10-17 17:42:19 +00:00
Douglas Gregor 50cefbf212 When we end up having to parse the initializer of a C++ member early
in -fms-extensions mode, make sure we actually use that initializer
after having handled the declaration. Fixes PR11150.

llvm-svn: 142195
2011-10-17 17:09:53 +00:00
Sebastian Redl 962070d49c Revert r142142: "Make a C-style cast a const-cast, to suppress a GCC warning."
Richard already fixed the underlying issue, so the cast was superfluous.

llvm-svn: 142192
2011-10-17 16:53:50 +00:00
Douglas Gregor ebf0049901 For modules, all macros that aren't include guards are implicitly
public. Add a __private_macro__ directive to hide a macro, similar to
the __module_private__ declaration specifier.

llvm-svn: 142188
2011-10-17 15:32:29 +00:00
Douglas Gregor 71129d5e9e When building a module, use the macro definitions on the command line
as part of the hash rather than ignoring them. This means we'll end up
building more module variants (overall), but it allows configuration
macros such as NDEBUG to work so long as they're specified via command
line. More to come in this space.

llvm-svn: 142187
2011-10-17 14:55:37 +00:00
Erik Verbruggen fd979b1eaf Fixed merge-mistake where ActOnAccessSpecifier was called twice for every access specifier. The testcase has been changed to catch this too.
llvm-svn: 142186
2011-10-17 09:54:52 +00:00
Richard Smith eda61288ad Perform an lvalue-to-rvalue conversion on an array index in a __builtin_offsetof expression.
llvm-svn: 142179
2011-10-17 05:48:07 +00:00
Richard Smith 00ab3ae72b Slightly simplify a constant expression check. No functional change.
llvm-svn: 142167
2011-10-16 23:01:09 +00:00
Chandler Carruth 01ca696581 Add a testcase for r142121 based on an idea from Richard Smith. Thanks!
llvm-svn: 142160
2011-10-16 21:33:06 +00:00
Richard Smith 725810a2bb Split apart the state accumulated during constant expression evaluation and the
end result. Use this split to propagate state information and diagnostics
through more of constant expression evaluation.

llvm-svn: 142159
2011-10-16 21:26:27 +00:00
Peter Collingbourne 5aa6ecb619 Add sema checks for calls to functions taking static array parameters
llvm-svn: 142157
2011-10-16 21:17:32 +00:00
Sebastian Redl b17be8dcfe Implement overload resolution from init lists for scalar parameter types.
llvm-svn: 142148
2011-10-16 18:19:34 +00:00
Sebastian Redl 8b6412af46 Diagnose when omitting braces in direct list-initialization in C++0x.
This also applies to C99-style aggregate literals, should they be used in C++11, since they are effectively identical to constructor call list-initialization syntax.

llvm-svn: 142147
2011-10-16 18:19:28 +00:00
Sebastian Redl 2b47b7a3e6 In the verify-only pass, check that items that don't have an initializer in an init list can be value-initialized, at least when designated initializers are not involved. No test case yet, since early failures cannot be distinguished from late failures until overload resolution works.
llvm-svn: 142146
2011-10-16 18:19:20 +00:00
Sebastian Redl 5999aec4e1 Check for unavailable declarations in Sema::CanUseDecl.
llvm-svn: 142145
2011-10-16 18:19:16 +00:00
Sebastian Redl b92a877e31 Prove that non-overloaded function calls using init list arguments work.
llvm-svn: 142144
2011-10-16 18:19:11 +00:00
Sebastian Redl cc152641c0 Drop the Diagnose parameter from Sema::PerformImplicitConversion again and instead use TryImplicitConversion in CheckSingleAssignmentConstraints when that function is in no-diagnostics mode.
llvm-svn: 142143
2011-10-16 18:19:06 +00:00
Sebastian Redl 47fa9a346d Make a C-style cast a const-cast, to suppress a GCC warning. I should fix the underlying issue eventually, but this interface will probably change anyway.
llvm-svn: 142142
2011-10-16 18:18:59 +00:00
David Blaikie e4e9766e3c Remove the leftover partial comment.
llvm-svn: 142138
2011-10-16 14:41:13 +00:00
Chandler Carruth 5f9a44f3e9 Fix a silly bug introduced in r142133.
llvm-svn: 142134
2011-10-16 11:05:04 +00:00
Chandler Carruth a7b4414ac2 Clean up some cruft in the library path searching logic by making
'libdir' mean the actual library directory, not the GCC subdirectory of
the library directory. That was just a confusing pattern. Instead,
supply proper GCC subdirectories when scanning for various triple-based
subdirectories with a GCC installation in them. This also makes it much
more obvious how multiarch installations, which have a triple-based
prefix as well as suffix work.

Also clean up our handling of these triple-prefixed trees by using them
in both a multiarch pattern and a non-multiarch pattern whenever they
exist.

Note that this *does not* match what GCC does on Debian, the only truly
multiarch installation I've been able to get installed and test on. GCC
appears to have a bug, and ends up searching paths like
'/lib/../../lib32' which makes no sense what-so-ever. Instead, I've
tried to encode the rational logic that seems clearly intended by GCC's
pattern. GCC ends up with patterns like:

  /lib/../../lib32
  /usr/lib/../../lib32
  /usr/lib/x86_64-linux-gnu/../..lib32

Only the last one makes any sense having a '/../..' in it, so in Clang,
that's the only one which gets a '/../..' in it.

I *think* this will fix Debian multiarch links. I'm committing without
baking this logic into our test suite so I can test on a few different
systems. If all goes well (and no one screams) I'll check in some more
comprehensive tests for multiarch behavior tomorrow.

llvm-svn: 142133
2011-10-16 10:54:30 +00:00
Benjamin Kramer e06b2b7012 Convert inline asm source ranges into clang SourceRanges and print them with the instantiated note.
t.c:2:7: error: invalid operand for instruction
  asm("movl 0(%rax), 0(%edx)");
      ^
<inline asm>:1:16: note: instantiated into assembly here
        movl 0(%rax), 0(%edx)
                      ^~~~~~~
1 error generated.

llvm-svn: 142131
2011-10-16 10:48:28 +00:00
Chandler Carruth 454de773e1 I fixed this with r142127; these notes now make sense even w/o the caret.
llvm-svn: 142129
2011-10-16 09:41:04 +00:00
Chandler Carruth 724a1ca207 Hoist the logic I added to compute the macro name into a helper
function. No functionality changed.

llvm-svn: 142128
2011-10-16 09:39:09 +00:00