Commit Graph

45519 Commits

Author SHA1 Message Date
Reid Kleckner 52d598e242 Warn on and drop dllimport attrs from variable definitions
AsmPrinter::EmitLinkage() does not handle dllimport linkage.  The LLVM
verifier should also be fixed to reject this.

llvm-svn: 182320
2013-05-20 21:53:29 +00:00
Fariborz Jahanian 0ebf87959f Objective-C [qoi]: When an class conforms to multiple
protocols that declare the same property of incompatible
types, issue a warning when class implementation synthesizes 
the property. // rdar://13075400

llvm-svn: 182316
2013-05-20 21:20:24 +00:00
Eric Christopher cbf5701f93 Make this const since it never changes (and should never change).
llvm-svn: 182309
2013-05-20 19:59:06 +00:00
DeLesley Hutchins 3b2c66bbda Thread safety analysis: fix use after free bug reported by Evgeniy Stepanov.
llvm-svn: 182305
2013-05-20 17:57:55 +00:00
Hans Wennborg b3ad90d52d ReleaseNotes.rst: typo
llvm-svn: 182294
2013-05-20 15:59:04 +00:00
Alexander Kornienko 06e0033427 Minor fix: don't crash on empty configuration file, consider empty configuration files invalid.
llvm-svn: 182290
2013-05-20 15:18:01 +00:00
Hans Wennborg 3cb56a4f34 ReleaseNotes: add note about ASTContext::WCharTy and WideCharTy
llvm-svn: 182280
2013-05-20 14:53:06 +00:00
Alexey Samsonov 92bbd3e818 Nuke build of static ASan runtime on Mac OS - clang part
llvm-svn: 182278
2013-05-20 14:33:20 +00:00
Peter Collingbourne b289fe64c1 [ms-cxxabi] Look up operator delete() at every virtual dtor declaration.
While the C++ standard requires that this lookup take place only at the
definition point of a virtual destructor (C++11 [class.dtor]p12), the
Microsoft ABI may require the compiler to emit a deleting destructor
for any virtual destructor declared in the TU, including ones without
a body, requiring an operator delete() lookup for every virtual
destructor declaration.  The result of the lookup should be the same
no matter which declaration is used (except in weird corner cases).

This change will cause us to reject some valid TUs in Microsoft ABI
mode, e.g.:

struct A {
  void operator delete(void *);
};

struct B {
  void operator delete(void *);
};

struct C : A, B {
  virtual ~C();
};

As Richard points out, every virtual function declared in a TU
(including this virtual destructor) is odr-used, so it must be defined
in any program which declares it, or the program is ill formed, no
diagnostic required.  Because we know that any definition of this
destructor will cause the lookup to fail, the compiler can choose to
issue a diagnostic here.

Differential Revision: http://llvm-reviews.chandlerc.com/D822

llvm-svn: 182270
2013-05-20 14:12:25 +00:00
Evgeniy Stepanov dd54c337c4 Extend default blacklist logic to MSan and TSan.
llvm-svn: 182269
2013-05-20 14:10:58 +00:00
Douglas Gregor 5cad45bc89 Add arm_neon.h to the builtin intrinsics module map.
Fixes <rdar://problem/13933913>.

llvm-svn: 182268
2013-05-20 14:07:18 +00:00
Reid Kleckner b144d36693 Implement __declspec(selectany) under -fms-extensions
selectany only applies to externally visible global variables.  It has
the effect of making the data weak_odr.

The MSDN docs suggest that unused definitions can only be dropped at
linktime, so Clang uses weak instead of linkonce.  MSVC optimizes away
references to constant selectany data, so it must assume that there is
only one definition, hence weak_odr.

Reviewers: espindola

Differential Revision: http://llvm-reviews.chandlerc.com/D814

llvm-svn: 182266
2013-05-20 14:02:37 +00:00
Douglas Gregor 4b5f4cbaf2 Fix broken test
llvm-svn: 182264
2013-05-20 13:54:38 +00:00
Douglas Gregor f4e76b864f Add -Wincomplete-module, which detects when a header is included from a module but isn't itself part of a module.
llvm-svn: 182263
2013-05-20 13:49:41 +00:00
David Blaikie bd4837665b Revert "Revert "Debug Info: Using declarations/DW_TAG_imported_declaration of variables, types, and functions.""
This reverts commit r181947 (git d2990ce56a16050cac0d7937ec9919ff54c6df62 )

This addresses one of the two issues identified in r181947, ensuring
that types imported via using declarations only result in a declaration
being emitted for the type, not a definition. The second issue (emitting
using declarations that are unused) is hopefully an acceptable increase
as the real fix for this would be a bit difficult (probably at best we
could record which using directives were involved in lookups - but may
not have been the result of the lookup).

