Commit Graph

14199 Commits

Author SHA1 Message Date
Chandler Carruth 4e97337914 Rephrase the preprocessor test to directly use CC1 and not bother
testing any of the strange driver behavior. We already have some tiny
tests for the driver behavior, and I'm going to expand them greatly in
the next commit.

llvm-svn: 154290
2012-04-08 16:40:31 +00:00
Chandler Carruth f4725b468e FileCheck-ize this test.
llvm-svn: 154289
2012-04-08 16:40:30 +00:00
Richard Smith 4051ff7650 Don't forget to evaluate the subexpression in a null pointer cast. If we're
converting from std::nullptr_t, the subexpression might have side-effects.

llvm-svn: 154278
2012-04-08 08:02:07 +00:00
Francois Pichet 7ebc4c1910 ext_reserved_user_defined_literal must not default to Error in MicrosoftMode. Hence create ext_ms_reserved_user_defined_literal that doesn't default to Error; otherwise MSVC headers won't parse.
Fixes PR12383.

llvm-svn: 154273
2012-04-07 23:09:23 +00:00
Simon Atanasyan 571d7bde3c MIPS: Pass -mabi option to the assmbler when compile MIPS targets.
llvm-svn: 154270
2012-04-07 22:31:29 +00:00
John McCall 5dadb65e07 Fix several problems with protected access control:
- The [class.protected] restriction is non-trivial for any instance
    member, even if the access lacks an object (for example, if it's
    a pointer-to-member constant).  In this case, it is equivalent to
    requiring the naming class to equal the context class.
  - The [class.protected] restriction applies to accesses to constructors
    and destructors.  A protected constructor or destructor can only be
    used to create or destroy a base subobject, as a direct result.
  - Several places were dropping or misapplying object information.

The standard could really be much clearer about what the object type is
supposed to be in some of these accesses.  Usually it's easy enough to
find a reasonable answer, but still, the standard makes a very confident
statement about accesses to instance members only being possible in
either pointer-to-member literals or member access expressions, which
just completely ignores concepts like constructor and destructor
calls, using declarations, unevaluated field references, etc.

llvm-svn: 154248
2012-04-07 03:04:20 +00:00
NAKAMURA Takumi c4d558a43e test/lit.cfg: Please pass %INCLUDE% to clang.exe on Win32. MS-compatible clang may refer to %INCLUDE%. It fixes r154188.
llvm-svn: 154240
2012-04-07 01:02:53 +00:00
Chad Rosier 706c235013 [driver] In general, the driver claims redundant args and uses the last arg.
However, the '-x' option has special handling and wasn't following this
paradigm.  Fix it to do so by claiming the arg as we parse the '-x' option.
rdar://11203340

llvm-svn: 154231
2012-04-07 00:01:31 +00:00
David Blaikie 89f13cb5bf Remove "parse error" in favor of more descriptive diagnostics.
In a few cases clang emitted a rather content-free diagnostic: 'parse error'.
This change replaces two actual cases (template parameter parsing and K&R
parameter declaration parsing) with more specific diagnostics and removes a
third dead case of this in the BalancedDelimiterTracker (the ctor already
checked the invariant necessary to ensure that the diag::parse_error was never
actually used).

llvm-svn: 154224
2012-04-06 23:33:59 +00:00
Fariborz Jahanian 668b9e9c65 more testing of objc's dictionary literal translation.
llvm-svn: 154220
2012-04-06 22:51:48 +00:00
Douglas Gregor 31f55dced5 Implement support for null non-type template arguments for non-type
template parameters of pointer, pointer-to-member, or nullptr_t
type in C++11. Fixes PR9700 / <rdar://problem/11193097>.

llvm-svn: 154219
2012-04-06 22:40:38 +00:00
Fariborz Jahanian 4460e0f805 modern objective-c translation: support for
dictionary literals. This concludes // rdar://10803676

