Граф коммитов

42824 Коммитов

Автор SHA1 Сообщение Дата
Argyrios Kyrtzidis f583a5ec59 Add a test case, to make sure there is no crash on IRGen when using PCH
Related to rdar://13114142

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176227 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 01:13:53 +00:00
Renato Golin 717ff5416e Avoiding flamewars
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176221 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 23:21:44 +00:00
David Blaikie c0cedbe537 PR15360: nullptr as a non-type template argument to a function type non-type template parameter
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176216 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 22:10:40 +00:00
David Blaikie 98b879af5b Add test coverage for array to pointer decay in non-type template parameters.
Functionality committed in r172585 but tested the function case without the
array case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176215 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 22:10:37 +00:00
Renato Golin c661e12480 Add config manager to open projects
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176211 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 21:28:29 +00:00
Jordan Rose 854e75575e [analyzer] Fix test for previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176202 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 18:57:20 +00:00
Jordan Rose 6f4160828d [analyzer] Teach FindLastStoreBRVisitor to understand stores of the same value.
Consider this case:

  int *p = 0;
  p = getPointerThatMayBeNull();
  *p = 1;

If we inline 'getPointerThatMayBeNull', we might know that the value of 'p'
is NULL, and thus emit a null pointer dereference report. However, we
usually want to suppress such warnings as error paths, and we do so by using
FindLastStoreBRVisitor to see where the NULL came from. In this case, though,
because 'p' was NULL both before and after the assignment, the visitor
would decide that the "last store" was the initialization, not the
re-assignment.

This commit changes FindLastStoreBRVisitor to consider all PostStore nodes
that assign to this region. This still won't catches changes made directly
by checkers if they re-assign the same value, but it does handle the common
case in user-written code and will trigger ReturnVisitor's suppression
machinery as expected.

<rdar://problem/13299738>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176201 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 18:49:57 +00:00
Jordan Rose a11f22f606 [analyzer] Turn on C++ constructor inlining by default.
This enables constructor inlining for types with non-trivial destructors.
The plan is to enable destructor inlining within the next month, but that
needs further verification.

<rdar://problem/12295329>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176200 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 18:49:43 +00:00
Chad Rosier 4c4df4520d [driver] The failure of any phase (e.g., preprocess, compile, assemble) for a
single translation unit should prevent later phases from executing.  Otherwise,
this generates lots of noise in build systems.  This a fallout from r173825.
Patch by Matthew Curtis <mcurtis@codeaurora.org>.
rdar://13298009

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176198 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 18:46:04 +00:00
Simon Atanasyan e9616a4972 [Mips] Add two new aliases for MIPS ABI names 32 (means o32 abi) and 64
(means n64 abi) to improve compatibility with GNU tools.
Patch by Jia Liu <proljc@gmail.com>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176187 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 14:55:49 +00:00
Timur Iskhodzhanov 1d4fff5551 Better support for constructors with -cxx-abi microsoft, partly fixes PR12784
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176186 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 13:46:31 +00:00
Manuel Klimek 0cc798f29d Make the negative test of recordType depend on a specific record.
Otherwise it'll break if there's a record type in the AST by default.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176181 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 11:56:58 +00:00
Daniel Jasper 9c65b06982 Fix formatting of multiplications in array subscripts.
Before:
a[a* a] = 1;

After:
a[a * a] = 1;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176180 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 11:43:50 +00:00
Alexey Samsonov 8614304c0d [Sanitizer] Change driver behavior when linking with -fsanitize=thread and -fsanitize=memory. TSan/MSan also provide their versions of new/delete and should use the same strategy as ASan. Share the code that sets linker flags for all sanitizers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176178 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 11:14:55 +00:00
Daniel Jasper faab0d35da Enable bin-packing in Google style.
After some discussions, it seems that this is the better path in
the long run. Does not change Chromium style, as there, bin packing
is forbidden by the style guide.

Also fix two minor bugs wrt. formatting:
1. If a call parameter is a function call itself and is split before
   the "." or "->", split before the next parameter.
2. If a call parameter is string literal that has to be split onto
   two lines, split before the next parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176177 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 09:47:53 +00:00
Nick Lewycky f4086ebb09 Update clang for LLVM API change. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176174 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 06:22:58 +00:00
Rafael Espindola a2bb892333 Don't cache the visibility of types.
Since r175326 an implicitly hidden template argument can cause a template
installation to become hidden, even if the template itself has an explicit
default visibility. This requires that we keep track of "late" additions
of the visibility attribute.

