Commit Graph

18421 Commits

Author SHA1 Message Date
Fariborz Jahanian 3caab6cf6d Objective-C++ (and c++) Sema: Patch fixes a sema crash when gnu’s ?: extension
is used for Objective-C++’s dictionary subscripting. This is done by filtering
out all placeholder types before check on lowering of the
common expression is done. // rdar://1374918.
Reviewed by John McCall.

llvm-svn: 182120
2013-05-17 16:29:36 +00:00
Richard Smith 1239d84f77 Use 'c++' not 'cxx' in these diagnostic group names for consistency.
llvm-svn: 182075
2013-05-17 03:11:25 +00:00
Richard Smith 4c163a093f PR15757: When we instantiate an inheriting constructor template, also
instantiate the inherited constructor template and mark that as the constructor
which the instantiated specialization is inheriting. This fixes a
crash-on-valid when trying to compute the exception specification of a
specialization of the inheriting constructor.

llvm-svn: 182072
2013-05-17 02:19:35 +00:00
Jordan Rose fbe4d85035 [analyzer] Don't inline ~shared_ptr.
The analyzer can't see the reference count for shared_ptr, so it doesn't
know whether a given destruction is going to delete the referenced object.
This leads to spurious leak and use-after-free warnings.

For now, just ban destructors named '~shared_ptr', which catches
std::shared_ptr, std::tr1::shared_ptr, and boost::shared_ptr.

PR15987

llvm-svn: 182071
2013-05-17 02:16:49 +00:00
Richard Smith adaa015900 AST dumping: if a declaration has an uncomputed or uninstantiated exception specification, include that in the dump.
llvm-svn: 182070
2013-05-17 02:09:46 +00:00
Anna Zaks c5e2eca042 [analyzer] Add an option to use the last location in the main source file as the report location.
Previously, we’ve used the last location of the analyzer issue path as the location of the
report. This might not provide the best user experience, when one analyzer a source
file and the issue appears in the header. Introduce an option to use the last location
of the path that is in the main source file as the report location.

New option can be enabled with -analyzer-config report-in-main-source-file=true.

llvm-svn: 182058
2013-05-16 22:30:45 +00:00
Richard Smith a3ee78df28 Since we're counting number of steps, switch to turing machines which maximize
#steps not #1s, and use a more traditional step count where the 'halt' step is
not counted.

llvm-svn: 182057
2013-05-16 22:18:32 +00:00
Richard Smith 2414a6997b Add testcase omitted from r181998.
llvm-svn: 182043
2013-05-16 19:52:25 +00:00
Fariborz Jahanian 39d1c42f30 Objective-C arc: Diagnose when user attempts to
synthesize a property getter method that overrides
a method definition named 'retain' and the like.
Fixes // rdar://13885083

llvm-svn: 182039
2013-05-16 19:08:44 +00:00
David Fang 072d47b67f fix PR 15726: ptrdiff_t should be int on PowerPC Darwin
llvm-svn: 182029
2013-05-16 17:51:48 +00:00
Enea Zaffanella cf51a8ac3f Let CodeGenFunction::EmitVarDecl query the semantic storage class info.
Added testcase corresponding to PR15991.

llvm-svn: 181998
2013-05-16 11:27:56 +00:00
NAKAMURA Takumi 267b446324 clang/test/Modules/self-import-header/test.m: Add explicit -target.
Clang has an issue between mingw/include/float.h and clang/Headers/float.h with cyclic include_next.
For now, it should work to suppress #include_next in clang/float.h with an explicit target.
(It may work with -U__MINGW32__, though.)

llvm-svn: 181988
2013-05-16 06:59:30 +00:00
Richard Smith ba71c08523 First pass of semantic analysis for init-captures: check the initializer, build
a FieldDecl from it, and propagate both into the closure type and the
LambdaExpr.

You can't do much useful with them yet -- you can't use them within the body
of the lambda, because we don't have a representation for "the this of the
lambda, not the this of the enclosing context". We also don't have support or a
representation for a nested capture of an init-capture yet, which was intended
to work despite not being allowed by the current standard wording.

