Commit Graph

47744 Commits

Author SHA1 Message Date
Rafael Espindola b8e430d695 Use -O0 in this test too.
llvm-svn: 189884
2013-09-03 23:31:28 +00:00
Reid Kleckner f3ad720130 clang-cl: Make -W a core option so we can adjust clang warnings.
llvm-svn: 189882
2013-09-03 23:18:43 +00:00
Rafael Espindola 0dc1f313e2 Don't run optimizations in a clang test.
llvm-svn: 189880
2013-09-03 23:14:03 +00:00
David Majnemer ad01851f32 Parser: support Microsoft syntax for 'typename typedef'
Summary:
Transform the token sequence for:
typename typedef T U;

to:
typename T typedef U;

Raise a diagnostic when this happens but only if we succeeded handling
the typename.

Reviewers: rsmith, rnk

Reviewed By: rsmith

CC: cfe-commits

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

llvm-svn: 189867
2013-09-03 22:36:22 +00:00
DeLesley Hutchins e13ce180f2 Consumed analysis: update to comments in test cases.
Patch by chris.wailes@gmail.com.

llvm-svn: 189866
2013-09-03 22:35:53 +00:00
Reid Kleckner b9921df29c Emit uuid globals as linkonce_odr
Patch by Nico Rieck!

llvm-svn: 189860
2013-09-03 21:49:32 +00:00
David Blaikie 43472b3d18 Reference extension is weird/surprising and unnecessary, let's not do that.
Found by Chris Wailes

llvm-svn: 189859
2013-09-03 21:40:15 +00:00
Richard Smith e7d67f2e01 Simplify. This function bails out a few lines above if !Found.empty().
llvm-svn: 189857
2013-09-03 21:22:41 +00:00
Rafael Espindola ee6aa0c62e Don't emit an available_externally vtable pointing to linkonce_odr funcs.
This fixes pr13124.

From the discussion at
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-June/022606.html
we know that we cannot make funcions in a weak_odr vtable also weak_odr. They
should remain linkonce_odr.

The side effect is that we cannot emit a available_externally vtable unless we
also emit a copy of the function. This also has an issue: If codegen is going
to output a function, sema has to mark it used. Given llvm.org/pr9114, it looks
like sema cannot be more aggressive at marking functions used because
of vtables.

This leaves us with a few unpleasant options:

* Marking functions in vtables used if possible. This sounds a bit sloppy, so
  we should avoid it.
* Producing available_externally vtables only when all the functions in it are
  already used or weak_odr. This would cover cases like

--------------------
struct foo {
  virtual ~foo();
};
struct bar : public foo {
  virtual void zed();
};
void f() {
  foo *x(new bar);
  delete x;
}
void g(bar *x) {
  x->~bar(); // force the destructor to be used
}
--------------------------

and

----------------------------------
template<typename T>
struct bar {
  virtual ~bar();
};
template<typename T>
bar<T>::~bar() {
}

// make the destructor weak_odr instead of linkonce_odr
extern template class bar<int>;

void f() {
  bar<int> *x(new bar<int>);
  delete x;
}
----------------------------

These look like corner cases, so it is unclear if it is worth it.

* And finally: Just nuke this optimization. That is what this patch implements.

llvm-svn: 189852
2013-09-03 21:05:13 +00:00
Aaron Ballman f58070baed Switched FormatAttr to using an IdentifierArgument instead of a StringArgument since that is a more accurate modeling.
llvm-svn: 189851
2013-09-03 21:02:22 +00:00
Richard Smith 3c78578f33 Refactor computation of whether a variable declaration's type should be merged
with a prior declaration. No functionality change intended.

llvm-svn: 189850
2013-09-03 21:00:58 +00:00
Eric Christopher de156243e1 Fix non-void return warning, and format.
llvm-svn: 189845
2013-09-03 20:43:00 +00:00
Eric Christopher 27121641d8 Remove unused typedef.
llvm-svn: 189844
2013-09-03 20:25:28 +00:00
DeLesley Hutchins fc368259af Consumed analysis: add return_typestate attribute.
Patch by chris.wailes@gmail.com

Functions can now declare what state the consumable type the are returning will
be in. This is then used on the caller side and checked on the callee side.
Constructors now use this attribute instead of the 'consumes' attribute.

llvm-svn: 189843
2013-09-03 20:11:38 +00:00
Jim Grosbach 362bf98ec6 ARM: Update testcases for improved codegen.
From llvm r189841.

llvm-svn: 189842
2013-09-03 20:08:30 +00:00
Richard Smith f7ca0c0382 Update GCC attribute argument parsing comment to better reflect what's going on
here.

llvm-svn: 189838
2013-09-03 18:57:36 +00:00
Richard Smith feefaf5724 Factor out parsing and allocation of IdentifierLoc objects.
llvm-svn: 189833
2013-09-03 18:01:40 +00:00
Jordan Rose d2f4079db9 Add an implicit dtor CFG node just before C++ 'delete' expressions.
This paves the way for adding support for modeling the destructor of a
region before it is deleted. The statement "delete <expr>" now generates
this series of CFG elements:

  1. <expr>
  2. [B1.1]->~Foo() (Implicit destructor)
  3. delete [B1.1]

Patch by Karthik Bhat!

llvm-svn: 189828
2013-09-03 17:00:57 +00:00
Eric Christopher 0819816887 Attempt to migrate default dwarf version to 4 for linux.
llvm-svn: 189823
2013-09-03 16:10:12 +00:00
Rafael Espindola 8a777db90c Pass -target instead of using "REQUIRES: clang-driver".
llvm-svn: 189822
2013-09-03 16:05:48 +00:00
Manuel Klimek ffdeb595ba First step towards correctly formatting lambdas.
Implements parsing of lambdas in the UnwrappedLineParser.
This introduces the correct line breaks; the formatting of
lambda captures are still incorrect, and the braces are also
still formatted as if they were braced init lists instead of
blocks.

llvm-svn: 189818
2013-09-03 15:10:01 +00:00
Pavel Labath 515f4db4f9 Remove useless reinterpret_casts from Stmt.cpp
Summary:
I have no idea why these were there in the first place, but now they are
certainly not necessary.

Reviewers: rsmith

CC: cfe-commits

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

llvm-svn: 189813
2013-09-03 14:41:16 +00:00
Rafael Espindola e892ccec0d Revert "OpenMP: Data-sharing attributes analysis and clause 'shared'"
This reverts commit r189795.

threadprivate_messages.cpp is faling on windows.

llvm-svn: 189811
2013-09-03 14:33:09 +00:00
Rafael Espindola 11b9581d43 Disable this on mingw again.
I will investigate why it still fails, but for now this gets the bots green.

llvm-svn: 189807
2013-09-03 14:09:54 +00:00
Rafael Espindola 67fc63d170 Remove unused group.
llvm-svn: 189805
2013-09-03 13:47:54 +00:00
Rafael Espindola 0c9fa3f982 Use -### instead of -ccc-print-options.
Convert the last few tests using -ccc-print-options to -### and remove
-ccc-print-options.

llvm-svn: 189802
2013-09-03 13:26:49 +00:00
Samuel Benzaquen aa15689c79 Remove DynCastMatcher, since it is pretty much the same as Matcher<T>::WrappedMatcher.
Summary:
Remove DynCastMatcher, since it is pretty much the same as Matcher<T>::WrappedMatcher.
This reduces the number of template instantiations and number of symbols in the object file.

Reviewers: klimek

CC: cfe-commits, revane

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

