]> granicus.if.org Git - clang/log
clang
11 years agoFix gnueeabi typo in tests
Renato Golin [Mon, 2 Sep 2013 14:11:33 +0000 (14:11 +0000)]
Fix gnueeabi typo in tests

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

11 years agoStore first and last newline position in the token text for string literals and comments.
Alexander Kornienko [Mon, 2 Sep 2013 13:58:14 +0000 (13:58 +0000)]
Store first and last newline position in the token text for string literals and comments.

Summary:
Store first and last newline position in the token text for string literals and
comments to avoid doing .find('\n') for each possible solution.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D1556

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

11 years agoTest for empty .clang-format file.
Alexander Kornienko [Mon, 2 Sep 2013 13:44:16 +0000 (13:44 +0000)]
Test for empty .clang-format file.

Summary: Test clang-format's handling of empty .clang-format files.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D1562

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

11 years agoclang-format: Fix segfault in overloaded operator parsing.
Daniel Jasper [Mon, 2 Sep 2013 09:20:39 +0000 (09:20 +0000)]
clang-format: Fix segfault in overloaded operator parsing.

Before, constructs like:
  using A::operator+;

caused a segfault. This fixes llvm.org/PR17050.

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

11 years ago[analyzer] Add very limited support for temporary destructors
Pavel Labath [Mon, 2 Sep 2013 09:09:15 +0000 (09:09 +0000)]
[analyzer] Add very limited support for temporary destructors

This is an improved version of r186498. It enables ExprEngine to reason about
temporary object destructors.  However, these destructor calls are never
inlined, since this feature is still broken. Still, this is sufficient to
properly handle noreturn temporary destructors.

Now, the analyzer correctly handles expressions like "a || A()", and executes the
destructor of "A" only on the paths where "a" evaluted to false.

Temporary destructor processing is still off by default and one has to
explicitly request it by setting cfg-temporary-dtors=true.

Reviewers: jordan_rose

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1259

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

11 years agoclang-format: Fix case-indentation in macros.
Daniel Jasper [Mon, 2 Sep 2013 08:26:29 +0000 (08:26 +0000)]
clang-format: Fix case-indentation in macros.

Before:
  #define OPERATION_CASE(name)           \
    case OP_name:                        \
    return operations::Operation##name

After:
  #define OPERATION_CASE(name)           \
    case OP_name:                        \
      return operations::Operation##name

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

11 years agoSwitch the default mode for clang-format to '-file'. Make 'LLVM' the
Chandler Carruth [Mon, 2 Sep 2013 07:42:02 +0000 (07:42 +0000)]
Switch the default mode for clang-format to '-file'. Make 'LLVM' the
fallback syntax used when we fail to find a '.clang-format' file. Adjust
variable names appropriately.

Update the editor integration pieces that specify a '-style' option to
specify it as '-style=file'. I left the functionality in place because
even if the preferred method is to use '.clang-format' files, this way
if someone needs to clobber the style in their editor we show how to do
so in these examples.

Also check in a '.clang-format' file for Clang to ensure that separate
checkouts and builds of Clang from LLVM can still get the nice
formatting. =] This unfortunately required nuking the test for the
absence of a '.clang-format' file as now the directory happening to be
under your clang source tree will cause there to always be a file. ;]

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

11 years agoImproving objc_ownership attribute test coverage.
Aaron Ballman [Sun, 1 Sep 2013 19:11:23 +0000 (19:11 +0000)]
Improving objc_ownership attribute test coverage.

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

11 years agoClean out unused diagnostics.
Benjamin Kramer [Sat, 31 Aug 2013 14:37:34 +0000 (14:37 +0000)]
Clean out unused diagnostics.

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

11 years agoThe diagnostic err_init_conversion_failed uses the enum
Richard Trieu [Sat, 31 Aug 2013 03:50:47 +0000 (03:50 +0000)]
The diagnostic err_init_conversion_failed uses the enum
InitializedEntity::EntityKind as an index for one of its %select.  Over time,
EntityKind has been expanded, but the diagnostic text has not been updated.
This adds additional text to the %select to cover the new enum values.  A
comment has been added to the end of the enum regarding this situation.  This
fixes the crasher in PR17043.

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

11 years agoPossibly appeasing the build bots from r189711
Aaron Ballman [Sat, 31 Aug 2013 01:22:55 +0000 (01:22 +0000)]
Possibly appeasing the build bots from r189711

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

11 years agoConsolidating the notion of a GNU attribute parameter with the attribute argument...
Aaron Ballman [Sat, 31 Aug 2013 01:11:41 +0000 (01:11 +0000)]
Consolidating the notion of a GNU attribute parameter with the attribute argument list.

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

11 years agoTypo.
Eric Christopher [Sat, 31 Aug 2013 00:27:38 +0000 (00:27 +0000)]
Typo.

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

11 years agoAdd initial clang targeted compatible decls for Intrin.h. Step towards
Eric Christopher [Sat, 31 Aug 2013 00:22:48 +0000 (00:22 +0000)]
Add initial clang targeted compatible decls for Intrin.h. Step towards
a windows compatible builtin header.

Currently uses x86intrin.h for implementing intel intrinsics in a clang
specific manner.

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

