Commit Graph

38219 Commits

Author SHA1 Message Date
Peter Collingbourne aac265cc78 OpenCL: Fix vector conditional operator CodeGen for the case where
the operands are vectors of doubles.

llvm-svn: 157596
2012-05-29 00:35:18 +00:00
Benjamin Kramer 938a71ff18 Fix suspicous isIntegerType() check, found by PVS Studio (PR12357).
llvm-svn: 157593
2012-05-28 21:01:59 +00:00
David Blaikie 7e64fd9d53 Address minor FIXME in RedeclLink to contain a PointerIntPair instead of derive from it.
Use actual factory functions rather than derived classes acting as named constructors/factories.

llvm-svn: 157588
2012-05-28 19:38:42 +00:00
Charles Davis 6770dea704 Fix mangling of integral template arguments between 1 and 10. Add a test case
for this. Reported by Timur Iskhodzhanov.

llvm-svn: 157583
2012-05-28 16:53:33 +00:00
Charles Davis ee855f06e7 Fix Lang's fix. This should fix the tests for +Asserts builds.
llvm-svn: 157561
2012-05-28 03:54:22 +00:00
Chris Lattner a2db6f2bd8 adjust to mainline llvm API change.
llvm-svn: 157557
2012-05-28 01:47:53 +00:00
David Blaikie c4c0e8aa9a Fix PR12960 by not attempting to correct cases when we're not actually instantiatiating a template.
This comes up in the begin/end calls of a range-for (see the included test
case). Other suggestions are welcome, though this seems to do the trick without
regressing anything.

llvm-svn: 157553
2012-05-28 01:26:45 +00:00
Charles Davis 7fb195b683 Test case for 157547. Before that patch, all the digits would be mangled
as zeroes. Now the digits are properly non-zero.

llvm-svn: 157552
2012-05-28 00:43:56 +00:00
Benjamin Kramer ea388a2832 PR12962: Fix a rare use after free when collecting virtual overrides.
The DenseMap reallocates after 64 insertions so this only happened in
large test cases under very specific circumstances.

llvm-svn: 157549
2012-05-27 22:41:08 +00:00
Lang Hames 6ccb51130e Fix call to APSInt constructor - it doesn't take an initial value, just a
bitwidth and signedness. Also rename the variable to reflect its purpose.

No test case - discovered during random code exploration.

llvm-svn: 157547
2012-05-27 21:39:49 +00:00
Fariborz Jahanian f021889036 -Wdeprecated warning to include reference (as a note)
to the declaration in this patch. // rdar://10893232

llvm-svn: 157537
2012-05-27 16:59:48 +00:00
Benjamin Kramer 443488eba9 Pass ProgramStateRef by reference.
Retain + Release on a ref counted pointer is cheap, but not free (it adds a function call in this case).

llvm-svn: 157534
2012-05-27 15:32:10 +00:00
Dmitri Gribenko 34983f25c6 Close HTML tag properly.
llvm-svn: 157533
2012-05-27 14:08:44 +00:00
Benjamin Kramer b33ffee04f Use the SelectorSet typedef more widely throughout Sema.
While there make it a SmallPtrSet.

llvm-svn: 157532
2012-05-27 13:28:52 +00:00
Benjamin Kramer 69b5a60d96 Replace some custom hash combines with the standard stuff from DenseMapInfo.
llvm-svn: 157531
2012-05-27 13:28:44 +00:00
NAKAMURA Takumi 42e5ac409c clang/unittests/Tooling/RewriterTestContext.h: Don't try to remove TemporaryDirectory.
llvm-svn: 157530
2012-05-27 13:10:14 +00:00
NAKAMURA Takumi ce6ad6748a clang/lib/Rewrite/Rewriter.cpp: Don't try to rename opened files on Win32. Win32 doesn't allow rename/removing opened files.
llvm-svn: 157528
2012-05-27 12:59:58 +00:00
Charles Davis 5511dfb399 Mangle template instantiations properly (as of VC 7.x) when compiling for
the Microsoft Visual C++ ABI. Currently limited to type and integral
non-type arguments. Based on a patch by Timur Iskhodzhanov!

llvm-svn: 157524
2012-05-26 23:12:19 +00:00
Benjamin Kramer 7b01b578a9 Only emit one set of braces for __VERSION__, getClangFullRepositoryVersion already adds some.
No test as the output is highly dependend on the local configuration.

llvm-svn: 157520
2012-05-26 19:39:52 +00:00
Fariborz Jahanian f3b7681f2b Change warning to error when property setter names conflict.
// rdar://11528439

llvm-svn: 157517
2012-05-26 16:10:06 +00:00
Richard Smith 1bb8edb8ac In response to some discussions on IRC, tweak the wording of the new
-Wsometimes-uninitialized diagnostics to make it clearer that the cause
of the issue may be a condition which must always evaluate to true or
false, rather than an uninitialized variable.

To emphasize this, add a new note with a fixit which removes the
impossible condition or replaces it with a constant.

Also, downgrade the diagnostic from -Wsometimes-uninitialized to
-Wconditional-uninitialized when it applies to a range-based for loop,
since the condition is not written explicitly in the code in that case.

llvm-svn: 157511
2012-05-26 06:20:46 +00:00
David Blaikie 3d8edc24c7 Fix indentation.
llvm-svn: 157510
2012-05-26 05:35:39 +00:00
Alexander Kornienko 246e85ddb0 Don't offer '[[clang::fallthrough]];' fix-it when a fall-through occurs to a
switch label immediately followed by a 'break;'.

llvm-svn: 157508
2012-05-26 00:49:15 +00:00
Nuno Lopes f491fbd715 fix codegen support for alloc_size attribute for static C++ methods
add test case for C++ codegen

llvm-svn: 157500
2012-05-25 21:45:08 +00:00
Argyrios Kyrtzidis e99b084cd7 [libclang] Add a test I forgot to commit for r156890.
llvm-svn: 157491
2012-05-25 20:05:57 +00:00
Rafael Espindola 67a498cc5f Don't ignore linkage when ignoring visibility in the instantiation of a
method template.