llvm-svn: 154218
2012-04-06 22:29:36 +00:00
Ted Kremenek a85f38ba3a Rework ExprEngine::evalLoad and clients (e.g. VisitBinaryOperator) so that when we generate a new ExplodedNode
we use the same Expr* as the one being currently visited.  This is preparation for transitioning to having
ProgramPoints refer to CFGStmts.

This required a bit of trickery.  We wish to keep the old Expr* bindings in the Environment intact,
as plenty of logic relies on it and there is no reason to change it, but we sometimes want the Stmt* for
the ProgramPoint to be different than the Expr* being used for bindings.  This requires adding an extra
argument for some functions (e.g., evalLocation).  This looks a bit strange for some clients, but
it will look a lot cleaner when were start using CFGStmt* in the appropriate places.

As some fallout, the diagnostics arrows are a bit difference, since some of the node locations have changed.
I have audited these, and they look reasonable.

llvm-svn: 154214
2012-04-06 22:10:18 +00:00
Simon Atanasyan 1e1e2e2d9a MIPS: Provide a correct path to the dynamic linker when build for MIPS 64-bit targets.
llvm-svn: 154200
2012-04-06 20:14:27 +00:00
DeLesley Hutchins 481d5abf45 Thread safety analysis: downgraded requirement that mutex expressions refer to a lockable type from error to warning.
llvm-svn: 154198
2012-04-06 20:02:30 +00:00
Fariborz Jahanian e110fe4ac7 modern objective-c translator: translate array literal
expressions. // rdar://10803676

llvm-svn: 154196
2012-04-06 19:47:36 +00:00
Simon Atanasyan 2390aa1813 MIPS: Pass -EB/-EL argument to the assembler according to selected endian when compile for MIPS targets.
llvm-svn: 154195
2012-04-06 19:15:24 +00:00
Jordy Rose c0230d7a35 [analyzer] Check that the arguments to NSOrderedSet creation methods are valid ObjC objects.
Patch by Sean McBride!

llvm-svn: 154194
2012-04-06 19:06:01 +00:00
Matt Beaumont-Gay 6fb26f8c7e Test for r154189/PR12481
llvm-svn: 154193
2012-04-06 18:47:27 +00:00
John McCall 76cc43a2a4 Use atexit when __cxa_atexit isn't available instead of adding a
global destructor entry.  For some reason this isn't enabled for
apple-kexts;  it'd be good to have documentation for that.

Based on a patch by Nakamura Takumi!

llvm-svn: 154191
2012-04-06 18:21:06 +00:00
John McCall ed7b27830d Fix a Sema invariant bug that I recently introduced involving
the template instantiation of statement-expressions.

I think it was jyasskin who had a crashing testcase in this area;
hopefully this fixes it and he can find his testcase and check it in.

llvm-svn: 154189
2012-04-06 18:20:53 +00:00
Jordy Rose 0e09facb85 Clear environment variables that might affect Clang before running tests.
llvm-svn: 154188
2012-04-06 18:14:01 +00:00
Patrick Beard acfbe9e1f2 Added a new attribute, objc_root_class, which informs the compiler when a root class is intentionally declared.
The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger
the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698>

llvm-svn: 154187
2012-04-06 18:12:22 +00:00
Simon Atanasyan 5e21c800e8 MIPS: Move tests check float ABI macros definitions to the more appropriate place.
llvm-svn: 154184
2012-04-06 17:51:49 +00:00
Chandler Carruth 69a125bf02 Fix using Clang as a cross compiler installed on a host machine and not
inside of a sysroot targeting a system+sysroot which is "similar" or
"compatible" with the host system. This shows up when trying to build
system images on largely compatible hardware as-if fully cross compiled.

The problem is that previously we *perfectly* mimiced GCC here, and it
turns out GCC has a bug that no one has really stumbled across. GCC will
try to look in thy system prefix ('/usr/local' f.ex.) into which it is
instaled to find libraries installed along side GCC that should be
preferred to the base system libraries ('/usr' f.ex.). This seems not
unreasonable, but it has a very unfortunate consequence when combined
with a '--sysroot' which does *not* contain the GCC installation we're
using to complete the toolchain. That results in some of the host
system's library directories being searched during the link.