11 years agoObjectiveC migrator: If we find a method that returns a C pointer
Fariborz Jahanian [Fri, 30 Aug 2013 23:52:08 +0000 (23:52 +0000)]
ObjectiveC migrator: If we find a method that returns a C pointer
of some sort (but not an object, block pointer or CF pointers),
and is not annotated with the objc_returns_inner_pointer attribute,
we should suggest NS_RETURNS_INNER_POINTER annotation for these methods.

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

11 years agoConsumed analysis: add 'consumable' class attribute.
DeLesley Hutchins [Fri, 30 Aug 2013 22:56:34 +0000 (22:56 +0000)]
Consumed analysis: add 'consumable' class attribute.
Patch by chris.wailes@gmail.com

Adds the 'consumable' attribute that can be attached to classes.  This replaces
the previous method of scanning a class's methods to see if any of them have
consumed analysis attributes attached to them.  If consumed analysis attributes
are attached to methods of a class that isn't marked 'consumable' a warning
is generated.

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

11 years ago[analyzer] Treat the rvalue of a forward-declared struct as Unknown.
Jordan Rose [Fri, 30 Aug 2013 19:17:26 +0000 (19:17 +0000)]
[analyzer] Treat the rvalue of a forward-declared struct as Unknown.

This will never happen in the analyzed code code, but can happen for checkers
that over-eagerly dereference pointers without checking that it's safe.
UnknownVal is a harmless enough value to get back.

Fixes an issue added in r189590, caught by our internal buildbot.

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

11 years agoObjectiveC migrator: infer NS_ENUM even when user
Fariborz Jahanian [Fri, 30 Aug 2013 17:46:01 +0000 (17:46 +0000)]
ObjectiveC migrator: infer NS_ENUM even when user
specified NSUInteger as the followup typedef.
With this change, NS_OPTIONS is only inferred
based on looking up how enumerators are speficied
(if they her hexadecimal, power of 2, or have
 bitwise constant expressions).

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

11 years agoReduce the number of symbols by changing how templates are instantiated per function...
Samuel Benzaquen [Fri, 30 Aug 2013 15:09:52 +0000 (15:09 +0000)]
Reduce the number of symbols by changing how templates are instantiated per function bound in the registry.

Summary:
Reduce the number of symbols by changing how templates are instantiated per function bound in the registry.
This change reduces the number of sections in Registry.cpp.o by a little over 10%.

Reviewers: klimek

CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1557

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

11 years agoAdd support for -march=slm, aka Intel Atom Silvermont.
Benjamin Kramer [Fri, 30 Aug 2013 14:05:34 +0000 (14:05 +0000)]
Add support for -march=slm, aka Intel Atom Silvermont.

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

11 years agoclang-cl: Pass -incremental:no to linker when using ASan
Hans Wennborg [Fri, 30 Aug 2013 10:50:52 +0000 (10:50 +0000)]
clang-cl: Pass -incremental:no to linker when using ASan

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

11 years agoclang-format: Enable formatting of protocol buffer definitions.
Daniel Jasper [Fri, 30 Aug 2013 10:36:58 +0000 (10:36 +0000)]
clang-format: Enable formatting of protocol buffer definitions.

Almost by accident, clang-format seems to be able to format protocol
buffer definitions (https://code.google.com/p/protobuf/).

The only change is that a space is required between numeric constants
and opening square brackets (for default values). While this might in
theory be used for array subscripts (int val = 4[MyArray]), I have not
seen this pattern in practice much. If this is wrong, we can make this
smarter in the future.

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

11 years agoclang-format: Improve recovery from enums with errors.
Daniel Jasper [Fri, 30 Aug 2013 10:10:19 +0000 (10:10 +0000)]
clang-format: Improve recovery from enums with errors.

Before:
  namespace n {
  enum Type {
    One,
    Two, // missing };
    int i;
  } void g() {
  }

After:
  namespace n {
  enum Type {
    One,
    Two, // missing };
    int i;
  }
  void g() {}

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

11 years agoRevert r188531: "Windows ToolChain: add VS bin dir to PogramPaths"
Hans Wennborg [Fri, 30 Aug 2013 09:42:06 +0000 (09:42 +0000)]
Revert r188531: "Windows ToolChain: add VS bin dir to PogramPaths"

This never really worked. Even if we find and execute link.exe in the VS bin dir
this way, link.exe wouldn't find the DLLs it needs, libraries, etc.

It also causes trouble when the user has multiple versions of VS installed,
one of them is in the path, but this code finds the other one (PR17041).

Revert until we can fix this properly.

> Windows ToolChain: add VS bin dir to PogramPaths
>
> We have a lot of fancy logic to find Visual Studio, which is currently used
> to set the system header include paths.
>
> Use the same code to set the ProgramPaths, which is used for finding programs
> such as link.exe. Previously, Clang would just search PATH for link.exe,
> but now it should find it if it's able to find Visual Studio.

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

11 years agoRevert r189649 because it was breaking sanitizer bots.
Yunzhong Gao [Fri, 30 Aug 2013 08:53:09 +0000 (08:53 +0000)]
Revert r189649 because it was breaking sanitizer bots.

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

11 years agoSema: avoid reuse of Exprs when synthesizing operator=
Pavel Labath [Fri, 30 Aug 2013 08:52:28 +0000 (08:52 +0000)]
Sema: avoid reuse of Exprs when synthesizing operator=

Summary:
Previously, Sema was reusing parts of the AST when synthesizing an assignment
operator, turning it into a AS-dag. This caused problems for the static
analyzer, which assumed an expression appears in the tree only once.

Here I make sure to always create a fresh Expr, when inserting something into
the AST, fixing PR16745 in the process.

Reviewers: doug.gregor

CC: cfe-commits, jordan_rose
Differential Revision: http://llvm-reviews.chandlerc.com/D1425

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

11 years agoclang-format: Fix incorrect indentation.
Daniel Jasper [Fri, 30 Aug 2013 08:29:25 +0000 (08:29 +0000)]
clang-format: Fix incorrect indentation.

Before:
aaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccc(
               dddddddddddddddddddddddddddddd));
aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(
    dddddddddddddddddddddddddddddd));

After:
aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccc(
    dddddddddddddddddddddddddddddd));
aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(
    dddddddddddddddddddddddddddddd));

This was overlooked when interducing the new builder-type call
detection in r189337. Also, some minor reorganization of a test.

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

11 years agoclang-format: Don't indent builders relative to "return".
Daniel Jasper [Fri, 30 Aug 2013 07:27:13 +0000 (07:27 +0000)]
clang-format: Don't indent builders relative to "return".

While this looks kind of nice, it wastes horizontal space and does not
seem to be common in the LLVM codebase.

Before:
  return llvm::StringSwitch<Reference::Kind>(name)
      .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
      .StartsWith(".eh_frame", ORDER_EH_FRAME)
      .StartsWith(".init", ORDER_INIT)
      .StartsWith(".fini", ORDER_FINI)
      .StartsWith(".hash", ORDER_HASH)
      .Default(ORDER_TEXT);

After:
  return llvm::StringSwitch<Reference::Kind>(name)
             .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
             .StartsWith(".eh_frame", ORDER_EH_FRAME)
             .StartsWith(".init", ORDER_INIT)
             .StartsWith(".fini", ORDER_FINI)
             .StartsWith(".hash", ORDER_HASH)
             .Default(ORDER_TEXT);

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

11 years agoclang-format: Fix corner case in builder-type calls.
Daniel Jasper [Fri, 30 Aug 2013 07:12:40 +0000 (07:12 +0000)]
clang-format: Fix corner case in builder-type calls.

Before:
  aaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaa()->aaaaaaaaaaaaaae(
                                                 0)->aaaaaaaaaaaaaaa();

After:
  aaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaa()
      ->aaaaaaaaaaaaaae(0)
      ->aaaaaaaaaaaaaaa();

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

11 years agoFixing a bug where debug info for a local variable gets emitted at file scope.
Yunzhong Gao [Fri, 30 Aug 2013 05:37:02 +0000 (05:37 +0000)]
Fixing a bug where debug info for a local variable gets emitted at file scope.

The patch was discussed in Phabricator. See:
http://llvm-reviews.chandlerc.com/D1281

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

11 years agoMention in AST dump whether a class declaration is a definition.
Richard Smith [Fri, 30 Aug 2013 05:32:29 +0000 (05:32 +0000)]
Mention in AST dump whether a class declaration is a definition.

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

11 years agoDon't eagerly load all conversion operators when loading a class declaration
Richard Smith [Fri, 30 Aug 2013 04:46:40 +0000 (04:46 +0000)]
Don't eagerly load all conversion operators when loading a class declaration
from a PCH/module.

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

11 years agoSimplify slightly.
Richard Smith [Fri, 30 Aug 2013 04:45:38 +0000 (04:45 +0000)]
Simplify slightly.

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

11 years agoAdd ms_abi and sysv_abi attribute handling.
Charles Davis [Fri, 30 Aug 2013 04:39:01 +0000 (04:39 +0000)]
Add ms_abi and sysv_abi attribute handling.

Based on a patch by Benno Rice!

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

11 years agoPass the special backend option to this test for now to get it passing
Eric Christopher [Fri, 30 Aug 2013 00:52:06 +0000 (00:52 +0000)]
Pass the special backend option to this test for now to get it passing
again.

This test should a) test IR or be moved, and b) get an actual option
for the dwarf pub sections.

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

11 years agoMap from local decl IDs to global decl IDs when lazily deserializing friend decl...
Richard Smith [Fri, 30 Aug 2013 00:23:29 +0000 (00:23 +0000)]
Map from local decl IDs to global decl IDs when lazily deserializing friend decl chains.

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

11 years agoObjectiveC migrator: User of hexadecimal enumerator
Fariborz Jahanian [Fri, 30 Aug 2013 00:10:37 +0000 (00:10 +0000)]
ObjectiveC migrator: User of hexadecimal enumerator
should infer migration to NS_OPTIONS.

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