llvm-svn: 189800
2013-09-03 13:21:01 +00:00
Alexey Bataev d4183dabd7 OpenMP: Data-sharing attributes analysis and clause 'shared'
llvm-svn: 189795
2013-09-03 12:55:52 +00:00
Rafael Espindola 32fd46c936 Remove 3 unused ccc options.
llvm-svn: 189794
2013-09-03 12:51:46 +00:00
Jin-Gu Kang 09c2213ce6 the call to UsualArithmeticConversions should come after the call to CheckVectorOperands on CheckConditionalOperands function. This problem caused compilation error with test17 on "test/CodeGen/ext-vector.c".
llvm-svn: 189773
2013-09-02 20:32:37 +00:00
Chandler Carruth b4a4326824 Mark that qualifiers can prefix the auto type. This seems to just have
been an oversight, as it definitely works. Every test which changed had
the const written on the LHS of the auto already.

Notably, this also makes things like cpp11-migrate's formation of 'const
auto &' variables much more familiar.

Yes, many people feel that 'const' and other qualifiers belong on the
RHS of the type. I'm not going to argue about that because Clang already
*overwhelming* places the qualifiers on the LHS when it can and on the
RHS when it must. We shouldn't diverge for auto. We should add a tool to
clang-tidy that fixes this in either direction, and then wire up
clang-tidy to tools like cpp11-migrate to fix their placement after
transforms.

llvm-svn: 189769
2013-09-02 19:20:06 +00:00
Alexander Kornienko e3648fbe1a Added WebKit style to the BasedOnStyle handling and to the relevant help messages.
llvm-svn: 189765
2013-09-02 16:39:23 +00:00
Alexander Kornienko d83adf30c6 Whitespace changes in help messages + updated help output in .rst file.
llvm-svn: 189762
2013-09-02 15:30:26 +00:00
Alexander Kornienko 22479f7d99 Trying to fix tests with in-tree builds, that contain a .clang-format files in
both tools/clang and llvm directories.

llvm-svn: 189761
2013-09-02 14:25:56 +00:00
Renato Golin 47aeab5cbe Fix gnueeabi typo in tests
llvm-svn: 189759
2013-09-02 14:11:33 +00:00
Alexander Kornienko 632abb9b21 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

llvm-svn: 189758
2013-09-02 13:58:14 +00:00
Alexander Kornienko 9acf3dbf1d 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

llvm-svn: 189757
2013-09-02 13:44:16 +00:00
Daniel Jasper 42401c8d13 clang-format: Fix segfault in overloaded operator parsing.
Before, constructs like:
  using A::operator+;

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

llvm-svn: 189749
2013-09-02 09:20:39 +00:00
Pavel Labath d527cf89e6 [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

llvm-svn: 189746
2013-09-02 09:09:15 +00:00
Daniel Jasper 7240762504 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

llvm-svn: 189743
2013-09-02 08:26:29 +00:00
Chandler Carruth bc36e6e099 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. ;]

llvm-svn: 189741
2013-09-02 07:42:02 +00:00
Aaron Ballman 5e13985df8 Improving objc_ownership attribute test coverage.
llvm-svn: 189731
2013-09-01 19:11:23 +00:00
Benjamin Kramer b5e6300be5 Clean out unused diagnostics.
llvm-svn: 189721
2013-08-31 14:37:34 +00:00
Richard Trieu ad00e83ae4 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.

llvm-svn: 189716
2013-08-31 03:50:47 +00:00
Aaron Ballman 4d236845e9 Possibly appeasing the build bots from r189711
llvm-svn: 189712
2013-08-31 01:22:55 +00:00
Aaron Ballman 00e99966c4 Consolidating the notion of a GNU attribute parameter with the attribute argument list.
llvm-svn: 189711
2013-08-31 01:11:41 +00:00
Eric Christopher fb4b433bbb Typo.
llvm-svn: 189710
2013-08-31 00:27:38 +00:00
Eric Christopher d1428bf635 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.

llvm-svn: 189709
2013-08-31 00:22:48 +00:00
Fariborz Jahanian d0fbf6cebd 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. 

llvm-svn: 189707
2013-08-30 23:52:08 +00:00
DeLesley Hutchins 5a715c4f00 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.

llvm-svn: 189702
2013-08-30 22:56:34 +00:00
Jordan Rose e600025528 [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.

llvm-svn: 189688
2013-08-30 19:17:26 +00:00
Fariborz Jahanian ff3476e499 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).

llvm-svn: 189682
2013-08-30 17:46:01 +00:00
Samuel Benzaquen 998cda23b9 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

llvm-svn: 189676
2013-08-30 15:09:52 +00:00
Benjamin Kramer ffecc84583 Add support for -march=slm, aka Intel Atom Silvermont.
llvm-svn: 189670
2013-08-30 14:05:34 +00:00
Hans Wennborg d024c1c803 clang-cl: Pass -incremental:no to linker when using ASan
llvm-svn: 189664
2013-08-30 10:50:52 +00:00
Daniel Jasper 8ddfa8489b 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.

llvm-svn: 189663
2013-08-30 10:36:58 +00:00
Daniel Jasper b715087278 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() {}

llvm-svn: 189662
2013-08-30 10:10:19 +00:00
Hans Wennborg 1cc6cce9a6 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.

llvm-svn: 189661
2013-08-30 09:42:06 +00:00
Yunzhong Gao 0ebf1bb150 Revert r189649 because it was breaking sanitizer bots.
llvm-svn: 189660
2013-08-30 08:53:09 +00:00
Pavel Labath 58934986f2 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

llvm-svn: 189659
2013-08-30 08:52:28 +00:00
Daniel Jasper f79b0b1562 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.

llvm-svn: 189658
2013-08-30 08:29:25 +00:00
Daniel Jasper 2cf664fb86 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);

llvm-svn: 189657
2013-08-30 07:27:13 +00:00
Daniel Jasper f8151e9bc1 clang-format: Fix corner case in builder-type calls.
Before:
  aaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaa()->aaaaaaaaaaaaaae(
                                                 0)->aaaaaaaaaaaaaaa();

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

llvm-svn: 189655
2013-08-30 07:12:40 +00:00
Yunzhong Gao be8d7ba93a 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

llvm-svn: 189649
2013-08-30 05:37:02 +00:00
Richard Smith 99bc1b99d3 Mention in AST dump whether a class declaration is a definition.
llvm-svn: 189647
2013-08-30 05:32:29 +00:00
Richard Smith a4ba74c5f5 Don't eagerly load all conversion operators when loading a class declaration
from a PCH/module.

llvm-svn: 189646
2013-08-30 04:46:40 +00:00
Richard Smith 8568e576b0 Simplify slightly.
llvm-svn: 189645
2013-08-30 04:45:38 +00:00
Charles Davis b5a214e4f3 Add ms_abi and sysv_abi attribute handling.
Based on a patch by Benno Rice!

llvm-svn: 189644
2013-08-30 04:39:01 +00:00
Eric Christopher 531cd4b278 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.

llvm-svn: 189633
2013-08-30 00:52:06 +00:00
Richard Smith 9dd9f036c6 Map from local decl IDs to global decl IDs when lazily deserializing friend decl chains.
llvm-svn: 189629
2013-08-30 00:23:29 +00:00
Fariborz Jahanian a23f4fb5c9 ObjectiveC migrator: User of hexadecimal enumerator
should infer migration to NS_OPTIONS.

llvm-svn: 189628
2013-08-30 00:10:37 +00:00
Richard Smith 676c404dec 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.

llvm-svn: 189627
2013-08-29 23:59:27 +00:00
Eli Friedman 0718591771 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.

llvm-svn: 189625
2013-08-29 23:44:43 +00:00
Manman Ren e0064d8c24 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.

