]> granicus.if.org Git - clang/log
clang
11 years ago[analyzer;alternate edges] prune out extra edges to a subexpression where we dive...
Ted Kremenek [Tue, 21 May 2013 21:38:05 +0000 (21:38 +0000)]
[analyzer;alternate edges] prune out extra edges to a subexpression where we dive-in and out of a subexpression.

Fixes <rdar://problem/13941891>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182426 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternated edges] look through expressions just like Environment does.
Ted Kremenek [Tue, 21 May 2013 21:38:02 +0000 (21:38 +0000)]
[analyzer; alternated edges] look through expressions just like Environment does.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182425 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C arc: don't count use of __weak
Fariborz Jahanian [Tue, 21 May 2013 21:20:26 +0000 (21:20 +0000)]
Objective-C arc: don't count use of __weak
variables when they are used in such unevaluated
contexts as __typeof, etc. // rdar://13942025

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182423 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRefactor places which perform contextual implicit conversions to go through a
Richard Smith [Tue, 21 May 2013 19:05:48 +0000 (19:05 +0000)]
Refactor places which perform contextual implicit conversions to go through a
common function. The C++1y contextual implicit conversion rules themselves are
not yet implemented, however.

This also fixes a subtle bug where template instantiation context notes were
dropped for diagnostics coming from conversions for integral constant
expressions -- we were implicitly slicing a SemaDiagnosticBuilder into a
DiagnosticBuilder when producing these diagnostics, and losing their context
notes in the process.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182406 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDebug Info: Simplify the code changed in r182403 to reduce indent & avoid a duplicate...
David Blaikie [Tue, 21 May 2013 18:29:40 +0000 (18:29 +0000)]
Debug Info: Simplify the code changed in r182403 to reduce indent & avoid a duplicate lookup in the insertion case

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182404 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDebug Info: don't bother reinserting elements into maps we just retrieved them from
David Blaikie [Tue, 21 May 2013 18:08:19 +0000 (18:08 +0000)]
Debug Info: don't bother reinserting elements into maps we just retrieved them from

(no intended behavior change)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182403 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix whitespace
David Blaikie [Tue, 21 May 2013 17:58:54 +0000 (17:58 +0000)]
Fix whitespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182400 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix off-by-one error in clang-format's emacs integration.
Daniel Jasper [Tue, 21 May 2013 17:05:40 +0000 (17:05 +0000)]
Fix off-by-one error in clang-format's emacs integration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182395 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix behavior of clang-format's -cursor flag.
Daniel Jasper [Tue, 21 May 2013 14:21:46 +0000 (14:21 +0000)]
Fix behavior of clang-format's -cursor flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182386 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoLet clang-format move the cursor appropriately.
Daniel Jasper [Tue, 21 May 2013 12:21:39 +0000 (12:21 +0000)]
Let clang-format move the cursor appropriately.

With this patch, clang-format will try to keep the cursor at the
original code position in editor integrations (implemented for emacs and
vim). This means, after formatting, clang-format will try to keep the
cursor on the same character of the same token.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182373 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove unused diagnostics.
Benjamin Kramer [Tue, 21 May 2013 10:57:36 +0000 (10:57 +0000)]
Remove unused diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182368 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAllow breaking before a trailing const.
Daniel Jasper [Tue, 21 May 2013 09:16:31 +0000 (09:16 +0000)]
Allow breaking before a trailing const.

Before:
void someLongFunction(
    int someLongParameter) const;

After:
void someLongFunction(int someLongParameter)
    const;

Also slightly cleanup tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182362 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoIn -ast-dump, only dump comments when dumping the actual Decl to which they
Richard Smith [Tue, 21 May 2013 05:24:00 +0000 (05:24 +0000)]
In -ast-dump, only dump comments when dumping the actual Decl to which they
attach, rather than merging all comments on the declaration chain. This gives a
more faithful dump, and has the side benefit of unbreaking uses of dump() from
within AST deserialization (where the redeclaration chain may not be sane).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182350 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternate edges] optimize edges for ObjC fast enumeration loops.
Ted Kremenek [Tue, 21 May 2013 00:34:40 +0000 (00:34 +0000)]
[analyzer; alternate edges] optimize edges for ObjC fast enumeration loops.