11 years agoBe lazier when loading KeyFunctions from PCH/modules. We don't need to load
Richard Smith [Thu, 29 Aug 2013 23:59:27 +0000 (23:59 +0000)]
Be lazier when loading KeyFunctions from PCH/modules. We don't need to load
these in eagerly if we're not actually processing a translation unit. The added
laziness here also avoids us loading in parts of a CXXRecordDecl earlier than an
upcoming class template specialization merging patch would like.

Ideally, we should mark the vtable as used when we see a definition for the key
function, rather than having a separate pass over dynamic classes at the end of
the TU. The existing approach is pretty bad for PCH/modules, since it forcibly
loads the declarations of all key functions in all imported modules, whether or
not those key functions are defined.

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

11 years agoAdjust clang for change to APFloat::toString.
Eli Friedman [Thu, 29 Aug 2013 23:44:43 +0000 (23:44 +0000)]
Adjust clang for change to APFloat::toString.

I changed the diagnostic printing code because it's probably better
to cut off a digit from DBL_MAX than to print something like
1.300000001 when the user wrote 1.3.

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

11 years agoDebug Info: generate a unique identifier for C++ struct, class, union, and enum.
Manman Ren [Thu, 29 Aug 2013 23:19:58 +0000 (23:19 +0000)]
Debug Info: generate a unique identifier for C++ struct, class, union, and enum.

We use CXX mangler to generate unique identifier for external C++ struct,
union, class and enum. Types with unique identifier are added to retained
types by DIBuilder.

Testing cases are updated to reflect the unique identifier generated for types.
The order of MDNodes is changed because of retained types and testing cases
are updated accordingly.

Testing case debug-info-uuid.cpp now emits error with Itanium mangler, since
uuid is not yet handled in Itanium mangler. And it will check for the error
message.

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

11 years agoConsumed analysis: track function parameters.
DeLesley Hutchins [Thu, 29 Aug 2013 22:36:05 +0000 (22:36 +0000)]
Consumed analysis: track function parameters.
Patch by chris.wailes@gmail.com.

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

11 years agoConsumed analysis: non-const methods no longer transfer an object into an
DeLesley Hutchins [Thu, 29 Aug 2013 21:17:25 +0000 (21:17 +0000)]
Consumed analysis: non-const methods no longer transfer an object into an
unknown state.  Patch by chris.wailes@gmail.com.

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

11 years agoDebug Info: this reverts commit r189600.
Manman Ren [Thu, 29 Aug 2013 20:48:48 +0000 (20:48 +0000)]
Debug Info: this reverts commit r189600.

We had further discussions on how to retain types, whether to do it in front end
or in DIBuilder. And we agree to do it in DIBuilder so front ends
generating unique identifier do not need to worry about retaining them.

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

11 years agoSilencing the warning from r189605 in a more conformant manner.
Aaron Ballman [Thu, 29 Aug 2013 20:36:09 +0000 (20:36 +0000)]
Silencing the warning from r189605 in a more conformant manner.

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

11 years agoSilencing a rather spurious warning from MSVC 11 about not all control paths returnin...
Aaron Ballman [Thu, 29 Aug 2013 20:25:14 +0000 (20:25 +0000)]
Silencing a rather spurious warning from MSVC 11 about not all control paths returning a value (hint: they do).

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

11 years agoDebug Info: generate a unique identifier for C++ struct, class, union, and enum.
Manman Ren [Thu, 29 Aug 2013 18:51:51 +0000 (18:51 +0000)]
Debug Info: generate a unique identifier for C++ struct, class, union, and enum.

We use CXX mangler to generate unique identifier for external C++ struct,
union, class and enum. Types with unique identifier are added to RetainedTypes
to make sure they are treated as used even when all uses are replaced with
the identifiers.

A single type can be added to RetainedTypes multiple times. For example, both
createForwardDecl and createLimitedType can add the same type to RetainedTypes.
A set is used to avoid duplication when updating AllRetainTypes in DIBuilder.

Testing cases are updated to reflect the unique identifier generated for types.
The order of MDNodes is changed because of retained types and testing cases
are updated accordingly.

Testing case debug-info-uuid.cpp now emits error with Itanium mangler, since
uuid is not yet handled in Itanium mangler.

We choose to update RetainedTypes in clang, then at finalize(), we update
AllRetainTypes in DIBuilder. The other choice is to update AllRetainTypes
in DIBuilder when creating a DICompositeType with unique identifier. This
option requires using ValueHandle for AllRetainTypes in DIBuilder since
the created DICompositeType can be modified later on by setContainingType etc.

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

11 years agoFix warning about anonymous structs in anonymous unions.
Eric Christopher [Thu, 29 Aug 2013 18:00:58 +0000 (18:00 +0000)]
Fix warning about anonymous structs in anonymous unions.

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

11 years agoBetter support for multiline string literals (including C++11 raw string literals).
Alexander Kornienko [Thu, 29 Aug 2013 17:32:57 +0000 (17:32 +0000)]
Better support for multiline string literals (including C++11 raw string literals).

Summary:
Calculate characters in the first and the last line correctly so that
we only break before the literal when needed.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D1544

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

11 years agoConsumed analysis: improve handling of conditionals.
DeLesley Hutchins [Thu, 29 Aug 2013 17:26:57 +0000 (17:26 +0000)]
Consumed analysis: improve handling of conditionals.
Patch by chris.wailes@gmail.com.