llvm-svn: 157486
2012-05-25 17:22:33 +00:00
Nuno Lopes 147dcd8c33 add CodeGen support for the alloc_size attribute
llvm-svn: 157483
2012-05-25 17:04:42 +00:00
Rafael Espindola 340941dc16 Don't ignore linkage when ignoring visibility in the instantiation of a
function template.

llvm-svn: 157480
2012-05-25 16:41:35 +00:00
Anna Zaks 6a65819ba3 [analyzer] Don't crash on LValBitCast
llvm-svn: 157478
2012-05-25 16:02:16 +00:00
Rafael Espindola a28bf63d9a Consider the linkage for member class templates even when we have to ignore
the visibility.

llvm-svn: 157475
2012-05-25 15:51:26 +00:00
Rafael Espindola 0cf10ac9ab When ignoring visibility in an instantiation, still consider the linkage.
Similar fixes for function and member template to follow as I write the
testcases.

llvm-svn: 157470
2012-05-25 14:47:05 +00:00
Rafael Espindola 4d71d0f9fa Whitespace fixes.
llvm-svn: 157469
2012-05-25 14:17:45 +00:00
Manuel Klimek 5d9e8362df Links the entry point to the tooling documentation into clang's menu bar.
llvm-svn: 157462
2012-05-25 08:39:21 +00:00
Richard Smith cff136cda8 Release notes update for -Wsometimes-uninitialized.
llvm-svn: 157459
2012-05-25 02:35:34 +00:00
Richard Smith 4323bf8e2e Split a chunk of -Wconditional-uninitialized warnings out into a separate flag,
-Wsometimes-uninitialized. This detects cases where an explicitly-written branch
inevitably leads to an uninitialized variable use (so either the branch is dead
code or there is an uninitialized use bug).

This chunk of warnings tentatively lives within -Wuninitialized, in order to
give it more visibility to existing Clang users.

llvm-svn: 157458
2012-05-25 02:17:09 +00:00
Anna Zaks 268f154f48 [analyzer] Loading external plugins with scan-build
Load custom plugins when running scan-build. This is useful when
additional static analysis Checkers must be provided via clang's plugin
interface.

Loading additional plugins can now be done via the scan-build call:
scan-build -load-plugin <plugin.so>

A patch by Thomas Hauth.

llvm-svn: 157452
2012-05-25 01:13:50 +00:00
Seth Cantrell 14340ca173 ensure value passed to is space is representable as unsigned char
if the value isn't an unsigned char or EOF behavior is undefined
(and on Windows there's an assertion)

llvm-svn: 157445
2012-05-25 00:03:29 +00:00
Richard Smith 3d31e8b280 Some cleanups around the uninitialized variables warning, and a FIXME. No functional change.
llvm-svn: 157440
2012-05-24 23:45:35 +00:00
Fariborz Jahanian c37a1d6e0f cleanup some code.
llvm-svn: 157436
2012-05-24 22:59:56 +00:00
Fariborz Jahanian 3f88afad2f objective-c: warn on use of property setters
backing two propeties because proprty names
match except for first letter being of different
case. // rdar://11528439, [PR12936].

llvm-svn: 157435
2012-05-24 22:48:38 +00:00
Eli Friedman c49c22642b Get rid of some non-ASCII en-dashes that crept in.
llvm-svn: 157434
2012-05-24 22:36:31 +00:00
Eli Friedman f798f65ccc Implement the C++11 discarded value expression rules for volatile lvalues. <rdar://problem/10790820>.
llvm-svn: 157420
2012-05-24 22:04:19 +00:00
Justin Holewinski c05323dd5c Un-XFAIL CodeGen/builtins-nvptx.c now that the proper changes have
landed in LLVM core

llvm-svn: 157418
2012-05-24 21:39:33 +00:00
Eli Friedman f92f6454ef A minor tweak to the new volatile lvalue warning: don't warn on "(void)x", where "x" refers to a local variable. This should silence a useless warning in compiler-rt and other places.
llvm-svn: 157414
2012-05-24 21:05:41 +00:00
John McCall d65dbd8e6a XFAIL this test, which does not pass on trunk since the grand
renaming in r157403.

llvm-svn: 157413
2012-05-24 20:58:21 +00:00
Ted Kremenek e1e89370f0 New & improved man page attached, now with standard license added.
Plus, a patch for scan-build.  

* mdoc corrections
* slightly more compact output
* same license as scan-build
* DESCRIPTION describes
* Default checkers corrected & explained
* Authors credited

The patch adds support for --help-checkers.  It just lists the default
checkers by recursively invoking "scan-build -h" and looking for the
magic '+' signs.  

Patch by James Lowden!

llvm-svn: 157411
2012-05-24 20:13:47 +00:00
Fariborz Jahanian 246f519a51 objective-c: Fixes a corner case and interesting bug.
Where diagnostic about unfound property is not
issued in the context where a setter is looked up
in situation in which name and property name differ 
in their first letter case. // rdar://11363363

llvm-svn: 157407
2012-05-24 18:29:41 +00:00
Argyrios Kyrtzidis bb2be0dca3 [objcmt] Add test case for r157395.
llvm-svn: 157404
2012-05-24 17:49:22 +00:00
Justin Holewinski 83e9668133 Replace PTX back-end with NVPTX back-end in all places where Clang cares
NV_CONTRIB

llvm-svn: 157403
2012-05-24 17:43:12 +00:00
Anna Zaks 6b7b7e66d1 [analyzer] Minor cleanup to checkers' help text.
llvm-svn: 157402
2012-05-24 17:31:59 +00:00
Anna Zaks d0867105f4 [analyzer] Treat cast of array to reference in the same way as array to
pointer.

Fixes one of the crashes reported in PR12874.

llvm-svn: 157401
2012-05-24 17:31:57 +00:00
Anna Zaks cb4c483dbe [analyzer] Fix typo. Thanks Jordy.
llvm-svn: 157400
2012-05-24 17:31:54 +00:00
Manuel Klimek 24c4805b3b Adds menu sidebar to the docs.
llvm-svn: 157399
2012-05-24 17:16:23 +00:00
Manuel Klimek b76810fa94 Updates the tooling docs with the links to the tutorials and
adds the menu include.

llvm-svn: 157397
2012-05-24 17:09:10 +00:00
Manuel Klimek 3115e3d171 Adds a tutorial for how to write clang plugins.
llvm-svn: 157396
2012-05-24 17:07:18 +00:00
Argyrios Kyrtzidis b482260748 [objcmt] Warn when modern objc migrator does not convert a NSNumber message because it requires a cast.
rdar://11525138

llvm-svn: 157395
2012-05-24 16:48:23 +00:00
Fariborz Jahanian 870265636c objc: change option to be -Wobjc-interface-ivars
llvm-svn: 157394
2012-05-24 16:19:51 +00:00
Manuel Klimek 9ffebff74c Apply review comment from Jordan Rose.
llvm-svn: 157387
2012-05-24 12:46:43 +00:00
Bill Wendling 2495bca543 Remove 3.1 release notes to get ready for current development cycle.
llvm-svn: 157379
2012-05-24 06:42:56 +00:00
Seth Cantrell ac6fb8f9f6 fix Bug 12924
http://llvm.org/bugs/show_bug.cgi?id=12924

This issue was that the source location was pointing to a
non-printable character and so CaretEnd was pointing one
_column_ past the caret but not one _character_ past the
caret. So the conversion between column and byte locations
wasn't working (because the conversion is only valid from
the first column or byte of a character).