llvm-svn: 189622
2013-08-29 23:19:58 +00:00
DeLesley Hutchins b570c13574 Consumed analysis: track function parameters.
Patch by chris.wailes@gmail.com.

llvm-svn: 189616
2013-08-29 22:36:05 +00:00
DeLesley Hutchins 7fa60edb47 Consumed analysis: non-const methods no longer transfer an object into an
unknown state.  Patch by chris.wailes@gmail.com.

llvm-svn: 189612
2013-08-29 21:17:25 +00:00
Manman Ren f801f808ba 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.

llvm-svn: 189609
2013-08-29 20:48:48 +00:00
Aaron Ballman a21f4b8ddd Silencing the warning from r189605 in a more conformant manner.
llvm-svn: 189606
2013-08-29 20:36:09 +00:00
Aaron Ballman 130db36d80 Silencing a rather spurious warning from MSVC 11 about not all control paths returning a value (hint: they do).
llvm-svn: 189605
2013-08-29 20:25:14 +00:00
Manman Ren 035c4b029f 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.

llvm-svn: 189600
2013-08-29 18:51:51 +00:00
Eric Christopher f8a1baab9d Fix warning about anonymous structs in anonymous unions.
llvm-svn: 189596
2013-08-29 18:00:58 +00:00
Alexander Kornienko d7b837e78d 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

llvm-svn: 189595
2013-08-29 17:32:57 +00:00
DeLesley Hutchins 5533ec5c55 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.