* The TestedVarsVisitor was folded into the ConsumedStmtVisitor.
* The VarTestResult class was updated to allow these changes.
* The PropagationInfo class was updated for the same reasons.
* Correctly handle short-circuiting of Boolean operations.
* Blocks are now marked as unreachable when we can statically prove we will
  never branch to them.
* Unreachable blocks are skipped by the analysis.

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

11 years agoObjectiveC migrator: remove dead code.
Fariborz Jahanian [Thu, 29 Aug 2013 16:22:26 +0000 (16:22 +0000)]
ObjectiveC migrator: remove dead code.

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

11 years agoclang/test/Frontend/rewrite-includes.c: Tweak expressions for r'\\', not r'\', on...
NAKAMURA Takumi [Thu, 29 Aug 2013 16:11:17 +0000 (16:11 +0000)]
clang/test/Frontend/rewrite-includes.c: Tweak expressions for r'\\', not r'\', on win32.

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

11 years ago[analyzer] Fix handling of "empty" structs with base classes
Pavel Labath [Thu, 29 Aug 2013 16:06:04 +0000 (16:06 +0000)]
[analyzer] Fix handling of "empty" structs with base classes

Summary:
RegionStoreManager had an optimization which replaces references to empty
structs with UnknownVal. Unfortunately, this check didn't take into account
possible field members in base classes.

To address this, I changed this test to "is empty and has no base classes". I
don't consider it worth the trouble to go through base classes and check if all
of them are empty.

Reviewers: jordan_rose

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1547

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

11 years agoFix tests to be more specific.
Samuel Benzaquen [Thu, 29 Aug 2013 15:39:26 +0000 (15:39 +0000)]
Fix tests to be more specific.
The environments can inject some declaration in every translation unit,
which can match very generic matchers, thus failing the tests.

Summary:
Fix tests to be more specific.
The environments can inject some declaration in every translation unit,
which can match very generic matchers, thus failing the tests.

Reviewers: aaron.ballman

CC: klimek, cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1541

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

11 years agoFixes various problems with accounting for tabs in the original code.
Manuel Klimek [Thu, 29 Aug 2013 15:21:40 +0000 (15:21 +0000)]
Fixes various problems with accounting for tabs in the original code.

We now count the original token's column directly when lexing the
tokens, where we already have all knowledge about where lines start.

Before this patch, formatting:
 void f() {
 \tg();
 \th();
 }
would incorrectly count the \t's as 1 character if only the line
containing h() was reformatted, and thus indent h() at offset 1.

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

11 years agoUse new UnicodeCharSet interface.
Alexander Kornienko [Thu, 29 Aug 2013 12:12:31 +0000 (12:12 +0000)]
Use new UnicodeCharSet interface.

Summary: This is a Clang part of http://llvm-reviews.chandlerc.com/D1534

Reviewers: jordan_rose, klimek, rsmith

Reviewed By: rsmith

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1535

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

11 years agoRemoved useless default branch of switch statement.
Serge Pavlov [Thu, 29 Aug 2013 08:20:07 +0000 (08:20 +0000)]
Removed useless default branch of switch statement.
The problem was caught by sanitizer build.

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

11 years ago mangle aarch64 Neon ACLE scalar instrinsic name with BHSD suffix.
Kevin Qin [Thu, 29 Aug 2013 07:55:15 +0000 (07:55 +0000)]
 mangle aarch64 Neon ACLE scalar instrinsic name with BHSD suffix.

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

11 years agoChange return type of Sema::DiagnoseAmbiguousLookup from bool to void.
Serge Pavlov [Thu, 29 Aug 2013 07:23:24 +0000 (07:23 +0000)]
Change return type of Sema::DiagnoseAmbiguousLookup from bool to void.
The function always returned true value, which was never used.

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

11 years agoMake getDiagnosticsInGroup helper method a static function in the cpp file and move...
Craig Topper [Thu, 29 Aug 2013 06:06:18 +0000 (06:06 +0000)]
Make getDiagnosticsInGroup helper method a static function in the cpp file and move the WarningOption struct into an anonymous namespace instead of clang namespace since it no longer needs to be forward declared in the header.

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

11 years agoMove individual group name strings from the OptionTable into one big char array....
Craig Topper [Thu, 29 Aug 2013 05:18:04 +0000 (05:18 +0000)]
Move individual group name strings from the OptionTable into one big char array. Then only store offsets into it in the OptionTable. Saves about 4K from the clang binary and removes 400 relocation entries from DiagnosticIDs.o.

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

11 years ago[tests] Use 'printf' instead of 'echo -e', which is not part of BSD echo.
Daniel Dunbar [Thu, 29 Aug 2013 03:02:39 +0000 (03:02 +0000)]
[tests] Use 'printf' instead of 'echo -e', which is not part of BSD echo.

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

11 years agoTwo more definitions required by libsupc++ (_sleb128_t and _uleb128_t)
Peter Collingbourne [Thu, 29 Aug 2013 01:56:22 +0000 (01:56 +0000)]
Two more definitions required by libsupc++ (_sleb128_t and _uleb128_t)

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

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