This also ensures that DW_TAG_imported_declarations (& directives) are
not emitted in line-tables-only mode as well as ensuring that typedefs
only require/emit declarations (rather than definitions) for referenced
types.

llvm-svn: 182231
2013-05-20 04:58:53 +00:00
Jakob Stoklund Olesen 826df14d72 OpenBSD/sparc64 uses long long for int64_t and intmax_t.
Other operating systems, including FreeBSD and NetBSD, use long.

llvm-svn: 182215
2013-05-19 17:53:37 +00:00
Richard Smith 10bb5b90ed Tests and status for core issues 1-50.
llvm-svn: 182207
2013-05-19 07:22:38 +00:00
Alexander Kornienko 006b5c89ce Clang-format: allow -style="{yaml/json}" on command line
Summary: + improved handling of default style and predefined styles.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D813

llvm-svn: 182205
2013-05-19 00:53:30 +00:00
Anna Zaks 8cfbaa6988 [analyzer] Extend the checker developer manual. A patch by Sam Handler!
llvm-svn: 182204
2013-05-18 22:51:28 +00:00
Chandler Carruth 0d4b9e61de Fix a logic bug in the handling of -fmath-errno in the driver. We would
imply -fno-math-errno if the user passed -fno-fast-math OR -ffast-math,
regardless of in which order and regardless of the tool chain default.

I've fixed this to follow the logic:

1) If the last dominating flag is -fno-math-errno, -ffast-math, or
   -Ofast, then do not use math-errno.
2) If the last dominating flag is an explicit -fmath-errno, do use
   math-errno.
3) Otherwise, use the toolchain default.

This, for example, allows the flag sequence
'-ffast-math ... -fno-fast-math' with no mention of '-fmath-errno' or
'-fno-math-errno' to preserve the toolchain default. Most notably, this
should prevent users trying to disable fast-math optimizations on Darwin
and BSD platforms from simultaneously enabling (pointless) -fmath-errno.

I've enhanced the tests (after more reorganization) to cover this and
other weird permutations of flags and targets.

llvm-svn: 182203
2013-05-18 20:47:36 +00:00
Chandler Carruth 40746dfe8f Slight reorganization of the fast-math tests which test for errno
setting. Consolidate the collection of tests that enable -fmath-errno
and share a single CHECK line for simplicity.

llvm-svn: 182202
2013-05-18 20:27:06 +00:00
Serge Pavlov 1112006792 Removed invalid character.
llvm-svn: 182189
2013-05-18 04:32:15 +00:00
Jordan Rose 933e5ba722 [analyzer] New edges: include an edge to the end-of-path location.
llvm-svn: 182188
2013-05-18 02:27:13 +00:00
Jordan Rose c3f1cb3ba6 [analyzer] "Fix" ParentMap to handle non-syntactic OpaqueValueExprs.
Constructs like PseudoObjectExpr, where an expression can appear more than
once in the AST, use OpaqueValueExprs to guard against inadvertent
re-processing of the shared expression during AST traversal. The most
common form of this is to share expressions between the syntactic
"as-written" form of, say, an Objective-C property access 'obj.prop', and
the underlying "semantic" form '[obj prop]'.

However, some constructs can produce OpaqueValueExprs that don't appear in
the syntactic form at all; in these cases the ParentMap wasn't ever traversing
the children of these expressions. This patch fixes that by checking to see
if an OpaqueValueExpr's child has ever been traversed before. There's also a
bit of reset logic when visiting a PseudoObjectExpr to handle the case of
updating the ParentMap, which some external clients depend on.

This still isn't exactly the right fix because we probably want the parent
of the OpaqueValueExpr itself to be its location in the syntactic form if
it's syntactic and the PseudoObjectExpr or BinaryConditionalOperator itself
if it's semantic. Whe I originally wrote the code to do this, I didn't realize
that OpaqueValueExprs themselves are shared in the AST, not just their source
expressions. This patch doesn't change the existing behavior so as not to
break anything inadvertently relying on it; we'll come back to this later.

llvm-svn: 182187
2013-05-18 02:27:09 +00:00
Jordan Rose 7c40d078b5 [analyzer] Add a debug dump for PathPieces, a list of PathDiagnosticPieces.
Originally implemented by Ted, extended by me.

llvm-svn: 182186
2013-05-18 02:26:59 +00:00
Jordan Rose 433b0f5455 Revert "[analyzer; alternate edges] improve support for edges with PseudoObjectExprs."
Ted and I spent a long time discussing this today and found out that neither
the existing code nor the new code was doing what either of us thought it
was, which is never good. The good news is we found a much simpler way to
fix the motivating test case (an ObjCSubscriptExpr).