llvm-svn: 157372
2012-05-24 05:14:44 +00:00
Richard Smith ce4f608f86 DR1152 / PR12931 / PR6177: A candidate function which requires binding a const
volatile reference to a temporary is not viable. My interpretation is that
DR1152 was a bugfix, not a rule change for C++11, so this is not conditional on
the language mode. This matches g++'s behavior.

llvm-svn: 157370
2012-05-24 04:29:20 +00:00
Eli Friedman c11535c248 Add a warning to diagnose statements in C++ like "*(volatile int*)x;". Conceptually, this is part of -Wunused-value, but I added a separate flag -Wunused-volatile-lvalue so it doesn't get turned off by accident with -Wno-unused-value. I also made a few minor improvements to existing unused value warnings in the process. <rdar://problem/11516811>.
llvm-svn: 157362
2012-05-24 00:47:05 +00:00
Nuno Lopes 5c7ad16fdd implement Sema support for the alloc_size attribute
Portions of this patch by Xi Wang. Reviewed by Jordy Rose. Thank you both.

Codegen support will follow soon.

llvm-svn: 157360
2012-05-24 00:22:00 +00:00
Fariborz Jahanian 9b43c3f0c5 modern objc translation: Add translation of @autoreleasepool
statement. // rdar://11474836.

llvm-svn: 157359
2012-05-23 23:47:20 +00:00
Argyrios Kyrtzidis 03a384ec1f [libclang] Report CXType_ObjCId for 'const id', not CXType_Typedef.
rdar://11357807

llvm-svn: 157356
2012-05-23 23:30:16 +00:00
NAKAMURA Takumi 5ad41dab52 clang/test/Tooling: Update comments in left 2 tests on XFAIL. They are incompatible to -fms-compatibility.
llvm-svn: 157352
2012-05-23 22:24:33 +00:00
NAKAMURA Takumi 2e8124b6df clang/test/Tooling: Tweak 4 tests to escape the path separator s/\\/\\\\/g in JSON.
llvm-svn: 157351
2012-05-23 22:24:27 +00:00
NAKAMURA Takumi 9b2d17c613 Tooling: Canonicalize Key in IndexByFile[]. llvm::sys::path::native() may be used here.
It fixes test/Tooling on Win32 hosts.

llvm-svn: 157350
2012-05-23 22:24:20 +00:00
Argyrios Kyrtzidis 0b21d82437 [arcmt] Remove an unused -autorelease, without failing with error, for this
idiom that is used commonly in setters:

   [backingValue autorelease];
   backingValue = [newValue retain]; // in general a +1 assign

rdar://9914061

llvm-svn: 157347
2012-05-23 21:50:04 +00:00
Chad Rosier 37a12af0af [driver] Have the crash diagnostics print the clang version information.
rdar://11518308

llvm-svn: 157346
2012-05-23 21:38:47 +00:00
Ted Kremenek 4ab452d061 Update checker build.
llvm-svn: 157339
2012-05-23 19:57:38 +00:00
Manuel Klimek 3f00134c05 Adds the Refactoring library, which is a layer on top of the Tooling library
that allows easy refactoring across translation units.

llvm-svn: 157331
2012-05-23 16:29:20 +00:00
Richard Smith 47ad017191 Correct the starting location for instantiations of field declarations which
start with a cv-qualifier. DeclaratorDecl::getTypeSpecStartLoc() does not
produce the location of the first type-specifier (the cv-qualifier) in this
case, because we don't track source locations for cv-qualifiers.

No test here: I've not found a way to test this with a lit-style test, and
introducing a gtest test for this seems unwarranted. Suggestions welcome!

Patch by Daniel Jasper!

llvm-svn: 157311
2012-05-23 04:22:22 +00:00
Richard Smith 01ade177e9 If the first argument of __builtin_object_size can be folded to a constant
pointer, but such folding encounters side-effects, ignore the side-effects
rather than performing them at runtime: CodeGen generates wrong code for
__builtin_object_size in that case.