llvm-svn: 189594
2013-08-29 17:26:57 +00:00
Fariborz Jahanian 4ccdc73f44 ObjectiveC migrator: remove dead code.
llvm-svn: 189592
2013-08-29 16:22:26 +00:00
NAKAMURA Takumi 5cbfb3b423 clang/test/Frontend/rewrite-includes.c: Tweak expressions for r'\\', not r'\', on win32.
llvm-svn: 189591
2013-08-29 16:11:17 +00:00
Pavel Labath 2c65dfaab5 [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

llvm-svn: 189590
2013-08-29 16:06:04 +00:00
Samuel Benzaquen 68cd396f82 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

llvm-svn: 189587
2013-08-29 15:39:26 +00:00
Manuel Klimek 31c85921b2 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.

llvm-svn: 189585
2013-08-29 15:21:40 +00:00
Alexander Kornienko 37d6b18633 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

llvm-svn: 189583
2013-08-29 12:12:31 +00:00
Serge Pavlov 0ccd3f61b1 Removed useless default branch of switch statement.
The problem was caught by sanitizer build.

llvm-svn: 189575
2013-08-29 08:20:07 +00:00
Kevin Qin c076d0682b mangle aarch64 Neon ACLE scalar instrinsic name with BHSD suffix.
llvm-svn: 189574
2013-08-29 07:55:15 +00:00
Serge Pavlov 9929209dfb Change return type of Sema::DiagnoseAmbiguousLookup from bool to void.
The function always returned true value, which was never used.

llvm-svn: 189571
2013-08-29 07:23:24 +00:00
Craig Topper b78e9d9b2f 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.
llvm-svn: 189569
2013-08-29 06:06:18 +00:00
Craig Topper da7cf8ab2b 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.
llvm-svn: 189568
2013-08-29 05:18:04 +00:00
Daniel Dunbar 14e88a1577 [tests] Use 'printf' instead of 'echo -e', which is not part of BSD echo.
llvm-svn: 189562
2013-08-29 03:02:39 +00:00
Peter Collingbourne 6c77e72659 Two more definitions required by libsupc++ (_sleb128_t and _uleb128_t)
Differential Revision: http://llvm-reviews.chandlerc.com/D1542

llvm-svn: 189558
2013-08-29 01:56:22 +00:00
Eli Friedman 80e45b8cd4 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.

llvm-svn: 189557
2013-08-29 01:42:42 +00:00
Richard Smith f8a75c3793 Remove Inheritable/NonInheritable flags from ProcessDeclAttributes. They don't
do anything useful.

llvm-svn: 189548
2013-08-29 00:47:48 +00:00
Renato Golin 8d5f31432e 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.

llvm-svn: 189542
2013-08-28 23:56:07 +00:00
David Majnemer 8918920a32 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

llvm-svn: 189540
2013-08-28 23:48:32 +00:00
Peter Collingbourne 7ac84bd808 80 cols.
llvm-svn: 189538
2013-08-28 23:32:22 +00:00
Fariborz Jahanian 55d6e6c930 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.

llvm-svn: 189537
2013-08-28 23:22:46 +00:00
Rafael Espindola 0f4b04e288 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.

llvm-svn: 189536
2013-08-28 23:17:47 +00:00
Peter Collingbourne ec1cb850d1 Add missing definitions to unwind.h.
Original patch by Charles Davis.

llvm-svn: 189535
2013-08-28 23:16:49 +00:00
Aaron Ballman 9a22621d91 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.
llvm-svn: 189532
2013-08-28 23:13:26 +00:00
Eric Christopher f86c4059c6 80-col.
llvm-svn: 189531
2013-08-28 23:12:10 +00:00
David Blaikie f2053af82c DebugInfo: Further fix/improvements to r189494 (and LLVM r189495).
Selfhosting was crashing with the same type of problem but involving
template specializations.

llvm-svn: 189530
2013-08-28 23:06:52 +00:00
Michael Gottesman 043c53b5a8 [doxygen] Add a few missing variables to the doxygen.cfg.in for external search and cleaned up external_search_map.
llvm-svn: 189523
2013-08-28 21:55:41 +00:00
Manman Ren 501ecf9fac Format. Thanks David for pointing it out.
llvm-svn: 189521
2013-08-28 21:46:36 +00:00
Fariborz Jahanian 7dd7143a2b 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'.

llvm-svn: 189520
2013-08-28 21:23:00 +00:00
Manman Ren 1b45702454 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.

llvm-svn: 189519
2013-08-28 21:20:28 +00:00
Manman Ren 27c22edde4 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.

llvm-svn: 189518
2013-08-28 21:19:31 +00:00
David Blaikie a6cc82114d More comments for r189494.
llvm-svn: 189516
2013-08-28 20:58:00 +00:00
Eli Friedman cefc7eafc6 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>

llvm-svn: 189515
2013-08-28 20:53:32 +00:00
Fariborz Jahanian 1a26c209f6 For methods where clang automatically infers instancetype from the selector
(e.g., all -init* methods), no need to suggest "instancetype" because it 
is redundant.

llvm-svn: 189514
2013-08-28 20:49:58 +00:00
Eli Friedman 2afb63c001 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>

llvm-svn: 189511
2013-08-28 20:35:38 +00:00
Eli Friedman a31efa07ff Improve error for assignment to incomplete class.
PR7681.

llvm-svn: 189510
2013-08-28 20:35:35 +00:00
Michael Gottesman 22a351d314 [doxygen] Added support for doxygen external search.
llvm-svn: 189509
2013-08-28 20:29:44 +00:00
Michael Gottesman 8f897af39c [doxygen] Added code for generating doxygen documentation for clang for cmake.
llvm-svn: 189508
2013-08-28 20:29:40 +00:00
David Blaikie 8c8e8e2376 Comments for r189494
llvm-svn: 189504
2013-08-28 20:24:55 +00:00
Samuel Benzaquen 4adca6262e 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

llvm-svn: 189500
2013-08-28 18:42:04 +00:00
Manman Ren 404fbfedf8 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.

llvm-svn: 189498
2013-08-28 18:31:02 +00:00
Hans Wennborg 0517e75164 clang-cl: Pass -debug to the linker when using -fsanitize=address
llvm-svn: 189496
2013-08-28 17:36:07 +00:00
David Blaikie fae219a033 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.

llvm-svn: 189494
2013-08-28 17:27:13 +00:00
Jordan Rose acd080b956 [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>!

llvm-svn: 189492
2013-08-28 17:07:04 +00:00
Daniel Jasper 2739af3b9c 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");

llvm-svn: 189466
2013-08-28 10:03:58 +00:00
Tim Northover 550ce58312 ARM: comment on why vmull intrinsic has to exist for now.
llvm-svn: 189464
2013-08-28 09:46:40 +00:00
Tim Northover 4ae9812283 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.

llvm-svn: 189463
2013-08-28 09:46:37 +00:00
Tim Northover 4e423f724a 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.

llvm-svn: 189462
2013-08-28 09:46:34 +00:00
Daniel Jasper 96df37a6a1 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.

llvm-svn: 189460
2013-08-28 09:17:37 +00:00
Daniel Jasper a49393f54d 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.

llvm-svn: 189459
2013-08-28 09:07:32 +00:00
Daniel Jasper ed8f1c6dce 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.

llvm-svn: 189455
2013-08-28 08:24:04 +00:00
Daniel Jasper a15da3068d 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.

llvm-svn: 189453
2013-08-28 08:04:23 +00:00
Pavel Labath fce1b03ee7 [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

llvm-svn: 189452
2013-08-28 08:04:08 +00:00
Daniel Jasper 65b79829c3 clang-format: Improve braced init list detection:
Before:
  std::this_thread::sleep_for(std::chrono::nanoseconds{
    std::chrono::seconds { 1 }
  } /
                              5);

After:
  std::this_thread::sleep_for(
      std::chrono::nanoseconds{ std::chrono::seconds{ 1 } } / 5);

This fixes llvm.org/PR16554.

llvm-svn: 189451
2013-08-28 07:50:37 +00:00
Daniel Jasper d215b8bde2 clang-format: Fix corner case in overloaded operator definitions.
Before:
  SomeLoooooooooooooooooooooooooogType operator>
      >(const SomeLooooooooooooooooooooooooogType &other);
  SomeLoooooooooooooooooooooooooogType // break
      operator>>(const SomeLooooooooooooooooooooooooogType &other);

After:
  SomeLoooooooooooooooooooooooooogType
  operator>>(const SomeLooooooooooooooooooooooooogType &other);
  SomeLoooooooooooooooooooooooooogType // break
  operator>>(const SomeLooooooooooooooooooooooooogType &other);

This fixes llvm.org/PR16328.

llvm-svn: 189450
2013-08-28 07:27:35 +00:00
Daniel Jasper 11be8ac590 clang-format: Fix space in decltype-constexprs.
Before:
  static constexpr bool Bar = decltype(bar()) ::value;

After:
  static constexpr bool Bar = decltype(bar())::value;

llvm-svn: 189449
2013-08-28 07:07:07 +00:00
Ted Kremenek 1aab6834fa Remove comment on the availability of boxed expressions. They have been available for a while.
llvm-svn: 189446
2013-08-28 06:03:59 +00:00
Craig Topper a3891a7568 Reorder and shrink size of NameLen field in diagnostic group table. Shaves ~4K from clang binary.
llvm-svn: 189445
2013-08-28 06:01:10 +00:00
David Majnemer 8a0caa8525 Richard makes a good point, clean up this test.
llvm-svn: 189444
2013-08-28 05:45:53 +00:00
Ted Kremenek 80655be83f [CMake] use combination of CMAKE_RUNTIME_OUTPUT_DIRECTORY and CMAKE_LIBRARY_OUTPUT_DIRECTORY to install clang headers for Xcode builds.
llvm-svn: 189443
2013-08-28 05:38:43 +00:00
Hal Finkel 108c46a7bf Revert r189440 - Disable loop vectorizer unrolling when no unrolling requested
As Chandler pointed out, we should not be using -backend-option because this
will cause crashes for users of the tooling interface, etc. A better way to fix
this will be to provide the unrolling pass-manager flag to the loop vectorizer
directly.

Original commit message:

Disable loop vectorizer unrolling when no unrolling requested

In addition to the regular loop unrolling transformation, the loop vectorizer
can also unroll loops. If no unrolling has specifically been requested (by
-fno-unroll-loops), and the loop vectorizer will be used, then add the backend
option to (also) prevent the loop vectorizer from unrolling loops.

I confirmed with Nadav (off list) that disabling vectorizer loop unrolling when
-fno-unroll-loops is provided is the desired behavior.

llvm-svn: 189441
2013-08-28 05:21:45 +00:00
Hal Finkel 7d0867f48c Disable loop vectorizer unrolling when no unrolling requested
In addition to the regular loop unrolling transformation, the loop vectorizer
can also unroll loops. If no unrolling has specifically been requested (by
-fno-unroll-loops), and the loop vectorizer will be used, then add the backend
option to (also) prevent the loop vectorizer from unrolling loops.

I confirmed with Nadav (off list) that disabling vectorizer loop unrolling when
-fno-unroll-loops is provided is the desired behavior.

llvm-svn: 189440
2013-08-28 04:40:22 +00:00
Craig Topper d80c17e060 Merge diagnostic group tables to reduce data size and relocation entries.
The individual group and subgroups tables are now two large tables. The option table stores an index into these two tables instead of pointers. This reduces the size of the options tabe since it doesn't need to store pointers. It also reduces the number of relocations needed.

My build shows this reducing DiagnosticsIDs.o and the clang binary by ~20.5K. It also removes ~400 relocation entries from DiagnosticIDs.o.

llvm-svn: 189438
2013-08-28 04:02:50 +00:00
Hans Wennborg 3accde52db cmake: install a cl.exe binary in the tools/msbuild-bin dir
llvm-svn: 189435
2013-08-28 01:58:44 +00:00
David Majnemer 3425710cca Some of this test doesn't want -std=c++11
Sorry for the churn.

llvm-svn: 189429
2013-08-28 00:13:42 +00:00
Ted Kremenek 2894000b48 Revert "Use CMAKE_RUNTIME_OUTPUT_DIRECTORY instead of LLVM_BINARY_DIR for installing Clang headers."
This appears to be breaking the buildbots.

llvm-svn: 189426
2013-08-28 00:07:08 +00:00
David Majnemer af8795d46d This test now needs C++11
llvm-svn: 189425
2013-08-28 00:03:12 +00:00
David Majnemer 03f4ab7531 AST: Don't treat a TemplateExpansion as a Template
Summary:
Instead of calling getAsTemplate(), call
getAsTemplateOrTemplatePattern() because it handles the
TemplateExpansion case too.

This fixes PR16997.

Reviewers: doug.gregor, rsmith

Reviewed By: rsmith

CC: cfe-commits

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

llvm-svn: 189422
2013-08-28 00:00:27 +00:00
David Blaikie ebe87e1cfa Revert "PR14569: Omit debug info for thunks"
This reverts commit r189320.

Alexey Samsonov and Dmitry Vyukov presented some arguments for keeping
these around - though it still seems like those tasks could be solved by
a tool just using the symbol table. In a very small number of cases,
thunks may be inlined & debug info might be able to save profilers &
similar tools from misclassifying those cases as part of the caller.

The extra changes here plumb through the VarDecl for various cases to
CodeGenFunction - this provides better fidelity through a few APIs but
generally just causes the CGF::StartFunction to fallback to using the
name of the IR function as the name in the debug info.

The changes to debug-info-global-ctor-dtor.cpp seem like goodness. The
two names that go missing (in favor of only emitting those names as
linkage names) are names that can be demangled - emitting them only as
the linkage name should encourage tools to do just that.

Again, thanks to Dinesh Dwivedi for investigation/work on this issue.

llvm-svn: 189421
2013-08-27 23:57:18 +00:00
Fariborz Jahanian 7ca1d30e49 ObjectiveC migrator: minor refactoring of my last
cf annotation patch.

llvm-svn: 189420
2013-08-27 23:56:54 +00:00
Ted Kremenek ae2c8776d0 Use CMAKE_RUNTIME_OUTPUT_DIRECTORY instead of LLVM_BINARY_DIR for installing Clang headers.
llvm-svn: 189414
2013-08-27 23:20:26 +00:00
Reid Kleckner 78af0708b7 Delete CC_Default and use the target default CC everywhere
Summary:
Makes functions with implicit calling convention compatible with
function types with a matching explicit calling convention.  This fixes
things like calls to qsort(), which has an explicit __cdecl attribute on
the comparator in Windows headers.

Clang will now infer the calling convention from the declarator.  There
are two cases when the CC must be adjusted during redeclaration:
1. When defining a non-inline static method.
2. When redeclaring a function with an implicit or mismatched
convention.

Fixes PR13457, and allows clang to compile CommandLine.cpp for the
Microsoft C++ ABI.

Excellent test cases provided by Alexander Zinenko!

Reviewers: rsmith

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

llvm-svn: 189412
2013-08-27 23:08:25 +00:00
Fariborz Jahanian 63ffce2001 ObjectiveC migrator: Do not add explicit cf annotation for
cf functions which are CF_IMPLICIT_BRIDGING_ENABLED.
Add cf annotation to those not CF_IMPLICIT_BRIDGING_ENABLED
to reduce bridge casts.

llvm-svn: 189409
2013-08-27 22:42:30 +00:00
Jordan Rose 5ae3a670c3 CMake: Fix standalone Clang build, take two.
This time, use a variable that's defined consistently in standalone and
non-standalone builds.

llvm-svn: 189406
2013-08-27 21:52:04 +00:00
Ted Kremenek e4a0cac4a8 Revert "[CMake] Use CLANG_BINARY_DIR instead of LLVM_BINARY_DIR as installation path for Clang headers."
This was breaking some tests.  Will investigate.

llvm-svn: 189403
2013-08-27 20:46:01 +00:00
Ted Kremenek 8ff42222ba [CMake] Use CLANG_BINARY_DIR instead of LLVM_BINARY_DIR as installation path for Clang headers.
llvm-svn: 189402
2013-08-27 20:41:18 +00:00
Roman Divacky 718fb1cdf9 Make the information about disabled ARCMT/Rewriter/StaticAnalyzer available
to lit and use this info to disable Analysis/FixIt/Rewriter/Analysis tests
when those are not compiled into clang.

llvm-svn: 189395
2013-08-27 19:27:35 +00:00
Reid Kleckner 047c61510f Revert "CMake: Fix out-of-source build's symlinks."
This reverts commit r189371, it broke the in-source cmake build.

llvm-svn: 189390
2013-08-27 18:27:08 +00:00
Hans Wennborg 65f1752875 clang-cl: Support -fsanitize=address
This exposes the -fsanitize=address option and adds the runtime library
to the link command.

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

llvm-svn: 189389
2013-08-27 18:10:21 +00:00
Jordan Rose 1c71ab00e6 scan-build: Set CC and CXX as make variables when wrapping make builds.
Variables set in a makefile are not overridden by environment variables.
Make sure we actually override CC and CXX when using scan-build.

Patch by Steve McCoy!

llvm-svn: 189372
2013-08-27 16:59:33 +00:00
Jordan Rose 2f59a669bf CMake: Fix out-of-source build's symlinks.
Symlinks to clang should go in Clang's build directory, not LLVM's.

llvm-svn: 189371
2013-08-27 16:59:30 +00:00
Jordan Rose b157d9e945 [analyzer] Don't include Clang headers inside a namespace.
Found by Gabor Kozar!

llvm-svn: 189370
2013-08-27 16:59:26 +00:00
Rafael Espindola ad70d9683e Warn that -O4 is the same as -O3.
We error on -O5 and higher. While it is tempting to do the same for -O4, I
agree with Jordan Rose: we should warn for a release at least first.

llvm-svn: 189369
2013-08-27 16:58:15 +00:00
Samuel Benzaquen 46e59b05eb Revert "Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer."
Summary:
This reverts commit 3b082a3c72324aa3363b5184731740534c6b9a2b.

It breaks the build in c++11 mode.

Reviewers: klimek

CC: cfe-commits, revane

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

llvm-svn: 189368
2013-08-27 16:55:22 +00:00
Samuel Benzaquen fe48aaf1a4 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.

Reviewers: klimek

CC: cfe-commits, revane

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

llvm-svn: 189362
2013-08-27 16:04:53 +00:00
Edwin Vane 18e503c995 Adding a vector version of clang::tooling::shiftedCodePosition().
During the transition of clang::tooling::Replacements from std::set to
std::vector, functions such as clang::tooling::applyAllReplacements() have been
duplicated to take a std::vector<Replacement>. Applying this same temporary
duplication to clang::tooling::shiftedCodePosition().

llvm-svn: 189358
2013-08-27 15:44:26 +00:00
Samuel Benzaquen 85ec25d21c Rewrite eachOf/allOf/anyOf to use a variadic operator.
Summary:
Rewrite eachOf/allOf/anyOf to use a variadic operator, instead of hand-written calls to Polymorphic matchers.
This simplifies their definition and future changes to add them to the dynamic registry.

Reviewers: klimek

CC: cfe-commits, revane

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

llvm-svn: 189357
2013-08-27 15:11:16 +00:00
Daniel Jasper 4c6e00595b clang-format: Format segments of builder-type calls one per line.
This fixes llvm.org/PR14818.

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);

llvm-svn: 189353
2013-08-27 14:24:43 +00:00
Serge Pavlov 9ddb76e201 Cleanup of OpaquePtr. No functionality changes.
- Some documenation were added.
- Usages of OpaquePtr<A>.getAsVal<A>() were replaced by OpaquePtr<A>.get().
- Methods getAs and getAsVal were renamed to getPtrTo and getPtrAs respectively.

llvm-svn: 189346
2013-08-27 13:15:56 +00:00
Edwin Vane 389c91a10c Adding const buffer iterator generators to Rewriter
llvm-svn: 189344
2013-08-27 13:00:34 +00:00
Daniel Jasper b27c4b7cb5 clang-format: Revamp builder-type call formatting.
Previously builder-type calls were only correctly recognized in
top-level calls.

This fixes llvm.org/PR16981.
Before:
  someobj->Add((new util::filetools::Handler(dir))->OnEvent1(
      NewPermanentCallback(this, &HandlerHolderClass::EventHandlerCBA))
                   ->OnEvent2(NewPermanentCallback(
                                  this, &HandlerHolderClass::EventHandlerCBB))
                   ->OnEvent3(NewPermanentCallback(
                                  this, &HandlerHolderClass::EventHandlerCBC))
                   ->OnEvent5(NewPermanentCallback(
                                  this, &HandlerHolderClass::EventHandlerCBD))
                   ->OnEvent6(NewPermanentCallback(
                         this, &HandlerHolderClass::EventHandlerCBE)));

After:
  someobj->Add((new util::filetools::Handler(dir))
                   ->OnEvent1(NewPermanentCallback(
                         this, &HandlerHolderClass::EventHandlerCBA))
                   ->OnEvent2(NewPermanentCallback(
                         this, &HandlerHolderClass::EventHandlerCBB))
                   ->OnEvent3(NewPermanentCallback(
                         this, &HandlerHolderClass::EventHandlerCBC))
                   ->OnEvent5(NewPermanentCallback(
                         this, &HandlerHolderClass::EventHandlerCBD))
                   ->OnEvent6(NewPermanentCallback(
                         this, &HandlerHolderClass::EventHandlerCBE)));

llvm-svn: 189337
2013-08-27 11:09:05 +00:00
Timur Iskhodzhanov 701981fc59 [-cxx-abi microsoft] Change the vdtor implicit should_call_delete argument type to int
llvm-svn: 189336
2013-08-27 10:38:19 +00:00
Daniel Jasper cb3f0ed817 clang-format: Fix bug in column layout.
Before (with 60 character limit in Google style):
  return {
      {aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa},
      {aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa}};
After:
  return {{aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa},
          {aaaaaaaaaaaaaaaaaaaaaaaaa}, {aaaaaaaaaaaaaaaaa}};

llvm-svn: 189327
2013-08-27 08:43:47 +00:00
David Majnemer 08177c5053 [-cxx-abi microsoft] Remove ArgIndex, we handle all template argument kinds!
TemplateExpansion cannot happen here because MSVC doesn't mangle
anything but the fully substituted template arguments.

llvm-svn: 189325
2013-08-27 08:21:25 +00:00
David Blaikie 88ab1d70bc PR14569: Omit debug info for thunks
This was added in r166676 based on PR13942 on the basis that tools may
need debug information for any executable code/function for some fairly
broad/non-specific purposes. It seems to me (as noted in PR14569) that
the major/only purpose is in backtraces, which should generally not
apply to thunks as they won't appear in the stack themselves. By
removing them we fix PR14569 and reduce the size of Clang's debug info.

Strangely enough this doesn't seem to have a substantial impact on
Clang's self-hosted debug info (at least looking at DWO file size) size
at all. Not sure if I failed to test this correctly but I only observed
a 0.004% change in DWO file size over Clang+LLVM.

With thanks to Dinesh Dwivedi for work on this PR.

llvm-svn: 189320
2013-08-27 05:21:11 +00:00
Michael Gottesman 9474b45dc4 Use set to create CLANG_ORDER_FILE instead of option which implies a bool value.
Patch by Edoardo P. <ed0.88.prez@gmail.com>.

llvm-svn: 189311
2013-08-27 04:40:12 +00:00
Nick Lewycky a382db0293 Show which decls are marked invalid in -ast-dump.
llvm-svn: 189306
2013-08-27 03:15:56 +00:00
Richard Smith eb0133c112 Itanium mangler: remove "proposal" comments for manglings that are in the
latest draft of the ABI.

llvm-svn: 189303
2013-08-27 01:03:46 +00:00
Tom Stellard 30687219ba R600: Add local address pointer size to DataLayout
llvm-svn: 189302
2013-08-27 00:55:26 +00:00
Rafael Espindola ef7fe1f6b2 Simplify a bit.
This follows from computeKeyFunction having:

  // Template instantiations don't have key functions,see Itanium C++ ABI 5.2.6.
  // Same behavior as GCC.
  TemplateSpecializationKind TSK = RD->getTemplateSpecializationKind();
  if (TSK == TSK_ImplicitInstantiation ||
      TSK == TSK_ExplicitInstantiationDefinition)
    return 0;

llvm-svn: 189287
2013-08-26 23:23:21 +00:00
Manman Ren 4ae7ea6745 Debug Info: follow-up patch to r189283.
Thanks David for his suggestion. This commit updates testing cases
to have more specific CHECKs.

llvm-svn: 189286
2013-08-26 23:19:37 +00:00
Aaron Ballman 988661d308 Since r179585, __declspec(property) has gotten special treatment as an attribute where it is not processed as part of the typical Sema attribute functionality. Specifying this attribute as being "ignored" because there is no sema handler for it as a Decl attribute, and no AST node generated for it.
llvm-svn: 189284
2013-08-26 22:49:09 +00:00
Manman Ren c4ca9b0d3a Debug Info: add an identifier field to DICompositeType.
Paired with llvm r189282.
Update testing cases to handle an extra field for DICompositeType.

llvm-svn: 189283
2013-08-26 22:40:31 +00:00
Rafael Espindola 0f02285bc5 Use CHECK-DAG in this test.
llvm-svn: 189280
2013-08-26 22:10:31 +00:00
DeLesley Hutchins 2445b1212a Consumed analyis: Renamed *PStatus to *PInfo.
The change was made for readability, as the PropagationInfo objects don't
always contain a status.  This is submitted as a separate patch because it
touches a lot of lines and I don't want it cluttering up the next patch.
Patch by chris.wailes@gmail.com.

llvm-svn: 189278
2013-08-26 20:34:59 +00:00
David Blaikie 92848dee31 Simplify/clean up debug info suppression in CodeGenFunction
CodeGenFunction is run on only one function - a new object is made for
each new function. I would add an assertion/flag to this effect, but
there's an exception: ObjC properties involve emitting helper functions
that are all emitted by the same CodeGenFunction object, so such a check
is not possible/correct.

llvm-svn: 189277
2013-08-26 20:33:21 +00:00
David Blaikie 41f568223a Test
llvm-svn: 189276
2013-08-26 20:33:16 +00:00
Wei Pan 8d6b19a518 Handle predefined expression for a captured statement
- __func__ or __FUNCTION__ returns captured statement's parent
  function name, not the one compiler generated.

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

Reviewed by bkramer

llvm-svn: 189219
2013-08-26 14:27:34 +00:00
Rafael Espindola 91780dec58 Simplify now that -O4 just maps to -O3 and -O is an alias of -O2.
llvm-svn: 189218
2013-08-26 14:05:41 +00:00
Timur Iskhodzhanov f46993e40a Fix virtual destructor mangling when using "-cxx-abi microsoft" on x64
llvm-svn: 189214
2013-08-26 10:32:04 +00:00
Chandler Carruth 1f2b2f8d45 Teach the Linux toolchain about more modern Gentoo installations of GCC
which add another wrinkle to the installation of the libstdc++ headers.

Add at least some basic testing of the weirdnesses of Gentoo's layout.

llvm-svn: 189212
2013-08-26 08:59:53 +00:00
Daniel Jasper 8863ada85b clang-format: Fix bug in column-layout formatting.
Specific arrangements of comments after trailing commas could confuse
the column width calculation, e.g. in:

vector<int> x = { a, b,
                  /* some */ /* comment */ };

llvm-svn: 189211
2013-08-26 08:10:17 +00:00
David Majnemer a4778cc2f1 [-cxx-abi microsoft] Unnamed types are mangled less wrong
llvm-svn: 189208
2013-08-26 02:35:51 +00:00
Benjamin Kramer 7463ed7c89 CodeGen: Unify two implementations of canDevirtualizeMemberFunctionCall.
They were mostly copy&paste of each other, move it to CodeGenFunction. Of course
the two implementations have diverged over time; the one in CGExprCXX seems to
be the more modern one so I picked that one and moved it to CGClass which feels
like a better home for it. No intended functionality change.

llvm-svn: 189203
2013-08-25 22:46:27 +00:00
David Majnemer a3644d6046 DebugInfo: Emit info for casted decls in template args
Summary:
Previously the backend wouldn't get to see the underlying GlobalValue
that corresponds to the template argument because it would be hidden by
a cast at the IR level.  Instead strip the pointer casts off of the
value until we see the underlying GlobalValue.

Reviewers: dblaikie, echristo, majnemer

Reviewed By: majnemer

CC: cfe-commits

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

llvm-svn: 189200
2013-08-25 22:13:27 +00:00
Rafael Espindola e8025644b2 Produce an error when trying to link with -emit-llvm.
llvm-svn: 189193
2013-08-25 14:27:09 +00:00
Renato Golin 171b6b19f1 Tests for ARM aligned access + reserved R9
Patch by Jeroen Hofstee.

llvm-svn: 189190
2013-08-25 13:01:50 +00:00
Michael Han b3edc32cfa Fix comment.
llvm-svn: 189185
2013-08-25 01:29:56 +00:00
Renato Golin a146a48349 Add gcc ARM flags -munaligned-access / -mno-unaligned-access
clang already had a mstrict-align which mentiones "Force all memory
accesses to be aligned (ARM only)". On gcc arm this is controlled by
-munaligned-access / -mno-unaligned-access. Add the gcc versions to
the frontend and make -mstrict-align and alias to -mno-unaligned-access
and only show it in clang -cc1 -help.

Since the default value for unaligned accesses / strict alignment
depends on the tripple, both the enable and disable flags are added.
If both are set, the no-unaligned-access is used.

Patch by Jeroen Hofstee.

llvm-svn: 189175
2013-08-24 14:44:41 +00:00
Renato Golin dbb77e60dc Add the -ffixed-r9 flag for ARM.
This patch adds the -ffixed-r9 flag to clang to instruct llvm to
globally preserve the contents of r9. The flag is added to the newly
created ARM specific group.

While at it, also place marm / mno-thumb in that group.

Patch by Jeroen Hofstee.

llvm-svn: 189174
2013-08-24 14:44:35 +00:00
Benjamin Kramer 45025c0cf1 This wasn't headers, just missing namespaces.
/me bows head in shame.

llvm-svn: 189172
2013-08-24 13:22:59 +00:00
Benjamin Kramer af04f98c11 Add missing includes.
llvm-svn: 189171
2013-08-24 13:16:22 +00:00
Benjamin Kramer e3e855bb89 Replace compLocDecl with less_first.
llvm-svn: 189170
2013-08-24 13:12:34 +00:00
David Majnemer 139e5c5b75 Fix test, make the template type a const pointer.
llvm-svn: 189166
2013-08-24 09:24:26 +00:00
David Majnemer 5559d47266 DebugInfo: Emit info for constant expressions in template arguments
Summary:
This allows us to handle the general case where a non-type template
argument evaluates to a constant expression which isn't integral or a
declaration.

This fixes PR16939.

Reviewers: dblaikie, rsmith

Reviewed By: dblaikie

CC: cfe-commits

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

llvm-svn: 189165
2013-08-24 08:21:10 +00:00
Hans Wennborg 25971caf92 CMake: support the LLVM_INSTALL_TOOLCHAIN_ONLY flag
Differential Revision: http://llvm-reviews.chandlerc.com/D1498

llvm-svn: 189156
2013-08-24 00:22:23 +00:00
Richard Smith db7dbbec39 Add a FIXME.
llvm-svn: 189153
2013-08-23 22:49:47 +00:00
Larisse Voufo 30616383ab A clean-up pass, exploring the unification of traversals of class, variable and function templates.
llvm-svn: 189152
2013-08-23 22:21:36 +00:00
Shuxin Yang 0e61122bb3 Add note about following two commands are no longer equivalent.
- "clang -O3 -flto a.c -c", and 
 - "clang -emit-llvm a.c -c" 

Thank Rafael for tips.

llvm-svn: 189150
2013-08-23 22:01:03 +00:00
Rafael Espindola 493f045e75 Don't imply -flto with -O4.
We now saturate at -O3.

llvm-svn: 189149
2013-08-23 21:49:00 +00:00
Shuxin Yang 4b3c7ffc64 Driver::IsUsingLTO() no longer return true when seeing -emit-llvm.
One step toward differentiating following two commands:
   clang -O3 -flto a.c -c, and 
   clang -O3 -emit-llvm a.c

Thanks many awesome folks for clarifying things. 

llvm-svn: 189148
2013-08-23 21:34:57 +00:00
Rafael Espindola 890498236b Update now that llvm uses the same feature names as the driver.
llvm-svn: 189142
2013-08-23 20:21:37 +00:00
DeLesley Hutchins 73ec2ae91e Consumed analysis: change class name in test cases.
The name of a class used in the testing files was updated to actually
be descriptive.  Patch by chris.wailes@gmail.com.

llvm-svn: 189132
2013-08-23 18:40:39 +00:00
Hans Wennborg 8c981adcec Rename CMake variable; this fell out of r189127 somehow.
llvm-svn: 189129
2013-08-23 18:20:47 +00:00
Hans Wennborg f135e3534c CMake: Don't look for llvm-tblgen when building outside LLVM tree
Previously, the CMake build would look for llvm-tblgen to determine
if a directory is an LLVM build or install directory. Since we don't
want to include llvm-tblgen in the install, look for llvm-config instead,
and use that to find llvm-tblgen.

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

llvm-svn: 189127
2013-08-23 18:05:24 +00:00
Dmitri Gribenko 1e50cbf366 Comment parsing: fix a bug where a line with whitespace between two paragraphs
would cause us to concatenate these paragraphs into a single one.

The no-op whitespace churn in test/Index test happened because these tests
don't use the correct approach for testing and are more strict than required
for they are testing.

llvm-svn: 189126
2013-08-23 18:03:40 +00:00
Dmitri Gribenko 11f54e86bb Fix indentation
llvm-svn: 189119
2013-08-23 17:48:41 +00:00
Dmitri Gribenko db6adaba68 Use CharInfo.h routines in TextComment::isWhitespaceNoCache
llvm-svn: 189115
2013-08-23 17:45:43 +00:00
Jordan Rose 9217aa3b15 Revise -Wnewline-eof test per feedback from Dmitri.
llvm-svn: 189113
2013-08-23 16:12:49 +00:00
Robert Wilhelm 25284cc95b Use pop_back_val() instead of both back() and pop_back().
No functionality change intended.

llvm-svn: 189112
2013-08-23 16:11:15 +00:00
Jordan Rose 4c55d45b13 Respect -Wnewline-eof even in C++11 mode.
If the user has requested this warning, we should emit it, even if it's not
an extension in the current language mode. However, being an extension is
more important, so prefer the pedantic warning or the pedantic-compatibility
warning if those are enabled.

<rdar://problem/12922063>

llvm-svn: 189110
2013-08-23 15:42:01 +00:00
Daniel Jasper 0649d36172 clang-format: Fix indentation relative to unary expressions.
This should be done, only if we are still in the unary expression's
scope.

Before:
  bool aaaa = !aaaaaaaa(  // break
                   aaaaaaaaaaa);
  *aaaaaa = aaaaaaa( // break
       aaaaaaaaaaaaaaaa);

After:
  bool aaaa = !aaaaaaaa(  // break
                   aaaaaaaaaaa); // <- (unchanged)
  *aaaaaa = aaaaaaa( // break
      aaaaaaaaaaaaaaaa); // <- (no longer indented relative to "*")

llvm-svn: 189108
2013-08-23 15:14:03 +00:00
Daniel Jasper f438cb7619 clang-format: Fix corner case for string splitting ..
.. in conjunction with Style.AlwaysBreakBeforeMultilineStrings. Also,
simplify the implementation by handling newly split strings and already
split strings by the same code.

llvm-svn: 189102
2013-08-23 11:57:34 +00:00
Daniel Jasper f93551c8b1 clang-format: Handle trailing commas in column layout of braced list.
Before, this was causing errors.

Also exit early in breakProtrudingToken() (before the expensive call to
SourceManager::getSpellingColumnNumber()). This makes formatting huge
(100k+-item) braced lists possible.

llvm-svn: 189094
2013-08-23 10:05:49 +00:00
Robert Lytton bff06ce221 correct test RUN parameters
llvm-svn: 189093
2013-08-23 09:27:44 +00:00
Pavel Labath 02b64d46a0 [analyzer] Refactor conditional expression evaluating code
Summary:
Instead of digging through the ExplodedGraph, to figure out which edge brought
us here, I compute the value of conditional expression by looking at the
sub-expression values.

To do this, I needed to change the liveness algorithm a bit -- now, the full
conditional expression also depends on all atomic sub-expressions, not only the
outermost ones.

Reviewers: jordan_rose

CC: cfe-commits

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

llvm-svn: 189090
2013-08-23 07:19:22 +00:00
David Majnemer da45a0fa6f arc commit didn't add this because it wasn't in the patch...
llvm-svn: 189088
2013-08-23 05:42:19 +00:00
David Majnemer 61c39a1ccd Sema: Properly support Microsoft-mode template arguments
Summary:
There were two things known to be wrong with our implementation of MSVC
mode template arguments:

- We didn't properly handle __uuidof/CXXUuidofExpr and skipped all type
  checking completely.
- We didn't allow for MSVC's extension of allowing certain constant
  "foldable" expressions from showing up in template arguments.
  They allow various casts dereference and address-of operations.
  We can make it more general as we find further peculiarities but this
  is the known extent.

Reviewers: rsmith, doug.gregor, rjmccall

Reviewed By: doug.gregor

CC: cfe-commits, rnk

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

llvm-svn: 189087
2013-08-23 05:39:39 +00:00
Richard Smith d136f60b07 Reword a diagnostic to avoid a confusing implication that it might be talking
about a declaration within a return type.

llvm-svn: 189083
2013-08-23 02:16:48 +00:00
Richard Smith b2f61b4a05 Remove SequenceNumber from class/variable template partial specializations.
This was only used to ensure that the traversal order was the same as the
insertion order, but that guarantee was already being provided by the use
of a FoldingSetVector.

llvm-svn: 189075
2013-08-22 23:27:37 +00:00
Fariborz Jahanian 2e9c19cc35 ObjectiveC migrator: builtin ObjectiveC types are not
audited types.

llvm-svn: 189072
2013-08-22 22:27:36 +00:00
Fariborz Jahanian 4f64dd2baf ObjectiveC migrator: some refactoring to reduce
code size.

llvm-svn: 189070
2013-08-22 21:40:15 +00:00
Bill Wendling a74e82aad8 Check for absence of the flag.
llvm-svn: 189069
2013-08-22 21:30:21 +00:00
Bill Wendling 17d1b61480 Only add this attribute when it's set. If it's not there, the assumption is that it's off.
llvm-svn: 189064
2013-08-22 21:16:51 +00:00
DeLesley Hutchins c2ecf0d815 Update to consumed analysis.
Patch by chris.wailes@gmail.com.  The following functionality was added:

* The same functionality is now supported for both CXXOperatorCallExprs and CXXMemberCallExprs.
* Factored out some code in StmtVisitor.
* Removed variables from the state map when their destructors are encountered.
* Started adding documentation for the consumed analysis attributes.

llvm-svn: 189059
2013-08-22 20:44:47 +00:00
Peter Collingbourne 730f3c8574 DataFlowSanitizer: Add a design doc paragraph on checking ABI consistency.
Differential Revision: http://llvm-reviews.chandlerc.com/D1443

llvm-svn: 189055
2013-08-22 20:08:20 +00:00
Reid Kleckner 3738445cdd Add a separate llvm.global_ctors entry for linkonce_odr data initializers
Summary:
These typically come from static data members of class template
specializations.  This accomplishes two things:

1. May expose GlobalOpt optimizations for Itanium C++ ABI code.
2. Works toward fixing double initialization in the Microsoft C++ ABI.

CC: cfe-commits

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

llvm-svn: 189051
2013-08-22 20:07:45 +00:00
Reid Kleckner 90e119a0fc FileCheckify a grep test.
llvm-svn: 189042
2013-08-22 18:45:40 +00:00
Fariborz Jahanian 926fafb888 ObjectiveC migrator: Provide ARC annotations for
CF methods too.

llvm-svn: 189041
2013-08-22 18:35:27 +00:00
Samuel Benzaquen 8c9f6330e6 Refactor VariantMatcher to use an interface underneath.
Summary:
Refactor VariantMatcher to use an interface underneath.
It supports "Single" and "Polymorphic". Will support more in the future.

Reviewers: klimek

CC: cfe-commits, revane

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

llvm-svn: 189032
2013-08-22 16:38:33 +00:00
Jordan Rose 8ba180e25c Re-add clang-check to the Makefile build.
I was bound to screw this up somehow.

llvm-svn: 189029
2013-08-22 16:12:04 +00:00
Daniel Jasper 12f4f1192d Work around unused variable warning in release builds.
llvm-svn: 189028
2013-08-22 16:11:46 +00:00
Jordan Rose a1e4b12223 Fix dependencies now that the ARC migrator depends on the static analyzer.
Thanks for pointing this out, Stephen. I think this is right now -- I
attempted to try all four valid combinations with both the autoconf and
CMake builds.

See also LLVM changes to the configure script.

llvm-svn: 189027
2013-08-22 15:50:02 +00:00
David Blaikie d89b99d421 DebugInfo: emit the definition of types when construction vtables are required as these types may never end up emitting the full class data
This might be able to be optimized further by only doing this in the
absence of a key function, but it doesn't look like GCC is doing that so
I'm not rushing to do it just yet.

llvm-svn: 189022
2013-08-22 15:23:05 +00:00
Daniel Jasper 8de9ed05b7 clang-format: Add column layout formatting for braced lists
With this patch, braced lists (with more than 3 elements are formatted in a
column layout if possible). E.g.:

  static const uint16_t CallerSavedRegs64Bit[] = {
    X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI,
    X86::R8,  X86::R9,  X86::R10, X86::R11, 0
  };

Required other changes:
- FormatTokens can now have a special role that contains extra data and can do
  special formattings. A comma separated list is currently the only
  implementation.
- Move penalty calculation entirely into ContinuationIndenter (there was a last
  piece still in UnwrappedLineFormatter).

Review: http://llvm-reviews.chandlerc.com/D1457
llvm-svn: 189018
2013-08-22 15:00:41 +00:00
David Blaikie cf2c8b33cd DebugInfo: Remove explicit declaration-emissiong handling now that we have a more principled approach (the 'requires complete type' callback)
No functionality change intended.

llvm-svn: 189013
2013-08-22 13:36:01 +00:00
Manuel Klimek 2fdbea2819 Revert "Implement a rudimentary form of generic lambdas."
This reverts commit 606f5d7a99b11957e057e4cd1f55f931f66a42c7.

llvm-svn: 189004
2013-08-22 12:12:24 +00:00
Manuel Klimek 1559dd8a1c Revert "Remove some unused variables identified by Juergen Ributzka *I need to turn on this warning in Visual C++ - sorry!*"
This reverts commit d01d0b63d87ac465f15ce1d6b56bf3faf4525769.

llvm-svn: 189003
2013-08-22 12:12:05 +00:00
David Majnemer ee7e86c08f Typo.
llvm-svn: 188996
2013-08-22 10:04:41 +00:00