11 years agoProperly escape filenames in line directives.
Eli Friedman [Thu, 29 Aug 2013 01:42:42 +0000 (01:42 +0000)]
Properly escape filenames in line directives.

Fixes PR17018.  Only partial test coverage because I don't want
to try to write a test which generates a file whose name contains a newline.

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

11 years agoRemove Inheritable/NonInheritable flags from ProcessDeclAttributes. They don't
Richard Smith [Thu, 29 Aug 2013 00:47:48 +0000 (00:47 +0000)]
Remove Inheritable/NonInheritable flags from ProcessDeclAttributes. They don't
do anything useful.

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

11 years agouse the last passed -munaligned-access / -mno-unaligned-access
Renato Golin [Wed, 28 Aug 2013 23:56:07 +0000 (23:56 +0000)]
use the last passed -munaligned-access / -mno-unaligned-access

Passing inconsistent munaligned-access / mno-unaligned-access
flags, intentionally resulted in a warning and the flag
no-unaligned-access being used.

Gcc does, at least in practice, use the last flag in such a
case. This patch updates clang behaviour accordingly; use the
last flag or base alignment behaviour on the target (which
llvm will do if no flag is explicitly passed)

Patch by Jeroen Hofstee.

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

11 years agoSema: Subst type default template args earlier
David Majnemer [Wed, 28 Aug 2013 23:48:32 +0000 (23:48 +0000)]
Sema: Subst type default template args earlier

Summary:
We would not perform substitution at an appropriate point, allowing strange
results to appear. We would accepts things that we shouldn't or mangle things incorrectly.  Note that this hasn't fixed the other cases like
template-template parameters or non-type template parameters.

Reviewers: doug.gregor, rjmccall, rsmith

Reviewed By: rsmith

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1507

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

11 years ago80 cols.
Peter Collingbourne [Wed, 28 Aug 2013 23:32:22 +0000 (23:32 +0000)]
80 cols.

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

11 years agoObjectiveC migrator. This patch infers readonly properties for no-parameter
Fariborz Jahanian [Wed, 28 Aug 2013 23:22:46 +0000 (23:22 +0000)]
ObjectiveC migrator. This patch infers readonly properties for no-parameter
instance methods returning non-void. This will be quite noisy. So, it is
placed under a new migrator flag -objcmt-migrate-readonly-property.

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

11 years agoLook for libstdc++ first on the clang install directory.
Rafael Espindola [Wed, 28 Aug 2013 23:17:47 +0000 (23:17 +0000)]
Look for libstdc++ first on the clang install directory.

When sysroot is not set, look for libstdc++ first on the clang install
directory. Before this change if clang was installed alongside a gcc with
the same version as the system one we would select the system libstdc++.

Unfortunately this is hard to test as only the non-sysroot case is changed.

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

11 years agoAdd missing definitions to unwind.h.
Peter Collingbourne [Wed, 28 Aug 2013 23:16:49 +0000 (23:16 +0000)]
Add missing definitions to unwind.h.

Original patch by Charles Davis.

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

11 years agoMode is now handled as a non-inheritable attribute, and CUDADevice & CUDAHost are...
Aaron Ballman [Wed, 28 Aug 2013 23:13:26 +0000 (23:13 +0000)]
Mode is now handled as a non-inheritable attribute, and CUDADevice & CUDAHost are now handled as inheritable attributes.  In all three cases, this makes the processing behavior more consistent with the declared behavior in Attr.td.

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

11 years ago80-col.
Eric Christopher [Wed, 28 Aug 2013 23:12:10 +0000 (23:12 +0000)]
80-col.

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

11 years agoDebugInfo: Further fix/improvements to r189494 (and LLVM r189495).
David Blaikie [Wed, 28 Aug 2013 23:06:52 +0000 (23:06 +0000)]
DebugInfo: Further fix/improvements to r189494 (and LLVM r189495).

Selfhosting was crashing with the same type of problem but involving
template specializations.

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

11 years ago[doxygen] Add a few missing variables to the doxygen.cfg.in for external search and...
Michael Gottesman [Wed, 28 Aug 2013 21:55:41 +0000 (21:55 +0000)]
[doxygen] Add a few missing variables to the doxygen.cfg.in for external search and cleaned up external_search_map.

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

11 years agoFormat. Thanks David for pointing it out.
Manman Ren [Wed, 28 Aug 2013 21:46:36 +0000 (21:46 +0000)]
Format. Thanks David for pointing it out.

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

11 years agoObjectiveC migrator: In suggesting 'instancetype' use clang's
Fariborz Jahanian [Wed, 28 Aug 2013 21:23:00 +0000 (21:23 +0000)]
ObjectiveC migrator: In suggesting 'instancetype' use clang's
hasRelatedResultType() as it knows of methods which have
related result type by default. Such methods do not need
a redundant 'instancetype'.

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

11 years agoDebug Info: update interface for CreateEnumType and getOrCreateRecordFwdDecl.
Manman Ren [Wed, 28 Aug 2013 21:20:28 +0000 (21:20 +0000)]
Debug Info: update interface for CreateEnumType and getOrCreateRecordFwdDecl.

Both functions will take a Type pointer instead of a Decl pointer. This helps
with follow-up type uniquing patches, which need the Type pointer to call
CXX mangler to generate unique identifiers.