llvm-svn: 181985
2013-05-16 06:20:58 +00:00
Rafael Espindola c1b38a29e7 Fix pr15930.
In the case of inline functions, we have to special case local types
when they are used as template arguments to make sure the template
instantiations are still uniqued in case the function itself is inlined.

llvm-svn: 181981
2013-05-16 04:30:21 +00:00
Richard Trieu b48e62fb45 Check a pointer is not null before attempting to use it. This prevents a
crash on an explicit specialization of a member function in a class scope.

llvm-svn: 181971
2013-05-16 02:14:08 +00:00
Richard Trieu 388a33f3a3 Return QualType() when a too large array is attempting to be created. This
prevents further errors and some overflows in size calculations.
One overflow was previously triggering an assert.

llvm-svn: 181970
2013-05-16 01:46:09 +00:00
Eric Christopher 2ec1211c87 Add a test to verify that -flimit-debug-info is working in some way.
llvm-svn: 181963
2013-05-16 00:45:20 +00:00
Eric Christopher c65920b203 Fix comment.
llvm-svn: 181962
2013-05-16 00:45:18 +00:00
Eric Christopher a45ae1f1f1 Remove xfail'd test. This method of limiting debug info isn't
going to go anywhere.

llvm-svn: 181961
2013-05-16 00:45:15 +00:00
Adrian Prantl 5e5ff6e170 Set the debug location for landing pad code to the canonical EH location.
It used to point to the first call that caused the landing pad to
be generated.

rdar://problem/13888152

llvm-svn: 181958
2013-05-16 00:41:29 +00:00
David Blaikie db35281468 Revert "Debug Info: Using declarations/DW_TAG_imported_declaration of variables, types, and functions."
This reverts commit r181393 (git 3923d6a87fe7b2c91cc4a7dbd90c4ec7e2316bcd).

This seems to be emitting too much extra debug info for two (known)
reasons:
* full class definitions are emitted when only declarations are expected
* unused using declarations still produce DW_TAG_imported_declarations

llvm-svn: 181947
2013-05-15 23:46:19 +00:00
Fariborz Jahanian 0b11ef2ef0 Objective-C: More cases of -Wsign-conversion not
working on new Objective-C array subscripting
syntax. // rdar://13855682

llvm-svn: 181940
2013-05-15 22:25:03 +00:00
Fariborz Jahanian 2cb4a957c6 Objective-C: patch to issue the conversion
warning when property-dot syntax is used
with -Wsign-conversion. // rdar://13855394

llvm-svn: 181914
2013-05-15 19:03:04 +00:00
Fariborz Jahanian 478536b1c1 improve of note message and minor refactoring of my last
patch (r181847).

llvm-svn: 181896
2013-05-15 15:27:35 +00:00
Daniel Jasper 9dc096c8e6 Fix test breakage caused by change in clang-format.
llvm-svn: 181888
2013-05-15 14:27:33 +00:00
Hans Wennborg 8f62c5ca22 Better diagnostics for string initialization.
This commit improves Clang's diagnostics for string initialization.
Where it would previously say:

  /tmp/a.c:3:9: error: array initializer must be an initializer list
  wchar_t s[] = "Hi";
          ^
  /tmp/a.c:4:6: error: array initializer must be an initializer list or string literal
  char t[] = L"Hi";
       ^

It will now say

  /tmp/a.c:3:9: error: initializing wide char array with non-wide string literal
  wchar_t s[] = "Hi";
          ^
  /tmp/a.c:4:6: error: initializing char array with wide string literal
  char t[] = L"Hi";
       ^

As a bonus, it also fixes the fact that Clang would previously reject
this valid C11 code:

  char16_t s[] = u"hi";
  char32_t t[] = U"hi";

because it would only recognize the built-in types for char16_t and
char32_t, which do not exist in C.