Now, it so happens that most folks doing stuff like this use
'--with-sysroot' and '--disable-multilib' when configuring GCC. Even
better, they're usually not cross-compiling to a target that is similar
to the host. As a result, searching the host for libraries doesn't
really matter -- most of the time weird directories get appended that
don't exist (no arm triple lib directory, etc). Even if you're
cross-compiling from 32-bit to 64-bit x86 or vice-versa, disabling
multilib makes it less likely that you'll actually find viable libraries
on the host. But that's just luck. We shouldn't rely on this, and this
patch disables looking in the system prefix containing the GCC
installation if that system prefix is *outside* of the sysroot. For
empty sysroots, this has no effect. Similarly, when using the GCC
*inside* of the sysroot, we still track wherever it is installed within
the sysroot and look there for libraries. But now we can use a cross
compiler GCC installation outside the system root, and only look for the
crtbegin.o in the GCC installation, and look for all the other libraries
inside the system root.

This should fix PR12478, allowing Clang to be used when building
a ChromiumOS image without polluting the image with libraries from the
host system.

llvm-svn: 154176
2012-04-06 16:32:06 +00:00
DeLesley Hutchins 6f86004cbc Fixed scoping error for late parsed attributes in nested classes.
llvm-svn: 154173
2012-04-06 15:10:17 +00:00
Simon Atanasyan c3e45fece1 MIPS: Add tests for predefined macros for MIPS targets.
llvm-svn: 154168
2012-04-06 08:37:24 +00:00
David Blaikie 3697983e19 Fix diagnostic text for r154163.
llvm-svn: 154164
2012-04-06 06:28:32 +00:00
David Blaikie cbd8125a6a Restrict fixit for missing 'class' in template template parameters.
Based on Doug's feedback to r153887 this omits the FixIt if the following token
isn't syntactically valid for the context. (not a comma, '...', identifier,
'>', or '>>')

There's a bunch of work to handle the '>>' case, but it makes for a much more
pleasant diagnostic in this case.

llvm-svn: 154163
2012-04-06 05:26:43 +00:00
Anna Zaks e8628c5bc7 [analyzer]Fix false positive: pointer might escape through CG*WithData.
llvm-svn: 154156
2012-04-06 01:00:47 +00:00
Richard Smith a974688d35 Point the caret at the error for the 'expected namespace name' diagnostic in
a namespace alias declaration.

llvm-svn: 154138
2012-04-05 23:13:23 +00:00
Eli Friedman c1f0d5b873 Implement C90 pedantic warning for duplicate declaration specifiers which are duplicated via a typedef. Patch by Tim Northover.
llvm-svn: 154136
2012-04-05 22:47:34 +00:00
Eli Friedman 57a75390fc Properly implement the C rules for composite types for qualified pointers in conditionals. Patch by Tim Northover.
llvm-svn: 154134
2012-04-05 22:30:04 +00:00
Fariborz Jahanian c806b90717 objective-c: Don't warn when a category does not implement a method
declared in its adopted protocol when another category declares it  
because that category will implement it. // rdar://11186449

llvm-svn: 154132
2012-04-05 22:14:12 +00:00
Eric Christopher c465ce9e79 Enhance testing a bit to make sure that we're omitting the
getter and setter when they're synthesized with the default
names.

rdar://11179756

llvm-svn: 154130
2012-04-05 22:03:35 +00:00
Eric Christopher f3dd713bce Only emit the getter and setter names if they're not the default
synthesized ones. Reasonable debug info size reduction for objc.

rdar://11179756

llvm-svn: 154129
2012-04-05 22:03:32 +00:00
Eli Friedman 1fa36050ab Make the variant of __builtin_shufflevector that takes the shuffle indexes as a vector actually usable. Patch by David Neto. PR12465.
llvm-svn: 154128
2012-04-05 21:48:40 +00:00
Richard Smith d8b8effa6e Temporary workaround for bug#12457: turn the 'constexpr function never produces
a constant expression' error into a DefaultError ExtWarn, so that it can be
disabled and is suppressed in system headers. libstdc++4.7 contains some such
functions which we currently can't evaluate as constant expressions.