This reverts r182083, but pieces of it will come back in subsequent commits.

llvm-svn: 182185
2013-05-18 02:26:50 +00:00
Rafael Espindola b6ed153155 Handle local enum types too.
Thanks to John McCall for pointing this out.

llvm-svn: 182182
2013-05-18 00:33:28 +00:00
Adrian Prantl b39fc142fd Drop the const from the isa test.
llvm-svn: 182178
2013-05-17 23:58:45 +00:00
Adrian Prantl 6e785ec019 ObjC Debug Info: Emit the correct method names for accessors for
properties declared in a protocol.

rdar://problem/13798000

llvm-svn: 182176
2013-05-17 23:49:10 +00:00
DeLesley Hutchins b682431775 Thread safety analysis: add two new attributes to the thread safety analysis:
assert_exclusive_lock and assert_shared_lock.  These attributes are used to
mark functions that dynamically check (i.e. assert) that a lock is held.

llvm-svn: 182170
2013-05-17 23:02:59 +00:00
Rafael Espindola 94c2fea6db Use the awesome CHECK-DAG!
llvm-svn: 182167
2013-05-17 22:33:49 +00:00
Anna Zaks 6334579623 [analyzer] Address Jordan's review comments for r182058
llvm-svn: 182156
2013-05-17 20:51:16 +00:00
Dmitri Gribenko 62770bea4b libclang: add a function to check whether a member function is pure virtual
Patch by Seth Fowler.

llvm-svn: 182139
2013-05-17 18:38:35 +00:00
Fariborz Jahanian 858885578d Objective-C parsing. Error recovery when category implementation
declaration is illegally protocol qualified. // rdar://13920026

llvm-svn: 182136
2013-05-17 17:58:11 +00:00
Dmitri Gribenko cb63bafefc Move documentation to the constructor. Fixes a -Wdocumentation warning
llvm-svn: 182134
2013-05-17 17:50:16 +00:00
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
Reid Kleckner 140c4a74e2 Refactor diagnostics for MS attributes without -fms-extensions
This shares the warn_attribute_unused diagnostic and reduces the
indentation level.  No functionality change.

llvm-svn: 182096
2013-05-17 14:04:52 +00:00
Ted Kremenek 35de14540f [analyzer; alternate edges] improve support for edges with PseudoObjectExprs.
This optimizes some spurious edges resulting from PseudoObjectExprs.
This required far more changes than I anticipated.  The current
ParentMap does not record any hierarchy information between
a PseudoObjectExpr and its *semantic* expressions that may be
wrapped in OpaqueValueExprs, which are the expressions actually
laid out in the CFG.  This means the arrow pruning logic could
not map from an expression to its containing PseudoObjectExprs.

To solve this, this patch adds a variant of ParentMap that
returns the "semantic" parentage of expressions (essentially
as they are viewed by the CFG).  This alternate ParentMap is then
used by the arrow reducing logic to identify edges into pseudo
object expressions, and then eliminate them.

llvm-svn: 182083
2013-05-17 09:41:40 +00:00
Daniel Jasper 473c62c485 Slightly modify the formatting rules for braced lists.
Basically, the new rule is: The opening "{" always has to be on the
same line as the first element if the braced list is nested
(e.g. in another braced list or in a function).

The solution that clang-format produces almost always adheres to this
rule anyway and this makes clang-format significantly faster for larger
lists. Added a test cases for the only exception I could find
(which doesn't seem to be very important at first sight).

llvm-svn: 182082
2013-05-17 09:35:01 +00:00
Manuel Klimek bf2d568900 Add embedded video for the AST tutorial.
As asked for by Sean, putting the video into the docs.

llvm-svn: 182081
2013-05-17 08:40:22 +00:00
Ted Kremenek fd8f4b0171 [analyzer; alternate edges] treat 'if' statements the same way we do as 'for' or 'while'.
This means adding an extra edge from the 'if' to the condition,
which aesthetically looks more pleasing.

llvm-svn: 182079
2013-05-17 06:48:27 +00:00
Ted Kremenek 504eb552a8 [analyzer; alternate edges] don't add an edge incoming from the start of a function
for a nested call.  This matches what we do with the first stack frame.

llvm-svn: 182078
2013-05-17 06:48:22 +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 841d8b2610 A little ArrayRef'ization.
llvm-svn: 182074
2013-05-17 03:04:50 +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
Argyrios Kyrtzidis 065d720c31 [Lexer] Improve Lexer::getSourceText() when the given range deals with function macro arguments.
This is a modified version of a patch by Manuel Klimek.

llvm-svn: 182055
2013-05-16 21:37:39 +00:00