No functionality change.

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

11 years agoDebug Info testing case: update uuid testing case to check against Itanium.
Manman Ren [Wed, 28 Aug 2013 21:19:31 +0000 (21:19 +0000)]
Debug Info testing case: update uuid testing case to check against Itanium.

Right now, the output for Itanium vs. Microsoft is the same. Once we start
calling mangler to get the unique identifier, this testing case will require
support for uuid mangling.

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

11 years agoMore comments for r189494.
David Blaikie [Wed, 28 Aug 2013 20:58:00 +0000 (20:58 +0000)]
More comments for r189494.

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

11 years agoFix "//" comments with -traditional-cpp in C++.
Eli Friedman [Wed, 28 Aug 2013 20:53:32 +0000 (20:53 +0000)]
Fix "//" comments with -traditional-cpp in C++.

Apparently, gcc's -traditional-cpp behaves slightly differently in C++ mode;
specifically, it discards "//" comments.  Match gcc's behavior.

<rdar://problem/14808126>

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

11 years agoFor methods where clang automatically infers instancetype from the selector
Fariborz Jahanian [Wed, 28 Aug 2013 20:49:58 +0000 (20:49 +0000)]
For methods where clang automatically infers instancetype from the selector
(e.g., all -init* methods), no need to suggest "instancetype" because it
is redundant.

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

11 years agoHandle -D arguments ending in a backslash.
Eli Friedman [Wed, 28 Aug 2013 20:35:38 +0000 (20:35 +0000)]
Handle -D arguments ending in a backslash.

We translate these into #define directives; to preserve gcc-compatible
semantics (where the expanded macro includes the backslash), we add
an extra "\\\n" to the end of the synthesized "#define".

<rdar://problem/14810220>

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

11 years agoImprove error for assignment to incomplete class.
Eli Friedman [Wed, 28 Aug 2013 20:35:35 +0000 (20:35 +0000)]
Improve error for assignment to incomplete class.

PR7681.

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

11 years ago[doxygen] Added support for doxygen external search.
Michael Gottesman [Wed, 28 Aug 2013 20:29:44 +0000 (20:29 +0000)]
[doxygen] Added support for doxygen external search.

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

11 years ago[doxygen] Added code for generating doxygen documentation for clang for cmake.
Michael Gottesman [Wed, 28 Aug 2013 20:29:40 +0000 (20:29 +0000)]
[doxygen] Added code for generating doxygen documentation for clang for cmake.

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

11 years agoComments for r189494
David Blaikie [Wed, 28 Aug 2013 20:24:55 +0000 (20:24 +0000)]
Comments for r189494

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

11 years agoAdd support for eachOf/allOf/anyOf variadic matchers in the dynamic layer.
Samuel Benzaquen [Wed, 28 Aug 2013 18:42:04 +0000 (18:42 +0000)]
Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer.

Summary:
Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer.
These function require some late binding behavior for the type conversions, thus changes in VariadicValue's MatcherList.
Second try. This time with a fix for C++11 builds.

Reviewers: klimek

CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1536

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

11 years agoDebug Info testing case: move uuid-related testing to a separate file.
Manman Ren [Wed, 28 Aug 2013 18:31:02 +0000 (18:31 +0000)]
Debug Info testing case: move uuid-related testing to a separate file.

Seperate the parts related to uuid from debug-info-template.cpp to
debug-info-uuid.cpp since Itanium mangler does not have support for mangling
uuid yet.

Remove -fms-extensions from RUN line of debug-info-template.cpp.
RUN line of debug-info-uuid.cpp has -fms-extensions and -cxx-abi microsoft.

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

11 years agoclang-cl: Pass -debug to the linker when using -fsanitize=address
Hans Wennborg [Wed, 28 Aug 2013 17:36:07 +0000 (17:36 +0000)]
clang-cl: Pass -debug to the linker when using -fsanitize=address

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

11 years agoPR16995: Failing to associate static members with their enclosing class
David Blaikie [Wed, 28 Aug 2013 17:27:13 +0000 (17:27 +0000)]
PR16995: Failing to associate static members with their enclosing class

In the transition from declaration (with some members) to definition, we
were overwriting the list of members with the empty list when attaching
template parameters.

The fix is in llvm::DICompositeType::addMember (along with asserts that
cause this bug to be covered by existing Clang test cases), including
adding some asserts to catch this sort of issue which found issues fixed
in this commit.

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

11 years ago[analyzer] Add support for testing the presence of weak functions.
Jordan Rose [Wed, 28 Aug 2013 17:07:04 +0000 (17:07 +0000)]
[analyzer] Add support for testing the presence of weak functions.

When casting the address of a FunctionTextRegion to bool, or when adding
constraints to such an address, use a stand-in symbol to represent the
presence or absence of the function if the function is weakly linked.
This is groundwork for possible simple availability testing checks, and
can already catch mistakes involving inverted null checks for
weakly-linked functions.

Currently, the implementation reuses the "extent" symbols, originally created
for tracking the size of a malloc region. Since FunctionTextRegions cannot
be dereferenced, the extent symbol will never be used for anything else.
Still, this probably deserves a refactoring in the future.