llvm-svn: 157310
2012-05-23 04:13:20 +00:00
Richard Smith 607d631d64 Clang 3.1 is out: turn the relevant C++11 status boxes green.
llvm-svn: 157308
2012-05-23 01:38:11 +00:00
Eric Christopher 9cc59f66ad Move file to be more representative.
llvm-svn: 157306
2012-05-23 00:18:46 +00:00
Eric Christopher 41f556b709 Check that we have an unknown upper bound range for our flexible array members.
llvm-svn: 157305
2012-05-23 00:18:43 +00:00
Eric Christopher a91af14b8d Emit C++11 enum class information if it exists.
Part of rdar://11496790

llvm-svn: 157304
2012-05-23 00:09:47 +00:00
John McCall 8d32c05ed4 Recognize the MS inheritance attributes and turn them into attributes
on the RecordDecl.  Persist the MS portability type attributes and
ignore them in Sema rather than the parser.

Patch by João Matos!

llvm-svn: 157288
2012-05-22 21:28:12 +00:00
John McCall fa6cf4cc9a Fix line endings.
llvm-svn: 157287
2012-05-22 21:28:07 +00:00
Eric Christopher 8b3304da56 Test that we emit a subrange type for vlas.
Part of rdar://11457152

llvm-svn: 157269
2012-05-22 18:04:48 +00:00
Manuel Klimek d9c79e753b Fixes the autoconf build.
llvm-svn: 157266
2012-05-22 17:45:33 +00:00
Nuno Lopes a425589fea wire -fbounds-checking to the new LLVM bounds checking pass
llvm-svn: 157262
2012-05-22 17:19:45 +00:00
Manuel Klimek 78d084d942 Adds a method overwriteChangedFiles to the Rewriter. This is implemented by
first writing the changed files to a temporary location and then overwriting
the original files atomically.

Also adds a RewriterTestContext to aid unit testing rewrting logic in general.

llvm-svn: 157260
2012-05-22 17:01:35 +00:00
Nuno Lopes 2b1ff46ed1 revert the usage of the objectsize intrinsic with 3 parameters (to match LLVM r157255)
llvm-svn: 157256
2012-05-22 15:26:48 +00:00
Simon Atanasyan d45982cb00 Replace inline asm constraint "=a" by the more general constraint "=r".
That extend a range of platforms support this test case.

llvm-svn: 157247
2012-05-22 11:03:10 +00:00
Richard Smith ede15af699 Truthify a comment.
llvm-svn: 157232
2012-05-22 01:41:27 +00:00
Ted Kremenek f5958eb2b4 Fix typo.
llvm-svn: 157229
2012-05-22 00:54:40 +00:00
Ted Kremenek c53ed2e158 Use Perl prototypes instead of shift.
llvm-svn: 157228
2012-05-22 00:52:49 +00:00
Argyrios Kyrtzidis 94442980c0 [objcmt] Don't add redundant parentheses when migrating subscripting of an ivar.
rdar://11501256

llvm-svn: 157227
2012-05-22 00:47:53 +00:00
Ted Kremenek 2fe1ed3e0d Add basic delta-debugging script used for reducing analyzer crasher test cases.
llvm-svn: 157219
2012-05-21 23:29:01 +00:00
Fariborz Jahanian 945b2f46b1 objective-c: provide a useful 'fixit' suggestion when
errornously using commas to separate ObjC message arguments.
// rdar://11376372

llvm-svn: 157216
2012-05-21 22:43:44 +00:00
Eric Christopher 246bb99397 Revert r115805. An array type is required to have a range type,
however, the range can be unknown for the upper bound.

Testcase to follow.

Part of rdar://11457152

llvm-svn: 157212
2012-05-21 22:13:23 +00:00
Anna Zaks fc1d4bdc4f [analyzer] Bind UnknownVal to InitListExpr for unsupported types
(ex: float).

llvm-svn: 157211
2012-05-21 22:07:00 +00:00
Rafael Espindola 96dcb8d4bb Function template version of the previous patch.
llvm-svn: 157207
2012-05-21 20:31:27 +00:00
Rafael Espindola 93c289c28a Produce a hidden symbol for zed in
struct HIDDEN foo {
  };
  template <class P>
  struct bar {
  };
  template <>
  struct HIDDEN bar<foo> {
    DEFAULT static void zed();
  };
  void bar<foo>::zed() {
  }

Before we would produce a hidden symbol in

  struct HIDDEN foo {
  };
  template <class P>
  struct bar {
  };
  template <>
  struct bar<foo> {
    DEFAULT static void zed();
  };
  void bar<foo>::zed() {
  }

But adding HIDDEN to the specialization would cause us to produce a default
symbol.

llvm-svn: 157206
2012-05-21 20:15:56 +00:00
Argyrios Kyrtzidis 3169e80603 [driver] When creating the compiler invocation out of command-line
arguments, force use of clang frontend for the driver.

Fixes rdar://11356765.

llvm-svn: 157205
2012-05-21 20:11:54 +00:00
Benjamin Kramer 9bbf481f02 Analyzer: Fix PR12905, a crash when encountering a call to a function named "C".
While there clean up indentation.

llvm-svn: 157204
2012-05-21 19:40:38 +00:00
Argyrios Kyrtzidis 937bcb2de6 [arcmt] Revert r156999 "Remove the "it is not safe to remove an unused 'autorelease' message" ARC
migration error".

Per feedback from John this is useful to have in general.

llvm-svn: 157198
2012-05-21 17:48:31 +00:00
Fariborz Jahanian 19e09cb224 Remove unused argument in my last patch.
llvm-svn: 157194
2012-05-21 17:10:28 +00:00
Fariborz Jahanian b52d8d2e5f objective-c: When default synthesizing readonly IBOutlet properties
provide a 'fixit' to change 'readonly' to 'readwrite'. // rdar://11448209

llvm-svn: 157193
2012-05-21 17:02:43 +00:00
Rafael Espindola 85e91ba6f5 Test and document a difference from gcc in the handling of visibility
attributes.