llvm-svn: 181880
2013-05-15 11:03:04 +00:00
Daniel Jasper d2ae41a7c6 Remove diagnostics from clang-format.
We only ever implemented one and that one is not actually all that
helpful (e.g. gets incorrectly triggered by macros).

llvm-svn: 181871
2013-05-15 08:14:19 +00:00
David Blaikie 7d17010db5 Use only explicit bool conversion operator
The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

DiagnosticBuilder kept its implicit conversion operator owing to the
prevalent use of it in return statements.

One bug was found in ExprConstant.cpp involving a comparison of two
PointerUnions (PointerUnion did not previously have an operator==, so
instead both operands were converted to bool & then compared). A test
is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix
(adding operator== to PointerUnion in LLVM).

llvm-svn: 181869
2013-05-15 07:37:26 +00:00
Jakob Stoklund Olesen 248520bdea Use correct types for SPARC v9.
It's an LP64 platform.

llvm-svn: 181867
2013-05-15 03:22:33 +00:00
Jim Grosbach d10f1c04aa ARM: Improve codegen for vget_low_* and vget_high_ intrinsics.
These intrinsics use the __builtin_shuffle() function to extract the
low and high half, respectively, of a 128-bit NEON vector. Currently,
they're defined to use bitcasts to simplify the emitter, so we get code
like:
uint16x4_t vget_low_u32(uint16x8_t __a) {
  return (uint32x2_t) __builtin_shufflevector((int64x2_t) __a,
                                              (int64x2_t) __a,
                                              0);
}

While this works, it results in those bitcasts going all the way through
to the IR, resulting in code like:
  %1 = bitcast <8 x i16> %in to <2 x i64>
  %2 = shufflevector <2 x i64> %1, <2 x i64> undef, <1 x i32>
  %zeroinitializer
  %3 = bitcast <1 x i64> %2 to <4 x i16>

We can instead easily perform the operation directly on the input vector
like:

uint16x4_t vget_low_u16(uint16x8_t __a) {
  return __builtin_shufflevector(__a, __a, 0, 1, 2, 3);
}

Not only is that much easier to read on its own, it also results in
cleaner IR like:

  %1 = shufflevector <8 x i16> %in, <8 x i16> undef,
                     <4 x i32> <i32 0, i32 1, i32 2, i32 3>

This is both easier to read and easier for the back end to reason
about effectively since the operation is obfuscating the source with
bitcasts.

rdar://13894163

llvm-svn: 181865
2013-05-15 02:40:04 +00:00
Jordan Rose 4fec903717 Use 'env' in tests that set environment variables.
Patch by David Fang!

llvm-svn: 181861
2013-05-15 01:45:37 +00:00
Richard Trieu 1c6f15d755 Move a test that requires 64-bit mode to a separate test with a triple in
the run line.

llvm-svn: 181854
2013-05-15 00:44:06 +00:00
Fariborz Jahanian 773df4a11f Objective-C [diagnostics] [QOI], when method is not
found for a receiver, note where receiver class
is declaraed (this is most common when receiver is a forward
class). // rdar://3258331

llvm-svn: 181847
2013-05-14 23:24:17 +00:00
Douglas Gregor 230826cc42 Don't mark a type specifier as "owned" if there is no declaration to own.
This simplifies error recovery elsewhere, eliminating the crash in
<rdar://problem/13853540>.

llvm-svn: 181846
2013-05-14 23:22:32 +00:00
Richard Trieu 04d2d94762 When computing the size of large arrays, use char units instead of bits.
This prevents an overflow and assertion when the number of bits cannot be
stored in 64-bits.

