Commit Graph

25403 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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 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
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 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
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 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