llvm-svn: 154115
2012-04-05 18:57:10 +00:00
Daniel Dunbar 3c9bc4dbdb [Lex] Add support for 'user specified system frameworks' (see test case).
- Developers of system frameworks need a way for their framework to be treated as a "system framework" during development. Otherwise, they are unable to properly test how their framework behaves when installed because of the semantic changes (in warning behavior) applied to system frameworks.

llvm-svn: 154105
2012-04-05 17:10:06 +00:00
David Blaikie 3a7efa2240 Improve & simplify diagnostic for missing 'class' in template template parameter.
Change suggested by Sebastian Redl on review feedback from r153887.

llvm-svn: 154102
2012-04-05 16:56:02 +00:00
Ted Kremenek 34ac1cf3cd Handle symbolicating a reference in an initializer expression that we don't understand.
llvm-svn: 154084
2012-04-05 05:56:31 +00:00
Ted Kremenek 00fa5968cb Teach ObjCContainersChecker that the array passed to CFArrayGetValueAtIndex might not be a symbolic value.
llvm-svn: 154083
2012-04-05 05:18:05 +00:00
Ted Kremenek 504957f413 Do not crash in the callgraph construction when encountering deleted function definitions. Fixes <rdar://problem/11178609>.
llvm-svn: 154081
2012-04-05 04:03:23 +00:00
Richard Smith fa0a1f531f Improve diagnostics for invalid use of non-static members / this:
* s/nonstatic/non-static/ in the diagnostics, since the latter form outvoted
  the former by 28-2 in our diagnostics.
* Fix the "use of member in static member function" diagnostic to correctly
  detect this situation inside a block or lambda.
* Produce a more specific "invalid use of non-static member" diagnostic for
  the case where a nested class member refers to a member of a
  lexically-surrounding class.

llvm-svn: 154073
2012-04-05 01:13:04 +00:00
Richard Smith 3cbdeba61a Add triples to these tests to keep them working on Windows,
where wchar_t is only 16 bits wide.

llvm-svn: 154072
2012-04-05 00:54:51 +00:00
Richard Smith 7ba85c3e78 Fix assertions and wrong output from StmtPrinter's string literal printing.
String literals (including unicode ones) can contain non-Unicode codepoints
if they were written using \x or similar. Write those out using \x, but be
careful that the following character can't be misinterpreted as part of the
\x escape sequence. Convert UTF-16 surrogate pairs back to codepoints before
rendering them.

llvm-svn: 154069
2012-04-05 00:17:44 +00:00
David Blaikie 09ffc9b473 Enable warn_impcast_literal_float_to_integer by default.
This diagnostic seems to be production ready, it's just an oversight that it
wasn't turned on by default.

The test changes are a bit of a mixed bag. Some tests that seemed like they
clearly didn't need to use this behavior have been modified not to use it.
Others that I couldn't be sure about, I added the necessary expected-warnings
to.

It's possible the diagnostic message could be improved to make it clearer that
this warning can be suppressed by using a value that won't lose precision when
converted to the target type (but can still be a floating point literal, such
as "bool b = 1.0;").

llvm-svn: 154068
2012-04-05 00:16:44 +00:00
NAKAMURA Takumi 2b9219eea1 clang/test/Tooling/clang-check.cpp: Mark it as XFAIL also on cygwin.
It seems clang-check doesn't like gcc driver on cygming. Investigating.

llvm-svn: 154066
2012-04-04 23:23:19 +00:00
Douglas Gregor 0f5c1c0127 Allow a conversion from the empty initializer list {} to an
std::initializer_list<T> so long as <T> is known. This conversion has
identity rank.

llvm-svn: 154065
2012-04-04 23:09:20 +00:00
Nico Weber bea0d04f8c Honor -fno-pic, -fno-PIC, -fno-pie, -fno-PIE.
Review at http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120402/055759.html

llvm-svn: 154064
2012-04-04 23:00:14 +00:00