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

24655 Коммитов

Автор SHA1 Сообщение Дата
Jan Wen Voung dde3bdb62c Define __LITTLE_ENDIAN__ for le32, since "le" stands for little endian.
Add a test for this too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153616 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-29 00:05:59 +00:00
John McCall 57cd1b89cd When we can't prove that the target of an aggregate copy is
a complete object, the memcpy needs to use the data size of
the structure instead of its sizeof() value.  Fixes PR12204.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153613 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 23:30:44 +00:00
Anna Zaks b47dbcbc12 [analyzer] Enable retry exhausted without inlining by default.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153591 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 19:59:16 +00:00
David Chisnall fb02784df0 Fix the type of wchar_t on Solaris.
Patch by Dmitri Shubin!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153585 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 18:04:14 +00:00
Fariborz Jahanian a78eca2042 objective-c: Improve diagnostics and
provide 'fixit' hint when dictionary index 
is not of proper type. // rdar://11062080


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153584 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 17:56:49 +00:00
Anna Zaks 253955ca25 [analyser] Stats checker: do not mark a node as exhausted if we will
retry without inlining.

(+ other minor cleanups)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153581 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 17:05:50 +00:00
Anna Zaks 64ee9d03c9 [analyzer] Refactor: Use Decl when determining if the Block belongs to
the root function.