llvm-svn: 157186
2012-05-21 14:22:37 +00:00
Benjamin Kramer a63d9531dd Unpack enums in CodeCompletetionResult.
In theory they should be wide enough even when the enum type is signed, but it
looks like MSVC9 still has problems with it.

llvm-svn: 157182
2012-05-21 10:42:01 +00:00
Peter Collingbourne c947aaeeae Teach Clang about the NVPTX backend.
llvm-svn: 157173
2012-05-20 23:28:41 +00:00
Peter Collingbourne 041ac6c2b1 Tell the driver that CUDA is a C++-like language, so that we get C++
header searches with CUDA.

llvm-svn: 157172
2012-05-20 23:28:36 +00:00
Peter Collingbourne c812d52790 CUDA: the device and host attributes must be inheritable, in order
to deal with NVIDIA's headers.  We'll need to think of another way
to handle multiple host/device definitions within the same TU.

llvm-svn: 157171
2012-05-20 23:28:32 +00:00
NAKAMURA Takumi c910b6d075 test/Tooling/clang-check-pwd.cpp: Mark as XFAIL:mingw for now. Fixing is work-in-progress.
llvm-svn: 157170
2012-05-20 22:28:03 +00:00
Peter Collingbourne f44bdf9c5f CUDA: add CodeGen support for global variable address spaces.
Because in CUDA types do not have associated address spaces,
globals are declared in their "native" address space, and accessed
by bitcasting the pointer to address space 0.  This relies on address
space 0 being a unified address space.

llvm-svn: 157167
2012-05-20 21:08:35 +00:00
Benjamin Kramer c25c0b9da5 Bitpack CodeCompletionResults.
llvm-svn: 157158
2012-05-20 14:19:46 +00:00
Jakob Stoklund Olesen 3923f1d8ca Fix test for 32-bit hosts.
llvm-svn: 157154
2012-05-20 06:43:46 +00:00
Nico Weber 1b7f39de3d Error when using typeid() with -fno-rtti. PR 12888.
llvm-svn: 157139
2012-05-20 01:27:21 +00:00
Eli Friedman 022900079b Zap a bogus assert for delegating constructors. PR12890, part 2.
I'm pretty sure we are in fact doing the right thing here, but someone who knows the standard better should double-check that we are in fact supposed to zero out the member in the given testcase.

llvm-svn: 157138
2012-05-20 00:46:05 +00:00
Eli Friedman a9e9ebcfb5 Make delegating initializers use a similar codepath to base initializers in dependent contexts. PR12890.
llvm-svn: 157136
2012-05-19 23:35:23 +00:00
Fariborz Jahanian 199a9b57a6 objective-c: Warn if default synthesizing readonly IBOutlet properties
and provide a 'fixit' to change 'readonly' to 'readwrite'. 'fixit'
part needs little more work. // rdar://11448209

llvm-svn: 157121
2012-05-19 18:17:17 +00:00
Dmitri Gribenko cb1f153d4c Missing line break.
llvm-svn: 157120
2012-05-19 17:20:59 +00:00
Dmitri Gribenko 898cff0bbd Use RecordDecl::field_iterator because D1, D2 are RecordDecls. No functional change.
llvm-svn: 157119
2012-05-19 17:17:26 +00:00
Benjamin Kramer 365082dbfa Apparently empty names are allowed here.
llvm-svn: 157117
2012-05-19 16:34:46 +00:00
Benjamin Kramer 1458c1c009 Simplify some users of DeclarationName::getNameKind. Fold getFETokenInfoAsVoid into its only caller.
llvm-svn: 157116
2012-05-19 16:03:58 +00:00
Benjamin Kramer 9012a09b1c Inline a trivial clear() method.
llvm-svn: 157114
2012-05-19 14:28:31 +00:00
Benjamin Kramer 30844fc708 Simplify code, add an assertion.
llvm-svn: 157111
2012-05-19 10:43:54 +00:00
Eric Christopher fe0913b026 Update API usage for llvm DIBuilder changes for rvalue reference
types and ensure we are actually creating the type.

rdar://11479676

llvm-svn: 157095
2012-05-19 01:36:50 +00:00
Anna Zaks 209bd25b3c [analyzer] c++11: do not crash on namespace alias
llvm-svn: 157089
2012-05-19 00:22:11 +00:00
Anna Zaks 94a7b849a2 [analyzer] For locations, use isGLValue() instead of isLValue().
llvm-svn: 157088
2012-05-19 00:22:07 +00:00
Kaelyn Uhrain 864d0b002c Suggest adding 'typename' when it would make the compiler
accept the template argument expression as a type.

llvm-svn: 157085
2012-05-18 23:42:49 +00:00
Anna Zaks 457ace7611 [analyzer] Fix a c++11 crash: xvalues can be locations (VisitMemberExpr)
llvm-svn: 157082
2012-05-18 22:47:43 +00:00
Anna Zaks b343660914 [analyzer] Malloc checker: remove unnecessary comparisons.
llvm-svn: 157081
2012-05-18 22:47:40 +00:00
Fariborz Jahanian d945ce5fb7 objc: use "class extension" instead of "continuation class"
to match documentation. // rdar://11309706

llvm-svn: 157074
2012-05-18 21:22:49 +00:00
Benjamin Kramer e5fbc6c85d Lexer::ReadToEndOfLine: Only build the string if it's actually used and do so in a less malloc-intensive way.
llvm-svn: 157064
2012-05-18 19:32:16 +00:00
Chad Rosier 30cb377cdf Typo.
llvm-svn: 157054
2012-05-18 16:56:52 +00:00
Rafael Espindola 3619104239 Centralize the handling of the "attribute declaration must precede definition"
warning. This also makes us warn on tags, which, ironically, is the only case
gcc warns on.

llvm-svn: 157039
2012-05-18 01:47:00 +00:00
Anna Zaks 46d01605ee [analyzer]Malloc: refactor and report use after free by memory
allocating functions.