Fixes <rdar://problem/13942300>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182342 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agodoc. parsing. HeaderDoc documentaton allows use of
Fariborz Jahanian [Mon, 20 May 2013 23:40:39 +0000 (23:40 +0000)]
doc. parsing. HeaderDoc documentaton allows use of
@class command on an @interface declaration. Turn off
the warning for this case. // rdar://13927330

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182334 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert r182331, these checks should be based on the target not the host.
Richard Smith [Mon, 20 May 2013 23:40:27 +0000 (23:40 +0000)]
Revert r182331, these checks should be based on the target not the host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182333 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMove two Darwin-specific hacks into #ifdef __APPLE__. These were stat'ing
Richard Smith [Mon, 20 May 2013 23:17:08 +0000 (23:17 +0000)]
Move two Darwin-specific hacks into #ifdef __APPLE__. These were stat'ing
nonexistent Darwin-specific files on every module build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182331 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPR14606: Debug Info for namespace aliases/DW_TAG_imported_module
David Blaikie [Mon, 20 May 2013 22:50:41 +0000 (22:50 +0000)]
PR14606: Debug Info for namespace aliases/DW_TAG_imported_module

This resolves the last of the PR14606 failures in the GDB 7.5 test
suite. (but there are still unresolved issues in the imported_decl case
- we need to implement optional/lazy decls for functions & variables
like we already do for types)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182329 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWarn on and drop dllimport attrs from variable definitions
Reid Kleckner [Mon, 20 May 2013 21:53:29 +0000 (21:53 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182320 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C [qoi]: When an class conforms to multiple
Fariborz Jahanian [Mon, 20 May 2013 21:20:24 +0000 (21:20 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182316 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMake this const since it never changes (and should never change).
Eric Christopher [Mon, 20 May 2013 19:59:06 +0000 (19:59 +0000)]
Make this const since it never changes (and should never change).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182309 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoThread safety analysis: fix use after free bug reported by Evgeniy Stepanov.
DeLesley Hutchins [Mon, 20 May 2013 17:57:55 +0000 (17:57 +0000)]
Thread safety analysis: fix use after free bug reported by Evgeniy Stepanov.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182305 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReleaseNotes.rst: typo
Hans Wennborg [Mon, 20 May 2013 15:59:04 +0000 (15:59 +0000)]
ReleaseNotes.rst: typo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182294 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMinor fix: don't crash on empty configuration file, consider empty configuration...
Alexander Kornienko [Mon, 20 May 2013 15:18:01 +0000 (15:18 +0000)]
Minor fix: don't crash on empty configuration file, consider empty configuration files invalid.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182290 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReleaseNotes: add note about ASTContext::WCharTy and WideCharTy
Hans Wennborg [Mon, 20 May 2013 14:53:06 +0000 (14:53 +0000)]
ReleaseNotes: add note about ASTContext::WCharTy and WideCharTy

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182280 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoNuke build of static ASan runtime on Mac OS - clang part
Alexey Samsonov [Mon, 20 May 2013 14:33:20 +0000 (14:33 +0000)]
Nuke build of static ASan runtime on Mac OS - clang part

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182278 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-cxxabi] Look up operator delete() at every virtual dtor declaration.
Peter Collingbourne [Mon, 20 May 2013 14:12:25 +0000 (14:12 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182270 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoExtend default blacklist logic to MSan and TSan.
Evgeniy Stepanov [Mon, 20 May 2013 14:10:58 +0000 (14:10 +0000)]
Extend default blacklist logic to MSan and TSan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182269 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd arm_neon.h to the builtin intrinsics module map.
Douglas Gregor [Mon, 20 May 2013 14:07:18 +0000 (14:07 +0000)]
Add arm_neon.h to the builtin intrinsics module map.

Fixes <rdar://problem/13933913>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182268 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImplement __declspec(selectany) under -fms-extensions
Reid Kleckner [Mon, 20 May 2013 14:02:37 +0000 (14:02 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182266 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix broken test
Douglas Gregor [Mon, 20 May 2013 13:54:38 +0000 (13:54 +0000)]
Fix broken test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182264 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd -Wincomplete-module, which detects when a header is included from a module but...
Douglas Gregor [Mon, 20 May 2013 13:49:41 +0000 (13:49 +0000)]
Add -Wincomplete-module, which detects when a header is included from a module but isn't itself part of a module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182263 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert "Revert "Debug Info: Using declarations/DW_TAG_imported_declaration of variabl...
David Blaikie [Mon, 20 May 2013 04:58:53 +0000 (04:58 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182231 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoOpenBSD/sparc64 uses long long for int64_t and intmax_t.
Jakob Stoklund Olesen [Sun, 19 May 2013 17:53:37 +0000 (17:53 +0000)]
OpenBSD/sparc64 uses long long for int64_t and intmax_t.

Other operating systems, including FreeBSD and NetBSD, use long.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182215 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTests and status for core issues 1-50.
Richard Smith [Sun, 19 May 2013 07:22:38 +0000 (07:22 +0000)]
Tests and status for core issues 1-50.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182207 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoClang-format: allow -style="{yaml/json}" on command line
Alexander Kornienko [Sun, 19 May 2013 00:53:30 +0000 (00:53 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182205 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Extend the checker developer manual. A patch by Sam Handler!
Anna Zaks [Sat, 18 May 2013 22:51:28 +0000 (22:51 +0000)]
[analyzer] Extend the checker developer manual. A patch by Sam Handler!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182204 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix a logic bug in the handling of -fmath-errno in the driver. We would
Chandler Carruth [Sat, 18 May 2013 20:47:36 +0000 (20:47 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182203 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSlight reorganization of the fast-math tests which test for errno
Chandler Carruth [Sat, 18 May 2013 20:27:06 +0000 (20:27 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182202 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemoved invalid character.
Serge Pavlov [Sat, 18 May 2013 04:32:15 +0000 (04:32 +0000)]
Removed invalid character.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182189 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] New edges: include an edge to the end-of-path location.
Jordan Rose [Sat, 18 May 2013 02:27:13 +0000 (02:27 +0000)]
[analyzer] New edges: include an edge to the end-of-path location.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182188 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] "Fix" ParentMap to handle non-syntactic OpaqueValueExprs.
Jordan Rose [Sat, 18 May 2013 02:27:09 +0000 (02:27 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182187 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Add a debug dump for PathPieces, a list of PathDiagnosticPieces.
Jordan Rose [Sat, 18 May 2013 02:26:59 +0000 (02:26 +0000)]
[analyzer] Add a debug dump for PathPieces, a list of PathDiagnosticPieces.

Originally implemented by Ted, extended by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182186 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert "[analyzer; alternate edges] improve support for edges with PseudoObjectExprs."
Jordan Rose [Sat, 18 May 2013 02:26:50 +0000 (02:26 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182185 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoHandle local enum types too.
Rafael Espindola [Sat, 18 May 2013 00:33:28 +0000 (00:33 +0000)]
Handle local enum types too.

Thanks to John McCall for pointing this out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182182 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDrop the const from the isa test.
Adrian Prantl [Fri, 17 May 2013 23:58:45 +0000 (23:58 +0000)]
Drop the const from the isa test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182178 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjC Debug Info: Emit the correct method names for accessors for
Adrian Prantl [Fri, 17 May 2013 23:49:10 +0000 (23:49 +0000)]
ObjC Debug Info: Emit the correct method names for accessors for
properties declared in a protocol.

rdar://problem/13798000

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182176 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoThread safety analysis: add two new attributes to the thread safety analysis:
DeLesley Hutchins [Fri, 17 May 2013 23:02:59 +0000 (23:02 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182170 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse the awesome CHECK-DAG!
Rafael Espindola [Fri, 17 May 2013 22:33:49 +0000 (22:33 +0000)]
Use the awesome CHECK-DAG!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182167 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Address Jordan's review comments for r182058
Anna Zaks [Fri, 17 May 2013 20:51:16 +0000 (20:51 +0000)]
[analyzer] Address Jordan's review comments for r182058

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182156 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agolibclang: add a function to check whether a member function is pure virtual
Dmitri Gribenko [Fri, 17 May 2013 18:38:35 +0000 (18:38 +0000)]
libclang: add a function to check whether a member function is pure virtual

Patch by Seth Fowler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182139 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C parsing. Error recovery when category implementation
Fariborz Jahanian [Fri, 17 May 2013 17:58:11 +0000 (17:58 +0000)]
Objective-C parsing. Error recovery when category implementation
declaration is illegally protocol qualified. // rdar://13920026

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182136 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMove documentation to the constructor. Fixes a -Wdocumentation warning
Dmitri Gribenko [Fri, 17 May 2013 17:50:16 +0000 (17:50 +0000)]
Move documentation to the constructor.  Fixes a -Wdocumentation warning

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182134 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C++ (and c++) Sema: Patch fixes a sema crash when gnu’s ?: extension
Fariborz Jahanian [Fri, 17 May 2013 16:29:36 +0000 (16:29 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182120 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRefactor diagnostics for MS attributes without -fms-extensions
Reid Kleckner [Fri, 17 May 2013 14:04:52 +0000 (14:04 +0000)]
Refactor diagnostics for MS attributes without -fms-extensions

This shares the warn_attribute_unused diagnostic and reduces the
indentation level.  No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182096 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternate edges] improve support for edges with PseudoObjectExprs.
Ted Kremenek [Fri, 17 May 2013 09:41:40 +0000 (09:41 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182083 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSlightly modify the formatting rules for braced lists.
Daniel Jasper [Fri, 17 May 2013 09:35:01 +0000 (09:35 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182082 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd embedded video for the AST tutorial.
Manuel Klimek [Fri, 17 May 2013 08:40:22 +0000 (08:40 +0000)]
Add embedded video for the AST tutorial.

As asked for by Sean, putting the video into the docs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182081 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternate edges] treat 'if' statements the same way we do as 'for' or...
Ted Kremenek [Fri, 17 May 2013 06:48:27 +0000 (06:48 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182079 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternate edges] don't add an edge incoming from the start of a function
Ted Kremenek [Fri, 17 May 2013 06:48:22 +0000 (06:48 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182078 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse 'c++' not 'cxx' in these diagnostic group names for consistency.
Richard Smith [Fri, 17 May 2013 03:11:25 +0000 (03:11 +0000)]
Use 'c++' not 'cxx' in these diagnostic group names for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182075 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoA little ArrayRef'ization.
Richard Smith [Fri, 17 May 2013 03:04:50 +0000 (03:04 +0000)]
A little ArrayRef'ization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182074 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPR15757: When we instantiate an inheriting constructor template, also
Richard Smith [Fri, 17 May 2013 02:19:35 +0000 (02:19 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182072 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Don't inline ~shared_ptr.
Jordan Rose [Fri, 17 May 2013 02:16:49 +0000 (02:16 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182071 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAST dumping: if a declaration has an uncomputed or uninstantiated exception specifica...
Richard Smith [Fri, 17 May 2013 02:09:46 +0000 (02:09 +0000)]
AST dumping: if a declaration has an uncomputed or uninstantiated exception specification, include that in the dump.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182070 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Add an option to use the last location in the main source file as the...
Anna Zaks [Thu, 16 May 2013 22:30:45 +0000 (22:30 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182058 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSince we're counting number of steps, switch to turing machines which maximize
Richard Smith [Thu, 16 May 2013 22:18:32 +0000 (22:18 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182057 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[Lexer] Improve Lexer::getSourceText() when the given range deals with function macro...
Argyrios Kyrtzidis [Thu, 16 May 2013 21:37:39 +0000 (21:37 +0000)]
[Lexer] Improve Lexer::getSourceText() when the given range deals with function macro arguments.

This is a modified version of a patch by Manuel Klimek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182055 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd testcase omitted from r181998.
Richard Smith [Thu, 16 May 2013 19:52:25 +0000 (19:52 +0000)]
Add testcase omitted from r181998.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182043 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C arc: Diagnose when user attempts to
Fariborz Jahanian [Thu, 16 May 2013 19:08:44 +0000 (19:08 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182039 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agofix PR 15726: ptrdiff_t should be int on PowerPC Darwin
David Fang [Thu, 16 May 2013 17:51:48 +0000 (17:51 +0000)]
fix PR 15726: ptrdiff_t should be int on PowerPC Darwin

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182029 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd additional test-case for one-line-function.
Daniel Jasper [Thu, 16 May 2013 16:54:34 +0000 (16:54 +0000)]
Add additional test-case for one-line-function.

This ensures that we format:
void longFunctionName {
} // long comment here

And not:
void longFunctionName {}
// long comment here

As requested in post-commit-review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182024 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd basic clang-format integration for sublime text.
Daniel Jasper [Thu, 16 May 2013 15:08:25 +0000 (15:08 +0000)]
Add basic clang-format integration for sublime text.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182015 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDon't insert a break into include lines with trailing comments.
Daniel Jasper [Thu, 16 May 2013 12:59:13 +0000 (12:59 +0000)]
Don't insert a break into include lines with trailing comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182003 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd config parsing test for new parameter.
Daniel Jasper [Thu, 16 May 2013 12:16:23 +0000 (12:16 +0000)]
Add config parsing test for new parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182001 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd option to put short loops on a single line.
Daniel Jasper [Thu, 16 May 2013 12:12:21 +0000 (12:12 +0000)]
Add option to put short loops on a single line.

This enables things like:

for (int &v : vec) v *= 2;

Enabled for Google style.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182000 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoLet CodeGenFunction::EmitVarDecl query the semantic storage class info.
Enea Zaffanella [Thu, 16 May 2013 11:27:56 +0000 (11:27 +0000)]
Let CodeGenFunction::EmitVarDecl query the semantic storage class info.
Added testcase corresponding to PR15991.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181998 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd a more convenient interface to use clang-format.
Daniel Jasper [Thu, 16 May 2013 10:40:07 +0000 (10:40 +0000)]
Add a more convenient interface to use clang-format.

It turns out that several implementations go through the trouble of
setting up a SourceManager and Lexer and abstracting this into a
function makes usage easier.

Also abstracts SourceManager-independent ranges out of
tooling::Refactoring and provides a convenience function to create them
from line ranges.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181997 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoComments should not prevent single-line functions.
Daniel Jasper [Thu, 16 May 2013 10:17:39 +0000 (10:17 +0000)]
Comments should not prevent single-line functions.

Before:
void f() {}
void g() {
} // comment

After:
void f() {}
void g() {} // comment

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181996 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSemaInit.cpp: give both IsStringInit() functions the same return type.
Hans Wennborg [Thu, 16 May 2013 09:22:40 +0000 (09:22 +0000)]
SemaInit.cpp: give both IsStringInit() functions the same return type.

This addresses Richard's comment on r181880.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181995 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoclang/test/Modules/self-import-header/test.m: Add explicit -target.
NAKAMURA Takumi [Thu, 16 May 2013 06:59:30 +0000 (06:59 +0000)]
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.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181988 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFirst pass of semantic analysis for init-captures: check the initializer, build
Richard Smith [Thu, 16 May 2013 06:20:58 +0000 (06:20 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181985 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTidy up now that PointerUnion has an operator== that works.
Richard Smith [Thu, 16 May 2013 05:04:51 +0000 (05:04 +0000)]
Tidy up now that PointerUnion has an operator== that works.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181983 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix pr15930.
Rafael Espindola [Thu, 16 May 2013 04:30:21 +0000 (04:30 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181981 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd back accidentally deleted line and add test for it.
Daniel Jasper [Thu, 16 May 2013 04:26:02 +0000 (04:26 +0000)]
Add back accidentally deleted line and add test for it.

Before:
f("a", "b"
  "c");
After:
f("a", "b"
       "c");

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181980 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCheck a pointer is not null before attempting to use it. This prevents a
Richard Trieu [Thu, 16 May 2013 02:14:08 +0000 (02:14 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181971 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReturn QualType() when a too large array is attempting to be created. This
Richard Trieu [Thu, 16 May 2013 01:46:09 +0000 (01:46 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181970 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoEnable $Date$ substitution for this file.
Richard Smith [Thu, 16 May 2013 01:25:47 +0000 (01:25 +0000)]
Enable $Date$ substitution for this file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181969 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoStart a page tracking which C++ defect reports have been implemented in Clang.
Richard Smith [Thu, 16 May 2013 01:23:30 +0000 (01:23 +0000)]
Start a page tracking which C++ defect reports have been implemented in Clang.
The page is generated from a text file listing DR numbers and implementation
status, plus a copy of the cwg_index.html from the WG21 website. Recipe:

  $ wget http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_index.html
  $ ./make_cxx_dr_status >! cxx_dr_status.html

The intent here is to go through all the DRs, add tests for each one, then mark
them as done once such tests are committed and passing. I've not linked to this
page from anywhere, since it doesn't contain any useful information yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181967 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWhitespace.
Eric Christopher [Thu, 16 May 2013 00:52:23 +0000 (00:52 +0000)]
Whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181966 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago80-columns.
Eric Christopher [Thu, 16 May 2013 00:52:20 +0000 (00:52 +0000)]
80-columns.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181965 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReplace a pile of calls with an instance variable that's set
Eric Christopher [Thu, 16 May 2013 00:45:23 +0000 (00:45 +0000)]
Replace a pile of calls with an instance variable that's set
once. Should be no functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181964 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd a test to verify that -flimit-debug-info is working in some way.
Eric Christopher [Thu, 16 May 2013 00:45:20 +0000 (00:45 +0000)]
Add a test to verify that -flimit-debug-info is working in some way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181963 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix comment.
Eric Christopher [Thu, 16 May 2013 00:45:18 +0000 (00:45 +0000)]
Fix comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181962 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove xfail'd test. This method of limiting debug info isn't
Eric Christopher [Thu, 16 May 2013 00:45:15 +0000 (00:45 +0000)]
Remove xfail'd test. This method of limiting debug info isn't
going to go anywhere.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181961 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWhitespace.
Eric Christopher [Thu, 16 May 2013 00:45:12 +0000 (00:45 +0000)]
Whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181960 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoClarify comment.
Adrian Prantl [Thu, 16 May 2013 00:41:31 +0000 (00:41 +0000)]
Clarify comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181959 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSet the debug location for landing pad code to the canonical EH location.
Adrian Prantl [Thu, 16 May 2013 00:41:29 +0000 (00:41 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181958 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCleanup: Use a member variable to store the SourceLocation for EH code.
Adrian Prantl [Thu, 16 May 2013 00:41:26 +0000 (00:41 +0000)]
Cleanup: Use a member variable to store the SourceLocation for EH code.
rdar://problem/13888152

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181957 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert "Debug Info: Using declarations/DW_TAG_imported_declaration of variables,...
David Blaikie [Wed, 15 May 2013 23:46:19 +0000 (23:46 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181947 91177308-0d34-0410-b5e6-96231b3b80d8