(This is a bit cleaner then using the StackFrame.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153580 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 17:05:46 +00:00
NAKAMURA Takumi a0786c91df CodeGen/CGDeclCXX.cpp: Twine-ize CreateGlobalInitOrDestructFunction().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153578 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 16:24:29 +00:00
Douglas Gregor 6960587df0 Unify and fix our checking of C++ [dcl.meaning]p1's requirements
concerning qualified declarator-ids. We now diagnose extraneous
qualification at namespace scope (which we had previously missed) and
diagnose these qualification errors for all kinds of declarations; it
was rather uneven before. Fixes <rdar://problem/11135644>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153577 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 16:01:27 +00:00
Douglas Gregor 1e1e9722cb When we form a new function/class template specialization, we first
search for the specialization (in a folding set) and, if not found
form a *Decl that is then inserted into that folding set. In rare
cases, the folding set may be reallocated between the search and the
insertion, causing a crash. No test case, because triggering rehashing
consistently in a small test case is not feasible. Fixes
<rdar://problem/11115071>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153575 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 14:34:23 +00:00
Ted Kremenek 6488dc3115 Fix suspicious comparison reported by PVS-Studio!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153568 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 05:24:50 +00:00
Chandler Carruth 82fe6aea40 Move the emission of strict enum range metadata behind a flag (the same
flag as GCC uses: -fstrict-enums). There is a *lot* of code making
unwarranted assumptions about the underlying type of enums, and it
doesn't seem entirely reasonable to eagerly break all of it.

Much more importantly, the current state of affairs is *very* good at
optimizing based upon this information, which causes failures that are
very distant from the actual enum. Before we push for enabling this by
default, I think we need to implement -fcatch-undefined-behavior support
for instrumenting and trapping whenever we store or load a value outside
of the range. That way we can track down the misbehaving code very
quickly.

I discussed this with Rafael, and currently the only important cases he
is aware of are the bool range-based optimizations which are staying
hard enabled. We've not seen any issue with those either, and they are
much more important for performance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153550 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 23:58:37 +00:00
Douglas Gregor ba1030698d Introduce a new libclang API to determine the parent context of a code
completion item. For example, if the code completion itself represents
a declaration in a namespace (say, std::vector), then this API
retrieves the cursor kind and name of the namespace (std). Implements
<rdar://problem/11121951>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153545 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 23:34:16 +00:00
Richard Smith 2259286fc5 If we see '(...' where we're expecting an abstract-declarator, that doesn't
necessarily mean we've found a function declarator. If the next token is not
a ')', this is actually a parenthesized pack expansion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153544 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 23:05:05 +00:00
Fariborz Jahanian 55947042d8 modern objective-c translator: writing objc boolean literals.
// rdar://11124775


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153535 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 20:17:30 +00:00
Anna Zaks 5903a373db [analyzer] Add an option to re-analyze a dead-end path without inlining.
The analyzer gives up path exploration under certain conditions. For
example, when the same basic block has been visited more than 4 times.
With inlining turned on, this could lead to decrease in code coverage.
Specifically, if we give up inside the inlined function, the rest of
parent's basic blocks will not get analyzed.

This commit introduces an option to enable re-run along the failed path,
in which we do not inline the last inlined call site. This is done by
enqueueing the node before the processing of the inlined call site
with a special policy encoded in the state. The policy tells us not to
inline the call site along the path.

This lead to ~10% increase in the number of paths analyzed. Even though
we expected a much greater coverage improvement. 

The option is turned off by default for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153534 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 20:02:53 +00:00
Anna Zaks 65552ca127 [analyzer] Stats checker: minor interprocedural tweaks.
Report root function name with exhausted block diagnostic.

Also, use stack frames, not just any location context when checking if
the basic block is in the same context.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153532 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 20:02:44 +00:00
Anna Zaks 1f5171edc9 [analyzer] Stats: Only count the number of times we run path sensitive
analyzes.

(This method can be called twice on the same function.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153531 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 20:02:41 +00:00
Eric Christopher d1f853d73d Add better support for $fp and $sp for mips inline asm support.
Patch by Jack Carter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153530 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 19:56:11 +00:00
Argyrios Kyrtzidis db81d38d9c [preprocessor] Handle correctly inclusion directives that have macro expansions, e.g
"#include MACRO(STUFF)".

-As an inclusion position for the included file, use the file location of the file where it
was included but *after* the macro expansions. We want the macro expansions to be considered
as before-in-translation-unit for everything in the included file.

-In the preprocessing record take into account that only inclusion directives can be encountered
as "out-of-order" (by comparing the start of the range which for inclusions is the hash location)
and use binary search if there is an extreme number of macro expansions in the include directive.

Fixes rdar://11111779

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153527 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 18:47:48 +00:00
Fariborz Jahanian e0335786c1 objective-c modern translator: move all inithooks into a single array
// rdar://11124354


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153526 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 18:41:05 +00:00
Sebastian Redl f78c0f9aaa Even more careful consideration of C++11 13.3.3.1p4. Fixes PR12241.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153523 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 18:33:03 +00:00
Douglas Gregor 978fc9c485 Introduce a -cc1-level option -pubnames-dump, which simply dumps the
list of identifiers that that 'public' names at the end of the
translation unit, e.g., defined macros or identifiers with top-level
names, in sorted order. Meant to support <rdar://problem/10921596>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153522 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 18:06:49 +00:00
Fariborz Jahanian 2610f90135 Remove few if-then-else when both branches are the
same. pr12357.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153515 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 16:42:20 +00:00
Fariborz Jahanian 3f162c398b Commit patch reverted in r153454 with the modified test
case that I forgot to check in.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153512 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 16:21:30 +00:00
Richard Smith 5d8388ce6e Add cross-referencing comments to ParseDirectDeclarator to note that
isConstructorDeclaration also needs updating for any extension to the
grammar of a direct-declarator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153490 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 01:42:32 +00:00
Ted Kremenek de5b4fbe31 Change RetainCountChecker to eagerly "escape" retained objects when they are
assigned to a struct.  This is fallout from inlining results, which expose
far more patterns where people stuff CF objects into structs and pass them
around (and we can reason about it).  The problem is that we don't have
a general way to detect when values have escaped, so as an intermediate step
we need to eagerly prune out such tracking.

Fixes <rdar://problem/11104566>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153489 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 01:12:45 +00:00
Richard Smith 412e0cc52e When we see 'Class(X' or 'Class::Class(X' and we suspect that it names a
constructor, but X is not a known typename, check whether the tokens could
possibly match the syntax of a declarator before concluding that it isn't
a constructor. If it's definitely ill-formed, assume it is a constructor.

Empirical evidence suggests that this pattern is much more often a
constructor with a typoed (or not-yet-declared) type name than any of the
other possibilities, so the extra cost of the check is not expected to be
problematic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153488 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-27 00:56:56 +00:00
Chad Rosier afc4baa37c [driver] Fix unused argument warnings.
1. Don't short-circuit conditional statements that are checking flags.
Otherwise, the driver emits warnings about unused arguments.

2. -mkernel and -fapple-kext imply no exceptions, so claim exception related
 arguments now to avoid warnings about unused arguments.

rdar://11120518


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153478 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 22:04:46 +00:00
Chad Rosier ec09b3e0c5 [driver] -mkernel implies -fno-common, so claim the arg to avoid an unused
argument warning.
Part of rdar://11120518


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153470 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 21:35:40 +00:00
Chad Rosier 3d26550ba8 [driver] -mkernel implies -fno-builtin, so claim the arg to avoid an unused
argument warning.
Part of rdar://11120518


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153469 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 21:29:17 +00:00
Richard Smith 0724b7c430 Add a special-case diagnostic for one of the more obnoxious special cases of
unscoped enumeration members: an enumerator name which is visible in the
out-of-class definition of a member of a templated class might not actually
exist in the instantiation of that class, if the enumeration is also lexically
defined outside the class definition and is explicitly specialized.

Depending on the result of a CWG discussion, we may have a different resolution
for a class of problems in this area, but this fixes the immediate issue of a
crash-on-invalid / accepts-invalid (depending on +Asserts). Thanks to Johannes
Schaub for digging into the standard wording to find how this case is currently
specified to behave.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153461 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 20:28:16 +00:00
Daniel Dunbar ad11f1c668 Revert r153443 "objective-c modern translator: extern "C" exported", it fails in testing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153454 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 18:48:59 +00:00
Anna Zaks 4cd7edfa85 [analyzer] Malloc: Allow a pointer to escape through OSAtomicEnqueue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153453 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 18:18:39 +00:00
Kostya Serebryany 8cb4a070d4 add tbaa metadata to vtable pointer loads/stores
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153447 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 17:03:51 +00:00
Benjamin Kramer 1eb18afd93 Move CodeCompletionBuilder's chunk adding methods out of line.
This makes sense because chunk's ctor is also out of line and simplifies considerably
when inlined with a constant parameter. Shrinks clang on i386-linux-Release+Asserts by 65k.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153446 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 16:57:36 +00:00
Douglas Gregor 0179868cce When diagnosing an invalid out-of-line redeclaration, don't permit
typo correction to introduce a nested-name-specifier; we aren't
prepared to handle it here. Fixes PR12297 / <rdar://problem/11075219>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153445 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 16:54:18 +00:00
Fariborz Jahanian b12dc689fb objective-c modern translator: extern "C" exported
symbols. // rdar://11103982


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153443 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 16:29:49 +00:00
Douglas Gregor a8e0b978d6 Canonicalize the declaration we write to a PCH file for an
InjectedClassNameType; otherwise, it won't be properly wired to the
original (canonical) declaration when it is deserialized. Fixes
<rdar://problem/11112464>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153442 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 15:52:37 +00:00
Benjamin Kramer dccb9bb102 Driver: Factor string vector push_back into a helper class and optimize it.
Due to lack of move semantics we would create a temporary std::string from the
string literal, copy it into the vector and discard the temporary. This leads
to massive code bloat, optimizing it saves 50k on i386-linux-Release+Asserts.

While there add a two-element overload for push_back, simplifying code a bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153441 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 15:39:31 +00:00
Benjamin Kramer ecafd309b3 ThreadSafetyReporter: Manage diagnostics in a std::list.
std::list is expensive, but so is std::sorting a SmallVector of SmallVectors of
heavyweight PartialDiagnostics.

Saves ~30k in a i386-linux-Release+Asserts clang build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153437 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 14:05:40 +00:00
Richard Smith 38f0df352f Handle instantiations of redeclarations of forward-declared enumerations within
templated functions. Build a redeclaration chain, and only instantiate the
definition of the enum when visiting the defining declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153427 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 04:58:10 +00:00
Richard Smith 4ca93d9978 Delay checking of dependent underlying types for redeclarations of member
enumerations in templates until the template is instantiated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153426 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 04:08:46 +00:00
Aaron Ballman b3dcbbda59 Since this change is generating a considerable amount of discussion (and possibly even a regression for known bad versions), I'm reverting it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153420 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-25 22:46:17 +00:00
Aaron Ballman b3656d312d No longer hard coding paths to the MinGW include directories; using a regular expression instead.
Patch thanks to Nikola Smiljanic

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153413 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-25 15:47:41 +00:00
NAKAMURA Takumi 6955da2cad clang/lib/Analysis/CFG.cpp: Get rid of early insertion of placeholder to the map.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153407 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-25 06:30:37 +00:00
NAKAMURA Takumi 9260f618e7 clang/lib/Analysis/CFG.cpp: Fix memory leak since r153297.
evaluateAsBooleanConditionNoCache(S) might update the map and invalidate the iterator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153406 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-25 06:30:32 +00:00
Benjamin Kramer 7e42392eb2 Simplify some users of DenseMap::erase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153389 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-24 18:22:12 +00:00
Fariborz Jahanian 790d295ed4 remove declaration of _objc_empty_vtable no longer
used in modern objc translator. // rdar://11105680



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153386 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-24 16:57:13 +00:00
Fariborz Jahanian 249cd102cb moderin objc translator: remove 'const' from remaining
fields in _class_ro_t metadata. //  rdar://11079898



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153384 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-24 16:53:16 +00:00