llvm-svn: 157037
2012-05-18 01:16:10 +00:00
Fariborz Jahanian b4bef15ae6 Another test for r157025 <rdar://problem/11460990>.
llvm-svn: 157034
2012-05-18 00:19:25 +00:00
Douglas Gregor 0bf70f4be8 A selector match between two Objective-C methods does *not* guarantee
that the methods have the same number of parameters, although we
certainly assumed this in many places. Objective-C can be insane
sometimes. Fixes <rdar://problem/11460990>.

llvm-svn: 157025
2012-05-17 23:13:29 +00:00
Matt Beaumont-Gay 58b844aebf Remove trailing periods which snuck into a few diagnostic strings.
llvm-svn: 157022
2012-05-17 22:46:56 +00:00
Douglas Gregor c5928afb69 In the override search for Objective-C methods, protect against ASTs that have NULL interfaces behind a category, which can happen in invalid code. Fixes <rdar://problem/11478173>, a recent regression
llvm-svn: 157021
2012-05-17 22:39:14 +00:00
Benjamin Kramer 5aa585e672 Drop the question mark when complaining about a non-existing -Wno- flag.
We're certain that it doesn't exist.

llvm-svn: 157017
2012-05-17 21:14:26 +00:00
Chad Rosier dfb1097504 Add -mno-implicit-float to the M group.
llvm-svn: 157014
2012-05-17 20:53:37 +00:00
Argyrios Kyrtzidis 3d6439517c [arcmt] Remove the "it is not safe to remove an unused 'autorelease' message" ARC
migration error.

This is more trouble that it is worth; autoreleasing a value without holding on it
is a valid use-case, we should not "punish" correct code for the minority of
broken/fragile programs that depend on the behavior of  -autorelease.

rdar://9914061

llvm-svn: 156999
2012-05-17 18:16:05 +00:00
Chad Rosier 26ad6a4f60 [driver] Reword the warning message for missing value to a joined argument.
llvm-svn: 156993
2012-05-17 15:45:13 +00:00
Abramo Bagnara e1decdf68a Added two missing const qualifiers.
llvm-svn: 156988
2012-05-17 12:44:05 +00:00
Benjamin Kramer 1d373c6517 CXXThisScopeRAII objects aren't free, don't compute one if it's unused.
llvm-svn: 156987
2012-05-17 12:01:52 +00:00
Kostya Serebryany eddc05abfc [tsan] grammar fixes
llvm-svn: 156984
2012-05-17 08:49:14 +00:00
Matt Beaumont-Gay 32d825a4db Use the argument location instead of the format string location when warning
about argument type mismatch.

This gives a nicer diagnostic in cases like
  printf(fmt,
         i);
where previously the snippet just pointed at 'fmt' (with a note at the
definition of fmt).

It's a wash for cases like
  printf("%f",
         i);
where previously we snippeted the offending portion of the format string,
but didn't indicate which argument was at fault.

llvm-svn: 156968
2012-05-17 00:03:16 +00:00
Argyrios Kyrtzidis fbb2bb5a3d [libclang/AST] When declaring a local class, don't neglect to set the end location
of the DeclStmt node, otherwise libclang will not work for anything inside that
class.

rdar://10837710

llvm-svn: 156966
2012-05-16 23:49:15 +00:00
Chad Rosier 06fd3c61be [driver] Remove obsolete support for -A link option. The standard -A option is
used by the preprocessor.  Apple's GCC also supported a -A option for linking.

The ld man page has the following:
 -A basefile - Obsolete incremental load format.  This option is obsolete.

Nick Kledzik confirms this option is no longer needed/supported.
rdar://11455614

llvm-svn: 156965
2012-05-16 23:45:12 +00:00
Richard Smith 109d5ed96d Recover better from a missing 'typename' in a function template definition.
Disambiguate past such a potential problem, and use the absence of 'typename'
to break ties in favor of a parenthesized thingy being an initializer, if
nothing else in the declaration disambiguates it as declaring a function.

llvm-svn: 156963
2012-05-16 23:40:17 +00:00
David Blaikie 1f05227a3d SmallString Visual Studio visualizer by Will Wilson.
llvm-svn: 156959
2012-05-16 22:28:47 +00:00
NAKAMURA Takumi 01152f9c63 clang/test/Tooling: Remark as XFAIL again in 5 tests for msvc hosts.
FIXME: JSON doesn't like path separator '\', on Win32 hosts.
llvm-svn: 156957
2012-05-16 22:14:14 +00:00
Akira Hatanaka b08cb81f37 XFAIL this test on MIPS.
Since r156650, clang has stopped emitting byval arguments for MIPS targets.

llvm-svn: 156954
2012-05-16 22:06:47 +00:00
Eric Christopher de098cd08f Remove unnecessary temporary.
llvm-svn: 156953
2012-05-16 22:02:36 +00:00
Chad Rosier c14ded7182 Rename the driver option to -mno-implicit-float, per Eli's suggestion.
llvm-svn: 156950
2012-05-16 21:19:55 +00:00
Jordy Rose ea8f0319dc Add triples for test.
llvm-svn: 156949
2012-05-16 21:13:36 +00:00
Manuel Klimek 3ef9c44747 Pulls diagnostics for temp file handling into the common diagnostic kinds.
llvm-svn: 156947
2012-05-16 20:55:58 +00:00
Chad Rosier f1985d2a44 [driver] Allow the driver to directly accept the -no-implicit-float option, so that the
generation of implicit floating point instructions can be disable for ARM. 
rdar://11409142

llvm-svn: 156942
2012-05-16 20:40:09 +00:00
Jordy Rose 5934226067 [analyzer] Fix test for PR12206, which was failing on i386.
llvm-svn: 156941
2012-05-16 20:29:44 +00:00
Douglas Gregor 6cda0715c3 Add _alignof and __builtin_alignof as aliases for __alignof in
Microsoft mode, from Will Wilson!