This is hopefully the last followup change. It just removes the caching of
visibilities from types so that we can see new attributes even after a type has
been used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176164 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 04:15:01 +00:00
Lang Hames 5e8577ece7 Use the correct alignment for POD-member memcpys where the first field is a
bitfield. CGBitField::StorageAlignment holds the alignment in chars, but
emitMemcpy had been treating it as if it were held in bits, leading to
underaligned memcpys.

Related to PR15348.

Thanks very much to Chandler for the diagnosis.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176163 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 04:14:49 +00:00
Rafael Espindola f127eb8aeb Rename methods to comply with the LLVM Coding Standards.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176159 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 02:56:45 +00:00
Rafael Espindola 18895dc4fd Change Type::getLinkageAndVisibility to return a LinkageInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176157 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 02:27:19 +00:00
Rafael Espindola 2beda12c3f Move LinkageInfo out of NamedDecl so that it can be used in Type.h.
Everything that cares about visibility also cares about linkage, so I just
moved it to Visibility.h instead of creating a new .h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176155 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 02:15:29 +00:00
Richard Trieu da8910519b Update template diffing to handle template arguments that are declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176153 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 01:41:53 +00:00
Argyrios Kyrtzidis b3a49f567a Add a test to make sure __has_include works from inside a macro.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176152 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 01:34:48 +00:00
Adrian Prantl 10b4df7ff2 Temporarily revert r176116 for compile-time performance regression.
This reverts commit ea95e4587fd13606fbf63b10a07a7d02026aa39c.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176151 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 01:31:55 +00:00
Ted Kremenek b7a3f74bbb [analyzer] Add stop-gap patch to prevent assertion failure when analyzing LLVM codebase.
This potentially reduces a performance optimization of throwing away
PreStmtPurgeDeadSymbols nodes.  I'll investigate the performance impact
soon and see if we need something better.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176149 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 01:26:58 +00:00
Argyrios Kyrtzidis 1ebefc72e8 [PCH] When deserializing an IdentifierInfo, call IdentifierInfo::RevertTokenIDToIdentifier() only when it's not already an identifier.
Fixes an assertion hit.
rdar://13288735

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176148 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 01:13:51 +00:00
Fariborz Jahanian 664e860beb comment parsing: Properties are considered like methods, and people
think of them as having return values that may be computed. Don't
warn when using @return in their comment. // rdar://13189938


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176147 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 00:46:06 +00:00
John McCall 714b509bb4 Don't crash when diagnosing path-constrained protected
access to a private member to which we have special access.

rdar://12926092

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176146 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 00:08:19 +00:00
Bill Wendling 8992457927 Reapply r176133 with testcase fixes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176145 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 00:06:04 +00:00
Jordan Rose deb8f5d533 [analyzer] If a struct has a partial lazy binding, its fields aren't Undef.
This is essentially the same problem as r174031: a lazy binding for the first
field of a struct may stomp on an existing default binding for the
entire struct. Because of the way RegionStore is set up, we can't help
but lose the top-level binding, but then we need to make sure that accessing
one of the other fields doesn't come back as Undefined.

In this case, RegionStore is now correctly detecting that the lazy binding
we have isn't the right type, but then failing to follow through on the
implications of that: we don't know anything about the other fields in the
aggregate. This fix adds a test when searching for other kinds of default
values to see if there's a lazy binding we rejected, and if so returns
a symbolic value instead of Undefined.

The long-term fix for this is probably a new Store model; see
<rdar://problem/12701038>.

Fixes <rdar://problem/13292559>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176144 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 00:05:29 +00:00
Ted Kremenek 2564f811ba Refine SourceManager's isBeforeInTranslationUnit() cache to have more entries.
isBeforeInTranslationUnit() uses a cache to reduce the expensive work
to compute a common ancestor for two FileIDs.  This work is very
expensive, so even caching the latest used FileIDs was a big win.
A closer analysis of the cache before, however, shows that the cache
access pattern would oscillate between a working set of FileIDs, and
thus caching more pairs would be profitable.

This patch adds a side table for extending caching.  This side table
is bounded in size (experimentally determined in this case from
a simple Objective-C project), and when the table gets too large
we fall back to the single entry caching before as before.

On Sketch (a small example Objective-C project), this optimization
reduces -fsyntax-only time on SKTGraphicView.m by 5%.  This is
for a project that is already using PCH.