This patch does not attempt to support testing the presence of weak
/variables/ (global variables), which would likely require much more of
a change and a generalization of "region structure metadata", like the
current "extents", vs. "region contents metadata", like CStringChecker's
"string length".

Patch by Richard <tarka.t.otter@googlemail.com>!

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

11 years agoclang-format: Improve token breaking behavior.
Daniel Jasper [Wed, 28 Aug 2013 10:03:58 +0000 (10:03 +0000)]
clang-format: Improve token breaking behavior.

Two changes:
* Don't add an extra penalty on breaking the same token multiple times.
  Generally, we should prefer not to break, but once we break, the
  normal line breaking penalties apply.
* Slightly increase the penalty for breaking comments. In general, the
  author has put some thought into how to break the comment and we
  should not overwrite this unnecessarily.

With a 40-column column limit, formatting
  aaaaaa("aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa");

Leads to:
Before:
  aaaaaa(
      "aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa "
      "aaaaaaaaaaaaaaaa");

After:
  aaaaaa("aaaaaaaaaaaaaaaa "
         "aaaaaaaaaaaaaaaa "
         "aaaaaaaaaaaaaaaa");

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

11 years agoARM: comment on why vmull intrinsic has to exist for now.
Tim Northover [Wed, 28 Aug 2013 09:46:40 +0000 (09:46 +0000)]
ARM: comment on why vmull intrinsic has to exist for now.

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

11 years agoARM: Emit normal IR for vaddhn/vsubhn NEON intrinsics
Tim Northover [Wed, 28 Aug 2013 09:46:37 +0000 (09:46 +0000)]
ARM: Emit normal IR for vaddhn/vsubhn NEON intrinsics

These operations "vector add high-half narrow" actually correspond to the
sequence:

    %sum = add <4 x i32> %lhs, %rhs
    %high = lshr <4 x i32> %sum, <i32 16, i32 16, i32 16, i32 16>
    %res = trunc <4 x i32> %high to <4 x i16>

Now that LLVM can spot this, Clang should emit the corresponding LLVM IR.

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

11 years agoARM: use vqdmull and vqadds/vqsubs to implement vqdmlal/vqdmlsl
Tim Northover [Wed, 28 Aug 2013 09:46:34 +0000 (09:46 +0000)]
ARM: use vqdmull and vqadds/vqsubs to implement vqdmlal/vqdmlsl

The NEON intrinsics vqdmlal and vqdmlsl are really just combinations of a
saturating-doubling-multiply (vqdmull) and a saturating add/sub, so now that
LLVM can spot those patterns Clang should emit them instead of specialised
intrinsics.

Feature already tested by existing ARM NEON intrinsics tests.

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

11 years agoclang-format: Fix segfault in 'incomplete' macros.
Daniel Jasper [Wed, 28 Aug 2013 09:17:37 +0000 (09:17 +0000)]
clang-format: Fix segfault in 'incomplete' macros.

The code leading to a segfault was:
  #pragma omp threadprivate(y)), // long comment leading to a line break

This fixes llvm.org/PR16513.

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

11 years agoclang-format: Fix infinite loop in macro special case.
Daniel Jasper [Wed, 28 Aug 2013 09:07:32 +0000 (09:07 +0000)]
clang-format: Fix infinite loop in macro special case.

If escaped newlines are aligned right
(FormatStyle.AlignEscapedNewlinesLeft == false), and a line contained
too many characters to fit into the column limit, this would result in
a (virtually) endless loop creating a negative number of spaces.

Instead, allow the escaped newlines to be pushed past the column limit
in this case.

This fixes llvm.org/PR16515.

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

11 years agoclang-format: Don't insert space in __has_include
Daniel Jasper [Wed, 28 Aug 2013 08:24:04 +0000 (08:24 +0000)]
clang-format: Don't insert space in __has_include

Before:
  #if __has_include( <strstream>)
  #include <strstream>
  #endif

After:
  #if __has_include(<strstream>)
  #include <strstream>
  #endif

This fixes llvm.org/PR16516.

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

11 years agoclang-format: Fix corner case in ObjC interface definitions.
Daniel Jasper [Wed, 28 Aug 2013 08:04:23 +0000 (08:04 +0000)]
clang-format: Fix corner case in ObjC interface definitions.

In
  @implementation ObjcClass
  - (void)method;
  {
  }
  @end
the ObjC compiler seems to accept the superfluous comma after "method",
but clang-format used to assert on the subsequent "{".

This fixes llvm.org/PR16604.

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

11 years ago[analyzer] Assume new returns non-null even under -fno-exceptions
Pavel Labath [Wed, 28 Aug 2013 08:04:08 +0000 (08:04 +0000)]
[analyzer] Assume new returns non-null even under -fno-exceptions

Summary:
-fno-exceptions does not implicitly attach a nothrow specifier to every operator
new. Even in this mode, non-nothrow new must not return a null pointer. Failure
to allocate memory can be signalled by other means, or just by killing the
program. This behaviour is consistent with the compiler - even with
-fno-exceptions, the generated code never tests for null (and would segfault if
the opeator actually happened to return null).

Reviewers: jordan_rose

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1528

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