llvm-svn: 156940
2012-05-16 20:04:05 +00:00
Chad Rosier e2d8fbbbf1 Tweek r156937 a bit so that the suggestions are correct.
llvm-svn: 156938
2012-05-16 19:42:03 +00:00
Chad Rosier 286852a10c Warn about -Wno-foo where foo is an unknown warning option. This is helpful
for subtle misspellings such as -Wno-unused-command-line-arguments instead of
-Wno-unused-command-line-argument.

Also fix the diagnostic messages to properly handle -Wno- options.  Previously,
the positive version was always emitted (i.e., -Wfoo was emitted for -Wno-foo).
rdar://11461500

llvm-svn: 156937
2012-05-16 19:28:02 +00:00
Argyrios Kyrtzidis a32a095920 [libclang] Properly handle @encode() in RecursiveASTVisitor and traverse
its type source info. Fixes indexing references inside @encode().

llvm-svn: 156936
2012-05-16 19:22:47 +00:00
Richard Trieu 2f7dc46a58 Move the warnings for extra semi-colons under -Wextra-semi. Also, added
a warning for an extra semi-colon after function definitions.  Added logic
so that a block of semi-colons on a line will only get one warning instead
of a warning for each semi-colon.

llvm-svn: 156934
2012-05-16 19:04:59 +00:00
Anna Zaks f8be8595ae [analyzer] Revert a regression committed in r156920.
This breaks the build with -triple i386-apple-darwin9.

llvm-svn: 156932
2012-05-16 18:46:25 +00:00
NAKAMURA Takumi faf78d5665 clang/test/Tooling: Remove XFAIL in 5 tests to unveil the real failure.
FYI, they can pass on Cygwin w/o any tweaks.

llvm-svn: 156930
2012-05-16 17:38:04 +00:00
NAKAMURA Takumi fe3fa7867e clang/test/Tooling/clang-check-pwd.cpp: Add "REQUIRES: shell".
This passes on MSYS bash and Cygwin.