Fixes <rdar://problem/13299847>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176142 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 00:00:26 +00:00
Rafael Espindola b58f810669 Use existing macros to simplify the test a bit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176138 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 23:24:59 +00:00
Bill Wendling d9365d2d71 Temporarily revert r176133 until testcases are modified.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176137 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 23:18:33 +00:00
Bill Wendling c3af6799d4 Fix testcases to not rely upon target-* attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176135 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 23:08:48 +00:00
Bill Wendling 2693c323c0 Don't set the -target-cpu and -target-features attributes just now.
This is causing some problems with some of the builders. It's non-trivial to
reset the target's features.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176133 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 23:01:33 +00:00
Chad Rosier bcf73c2253 No need to initialize these variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176128 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 22:15:50 +00:00
Fariborz Jahanian 9db0fe97f5 doxygen command. Add 'attention' command to list of similar
doxygen commands. // rdar://12379053


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176127 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 22:12:16 +00:00
Matt Arsenault 34b0adb52f Fix assertion failure when a field is given an address space.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176122 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 21:16:00 +00:00
Matt Arsenault 5509f37aac Fix initializer for variables with attribute address_space set.
This would error in C++ mode unless the variable also had a cv
qualifier.

e.g.

__attribute__((address_space(2))) float foo = 1.0f; would error but
__attribute__((address_space(2))) const float foo = 1.0f; would not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176121 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 21:15:54 +00:00
Adrian Prantl 58c7903725 Ensure that DIType is regenerated after we visited an implementation that adds ivars to an interface. Fixes rdar://13175234
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176116 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 20:01:46 +00:00
Ted Kremenek 4238f41d48 [analyzer] Use 'MemRegion::printPretty()' instead of assuming the region is a VarRegion.
Fixes PR15358 and <rdar://problem/13295437>.

Along the way, shorten path diagnostics that say "Variable 'x'" to just
be "'x'".  By the context, it is obvious that we have a variable,
and so this just consumes text space.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176115 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 19:44:38 +00:00
Matt Beaumont-Gay 9016bb7712 Warn on dropping the return value from a warn_unused_result function, even in
macros.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176114 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 19:34:08 +00:00
Rafael Espindola d3b2f0ac1c Use the most recent decl in getExplicitVisibility.
Now that implicitly hidden template arguments can make an instantiation hidden,
it is important to look at more than just the canonical decl of the argument
in order to see if an attribute is available in a more recent decl.

This has the disadvantage of exposing when getExplicitVisibility is called,
but lets us handle cases like

template <typename T>
struct __attribute__((visibility("default"))) barT {
  static void zed() {}
};
class foo;
class __attribute__((visibility("default"))) foo;
template struct barT<foo>;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176112 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 19:33:14 +00:00
Rafael Espindola d7a60ad800 Be more careful in applying pragma weak. Fixes pr14974.
GCC applies a pragma weak to a decl if it matches the mangled name. We used
to apply if it matched the plain name.

This patch is a compromise: we apply the pragma only if it matches the name
and the decl has C language linkage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176110 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 19:13:56 +00:00
Daniel Jasper 518ee34467 Fix bad line break decision.
Before:
if (Intervals[i].getRange().getFirst() < Intervals[i - 1]
                                             .getRange().getLast()) {}

After:
if (Intervals[i].getRange().getFirst() <
    Intervals[i - 1].getRange().getLast()) {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176092 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 13:59:14 +00:00
Evgeniy Stepanov d79f1f37b0 Allow dash before "ld" in android driver test.
Sometimes android linker is "arm-linux-androideabi-ld", and not just "ld".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176088 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 13:20:29 +00:00
Daniel Jasper 84a1a63b03 In range-based for-loops, prefer splitting after ":".
Before:
for (const aaaaaaaaaaaaaaaaaaaaa &
         aaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}

After:
for (const aaaaaaaaaaaaaaaaaaaaa &aaaaaaaaa :
     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176087 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 13:18:08 +00:00
Daniel Jasper 1ef81d57fb Only keep empty lines in unwrapped lines if they preceed a line comment.
Empty lines followed by line comments are often used to highlight the
comment. Empty lines somewhere else are usually left over from manual or
automatic formatting and should probably be removed.

Before (clang-format would keep):
S s = {
  a,

  b
};

After:
S s = { a, b };

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176086 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 13:10:34 +00:00
Daniel Jasper 0fb382bfbf Only break string literals as a last resort.
We might want to move towards doing this if the formatting can be
significantly improved, but we need to carefully evaluate the different
situations first.

Before (the string literal was split by clang-format here):
aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa, aaaaaa("aaa aaaaa aaa aaa aaaaa aaa "
                                                  "aaaaa aaa aaa aaaaaa"));

After:
aaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaa,
    aaaaaa("aaa aaaaa aaa aaa aaaaa aaa aaaaa aaa aaa aaaaaa"));

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176084 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 12:52:34 +00:00
Alexey Samsonov 863fb35744 Define CMake option CLANG_INCLUDE_TESTS *before* traversing into tests/ subdirectory. Otherwise, while configuring the build tree for the first time, Clang unit tests could avoid being added to 'check-clang' command, and thus avoid being built and executed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176080 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 09:43:27 +00:00