llvm-svn: 181839
2013-05-14 21:59:17 +00:00
David Blaikie d4da8728ba Provide operator<< for stream output of DeclarationNames
ASTDumper was already trying to do this & instead got an implicit bool
conversion by surprise (thus printing out 0 or 1 instead of the name of
the declaration). To avoid that issue & simplify call sites, simply make
it the normal/expected operator<<(raw_ostream&, ...) overload & simplify
all the existing call sites. (bonus: this function doesn't need to be a
member or friend, it's just using public API in DeclarationName)

llvm-svn: 181832
2013-05-14 21:04:00 +00:00
Reid Kleckner 369f316ef8 [ms-cxxabi] Mangle in an implicit 'E' for certain types on win64
Most of the complexity of this patch is figuring out which types get the
qualifier and which don't.  If we implement __ptr32/64, then we should
check the qualifier instead of assuming all pointers are 64-bit.

This fixes PR13792.

Patch by Warren Hunt!

llvm-svn: 181825
2013-05-14 20:30:42 +00:00
Rafael Espindola 0633865e5b Really fix the declaration of __clear_cache.
When I tested gcc's behaviour before, I forgot the extern "C", so it
would warn when the types *did* match.

So in the end
* __clear_cache takes two void pointers.
* aarch64 was correct before.
* libgcc's manual is wrong.
* this patch fixes arm.

llvm-svn: 181810
2013-05-14 18:06:10 +00:00
Rafael Espindola 2219fc5821 Fix __clear_cache on ARM.
Current gcc's produce an error if __clear_cache is anything but

__clear_cache(char *a, char *b);

It looks like we had just implemented a gcc bug that is now fixed.

llvm-svn: 181784
2013-05-14 12:45:47 +00:00
Tim Northover c28380a094 AArch64: add test for updated __clear_cache definition
llvm-svn: 181765
2013-05-14 08:37:13 +00:00
Richard Smith 0838f3a1f2 Suppress bogus "use of undefined constexpr function" error if the function body
was erroneous and got discarded.

llvm-svn: 181758
2013-05-14 05:18:44 +00:00
Rafael Espindola 92dbc3183f Use atomic instructions on linux thumb v7.
This matches gcc's behaviour. The patch also explicitly parses the version so
that this keeps working when we add support for v8.

llvm-svn: 181750
2013-05-14 00:44:24 +00:00
David Blaikie 11ecabf4eb PR15956: Debug Info: Include the appropriate file location in types created due to using declarations
We might benefit from API refactoring here (why pass in a value that's
derived from another parameter?) but this is the immediate issue.

llvm-svn: 181747
2013-05-14 00:34:20 +00:00
Anna Zaks 6afa8f1609 [analyzer] Refactor: address Jordan’s code review of r181738.
(Modifying the checker to record that the values are no longer nil will be done separately.)

llvm-svn: 181744
2013-05-13 23:49:51 +00:00
Anna Zaks bb2a2c865f [analyzer] Warn about nil elements/keys/values in array and dictionary literals.
llvm-svn: 181738
2013-05-13 21:48:20 +00:00
Rafael Espindola 101d5b956a Use atomic instructions on ARM linux.
This is safe given how the pre-v6 atomic ops funcions in libgcc are
implemented.

This fixes pr15429.

llvm-svn: 181728
2013-05-13 20:09:47 +00:00
Fariborz Jahanian 096f7c1e05 Objective-C error recovery. This patch makes a quick
recovery form duplicate method definition error thus
preventing doc parsing to loop trying to find comment
for the invalid redefinition in a previous declaration.
// rdar://13836387

llvm-svn: 181710
2013-05-13 17:27:00 +00:00
Ben Langmuir 82dec97e52 Fix test/CodeGenCXX/captured-statements.cpp on powerpc64
Generalize some attributes that differ on powerpc64 (i32 vs signext i32). Also
fix some copy-and-pasted code that didn't get updated properly.

llvm-svn: 181707
2013-05-13 14:45:11 +00:00
David Blaikie d900f98bdf Debug Info: PR14992: Support values for non-type template parameters of function type
llvm-svn: 181685
2013-05-13 06:57:50 +00:00
Alexey Bataev 6f6f3b4baf OpenMP threadprivate with qualified names.
llvm-svn: 181683
2013-05-13 04:18:18 +00:00