llvm-svn: 156929
2012-05-16 17:37:56 +00:00
Douglas Gregor a8182f9b66 Clean up r156925, so that we only mark the capturing DeclRefExpr of a
lambda as referring to a local in an enclosing scope if we're in the
enclosing scope of the lambda (not it's function call operator). Also,
turn the test into an IR generation test, since that's where the
crashes occurred. Really fixes PR12746 / <rdar://problem/11465120>.

llvm-svn: 156926
2012-05-16 17:01:33 +00:00
Douglas Gregor 26b51746ec Fix code generation of variables reference expressions when mixing
blocks and lambdas, based heavily on a patch from Meador Inge. Fixes
PR12746 / <rdar://problem/11465120>.

llvm-svn: 156925
2012-05-16 16:50:20 +00:00
Douglas Gregor c48eafea50 Fix ASTReader handling of ImportDecls, from Meador Inge!
llvm-svn: 156923
2012-05-16 16:31:58 +00:00
Douglas Gregor 0a9f4e0b72 Use a llvm::SmallString rather than std::string for duplicate-case errors
llvm-svn: 156922
2012-05-16 16:11:17 +00:00
Jordy Rose 09e7c88940 [analyzer] Fix RUN lines for old XFAIL tests, one of which actually works.
llvm-svn: 156921
2012-05-16 16:01:14 +00:00
Jordy Rose 6d5a8caac3 [analyzer] Convert many existing tests to use clang_analyzer_eval.
llvm-svn: 156920
2012-05-16 16:01:10 +00:00
Jordy Rose 31ae259a41 [analyzer] Introduce clang_analyzer_eval for regression test constraint checks.
The new debug.ExprInspection checker looks for calls to clang_analyzer_eval,
and emits a warning of TRUE, FALSE, or UNKNOWN (or UNDEFINED) based on the
constrained value of its (boolean) argument. It does not modify the analysis
state though the conditions tested can result in branches (e.g. through the
use of short-circuit operators).

llvm-svn: 156919
2012-05-16 16:01:07 +00:00
Benjamin Kramer 96a44b61c3 StringSwitchify. No functionality change.
llvm-svn: 156916
2012-05-16 12:44:25 +00:00
Benjamin Kramer f435ab429b Factor sema for attributes unavailable and deprecated into a common function.
No functionality change.

llvm-svn: 156914
2012-05-16 12:19:08 +00:00
Kostya Serebryany e8d0a0bf5c [tsan] fix typo
llvm-svn: 156912
2012-05-16 08:19:13 +00:00
Chandler Carruth cc3123174c Clarify how libstdc++ and other bits of the system toolchain are found
on Linux in the getting started documentation.

Patch by Nathan Ridge.

llvm-svn: 156911
2012-05-16 08:18:58 +00:00
Kostya Serebryany f30e08d218 [tsan] first version of ThreadSanitizer docs
llvm-svn: 156910
2012-05-16 08:14:36 +00:00
Kostya Serebryany 66e8fab1c8 [tsan] add ThreadSanitizer linker flags on Linux and also copy the tsan-rt into the appropriate place at build time
llvm-svn: 156906
2012-05-16 06:36:00 +00:00
Douglas Gregor 9841df655e Produce more useful 'duplicate case' diagnostics. Fixes PR9243, from Terry Long!
llvm-svn: 156904
2012-05-16 05:32:58 +00:00
David Blaikie a5696dff5c Include the correct conversion context locations for condition expressions.
This improves the conversion diagnostics (by correctly pointing to the loop
construct for conversions that may've been caused by the contextual conversion
to bool caused by a condition expression) and also causes the NULL conversion
warnings to be correctly suppressed when crossing a macro boundary in such a
context. (previously, since the conversion context location was incorrect, the
suppression could not be performed)

Reported by Nico Weber as feedback to r156826.

llvm-svn: 156901
2012-05-16 04:20:04 +00:00
Rafael Espindola 96e6824c31 Fix the visibility of instantiations of static data members.
Fixes pr12835.

llvm-svn: 156897
2012-05-16 02:10:38 +00:00
Argyrios Kyrtzidis b7e4367fef [libclang/AST] Index references of protocols in "@protocol(...)" syntax.
To do that, keep track of the location of the protocol id in the ObjCProtocolExpr
AST node.

rdar://11190837

llvm-svn: 156890
2012-05-16 00:50:02 +00:00
Argyrios Kyrtzidis 8154147942 [objcmt] Accept char arrays for rewriting to @() syntax.
Part of rdar://11438360

llvm-svn: 156880
2012-05-16 00:21:21 +00:00
Anna Zaks 7a0d86be26 [analyzer] Add a test for dead stores, which uses OpaqueValExpr.
llvm-svn: 156875
2012-05-15 23:12:53 +00:00
Argyrios Kyrtzidis cebe722ef6 [objcmt] When using NSNumber numberWithInteger:/numberWithUnsignedInteger: be
more liberal in rewriting when the parameter is an enum constant.

Part of rdar://11438360

llvm-svn: 156873
2012-05-15 22:59:54 +00:00
Fariborz Jahanian 0ebc0fa974 objective-c: perform strict type checking on property
type and its accessor type and issue error if types
are incompatible, instead of crashing in IRgen.
// rdar://1105153

llvm-svn: 156871
2012-05-15 22:37:04 +00:00
Anna Zaks 58d986c866 [analyzer] Fix a regression in ObjCUnusedIVars checker.
We can no longer rely on children iterator to visit all the AST
tree children of an expression (OpaqueValueExpr has no children).

llvm-svn: 156870
2012-05-15 22:31:56 +00:00
Argyrios Kyrtzidis 7bd957c12a [objcmt] Rewrite messages to NSString's stringWithUTF8String:/stringWithCString:
to use the @() boxing syntax.

It will also rewrite uses of stringWithCString:encoding: where the encoding that is
used is NSASCIIStringEncoding or NSUTF8StringEncoding.

rdar://11438360

llvm-svn: 156868
2012-05-15 22:22:10 +00:00
David Blaikie 18e9ac7914 Don't warn when NULL is used within a macro but its conversion is outside a macro.
This fixes the included test case & was reported by Nico Weber.

It's a little bit nasty using the difference in the conversion context, but
seems to me like a not unreasonable solution. I did have to fix up the
conversion context for conditional operators (it seems correct to me to include
the context for which we're actually doing the comparison - across all the
nested conditionals, rather than the innermost conditional which might not
actually have the problematic implicit conversion at all) and template default
arguments (this is a bit of a hack, since we don't have the source location of
the '=' anymore, so I just used the start of the parameter - open to
suggestions there)

llvm-svn: 156861
2012-05-15 21:57:38 +00:00
Richard Smith edd124ec72 Typo.
llvm-svn: 156860
2012-05-15 21:42:17 +00:00
Richard Smith fe904f0c9c If we see a declaration which is either missing a type or has a malformed type,
and the thing we have has a scope specifier, and we're in a context that doesn't
allow declaring a qualified name, then the error is a malformed type, not a
missing type.

llvm-svn: 156856
2012-05-15 21:29:55 +00:00
Richard Smith a952ebbcee Don't use the implicit int rule for error recovery in C++. Instead, try to
disambiguate whether the type name was forgotten or mistyped.

llvm-svn: 156854
2012-05-15 21:01:51 +00:00
Douglas Gregor 9295df0569 Add the Objective-C runtime linking arguments after user-specified
linker arguments. Fixes <rdar://problem/11417441>. 

llvm-svn: 156853
2012-05-15 21:00:27 +00:00
Argyrios Kyrtzidis da6d7679e8 Add documentation about boxing enum types and a codegen test to make
sure we pick up the underlying type, per suggestion by Fariborz.

No functionality change.

llvm-svn: 156851
2012-05-15 20:45:35 +00:00
Gregory Szorc b25e3d143a [clang.py] Store reference to TranslationUnit in Cursor and Type
llvm-svn: 156846
2012-05-15 19:51:02 +00:00
Argyrios Kyrtzidis 491e4aed31 [objcmt] Rewrite [NSNumber numberWith*] messages to the new @() boxing syntax.
There are some caveats:
-If an implicit cast (e.g. int -> float for numberWithFloat:) was required, the message
 will not get rewritten
-If the message was with numberWithInteger:/numberWithUnsignedInteger:, which are very
 commonly used, be more liberal and allow the boxing syntax if the underlying type has
 same signedness and will not lose precision.

Part of rdar://11438360

llvm-svn: 156844
2012-05-15 19:17:49 +00:00
Argyrios Kyrtzidis 8e6951d81b Allow objc @() syntax for enum types.
Previously we would reject it as illegal using a value of
enum type and on ObjC++ it was illegal to use an enumerator
as well.

rdar://11454917

llvm-svn: 156843
2012-05-15 19:17:44 +00:00
Bob Wilson 16d939584b Do not link with Objective-C libraries with -nostdlib or -nodefaultlibs.
<rdar://problem/11433499>

llvm-svn: 156841
2012-05-15 18:57:39 +00:00
Douglas Gregor 4b5c9979b9 Add the output of "clang --version" to scan-build results, from Gerald Combs!
llvm-svn: 156834
2012-05-15 18:41:55 +00:00
Fariborz Jahanian 3da7775a6d objc: avoid duplicate diagnostics on certain type mismatches
between property and its backing ivar.

llvm-svn: 156832
2012-05-15 18:12:51 +00:00
Fariborz Jahanian e1ada58ef4 Remove word 'block' from option and diagnostic I added
in r156825.

llvm-svn: 156831
2012-05-15 17:43:16 +00:00
Jim Grosbach 490950a928 Allow MCCodeEmitter access to the target MCRegisterInfo.
Add MRI to the createMCCodeEmitter() call.

llvm-svn: 156830
2012-05-15 17:36:07 +00:00