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

34035 Коммитов

Автор SHA1 Сообщение Дата
Nick Lewycky 8013afe575 Add testcase for r148375!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148378 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 04:28:31 +00:00
Eli Friedman 9bc291d5c0 Make PotentiallyPotentiallyEvaluated contexts work correctly when referencing a class field from outside an instance method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148376 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 03:53:45 +00:00
Nick Lewycky f6b56374e4 Fix a string over-run detected by ASAN.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148375 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 03:41:19 +00:00
Richard Smith 40b993a826 A call to strlen is not a constant expression, even if we're treating it as a
builtin.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148374 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 03:06:12 +00:00
Eli Friedman 6b3014b07c The value of a case statement is a potentially evaluated context. Found by inspection.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148373 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 02:54:10 +00:00
Anna Zaks 7cdfe298ae [analyzer] Refactor: prePropagateTaint ->
TaintPropagationRule::process().

Also remove the "should be a pointer argument" warning - should be
handled elsewhere.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148372 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 02:45:13 +00:00
Anna Zaks 4e46221e38 [analyzer] Taint: warn when tainted data is used to specify a buffer
size (Ex: in malloc, memcpy, strncpy..)

(Maybe some of this could migrate to the CString checker. One issue
with that is that we might want to separate security issues from
regular API misuse.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148371 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 02:45:11 +00:00
Anna Zaks 9b0c749a20 [analyzer] Taint: add taint propagation rules for string and memory copy
functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148370 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 02:45:07 +00:00
Anna Zaks 9392d4e4da Constify FunctionDecl::getmemoryFunctionKind().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148369 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 02:45:01 +00:00
Nick Lewycky 22afaccd9a Fix special king of typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148368 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 01:50:13 +00:00
Eli Friedman 93c878ee09 Fix a couple issues where we didn't correctly delay diagnostics in PotentiallyPotentiallyEvaluated contexts. In preparation for making sizeof() PotentiallyPotentiallyEvaluated.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148367 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 01:05:54 +00:00
Fariborz Jahanian 303b4f9464 output body of folded case again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148361 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 23:55:19 +00:00
Fariborz Jahanian 985df1c1f2 Folding away unreachable case statement.
patch (slightly revised) by Aaron Ballman.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148359 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 23:39:50 +00:00
Douglas Gregor 65a1e6707d Make sure to initialize ExternalProtocolPtrTy
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148358 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 23:38:32 +00:00
Fariborz Jahanian 87eaf72652 objc-arc: when 'assign' attribute is unspecified,
rely on property's type for its life-time to avoid
bogus warning with -Warc-unsafe-retained-assign.
// rdar://10694932


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148355 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 22:58:16 +00:00
Sebastian Redl 98d3606cd5 Add Sema::isInitListConstructor. This will be needed for upcoming work.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148354 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 22:50:14 +00:00
Sebastian Redl 62b7cfb73e Auto deduction support for std::initializer_list, including for-range support. This means you can now write:
for (int i : {1, 4, 512, 23, 251}) {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148353 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 22:50:08 +00:00
Sebastian Redl 84760e3a5d Template argument deduction for std::initializer_list arguments from initializer lists.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148352 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 22:49:58 +00:00
Sebastian Redl bb95e51a36 Rename the first of 11 DeduceTemplateArguments overloads.
There are 5 functions of this name in Sema, and 6 more static helpers in
SemaTemplateDeduction.cpp. The Sema functions have jobs like "deduce for
function call", "deduce for taking the address", etc. The static helpers
have jobs like "deduce by comparing two types", "deduce by comparing two
lists of types", "deduce by comparing two template arguments", etc.
The fact that they all are called the same and only differ in two of their
6 or more arguments makes the code using them very hard to read.

Here I rename the one function that concerns me most at the moment, but
as a matter of cleanup, the others will eventually be renamed as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148351 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 22:49:52 +00:00
Sebastian Redl fe5922809e Basic overloading support for std::initializer_list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148350 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 22:49:48 +00:00
Sebastian Redl 2b916b8b55 Sema support for initialization of std::initializer_list from initializer lists.
This does not yet support CodeGen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148349 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 22:49:42 +00:00
Sebastian Redl 395e04dbd7 Add Sema::isStdInitializerList, which will be necessary for the upcoming operations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148348 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 22:49:33 +00:00
Anton Yartsev 9bc23ba9e4 fix for PR11655
changes i64 alignment from 64 to 32 for powerpc-darwin

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148345 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 22:40:00 +00:00
Bob Wilson 0af8049a02 Disable -Wduplicate-method-match by default. <rdar://problem/10663536>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148343 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 22:24:32 +00:00
Eli Friedman f7b2d8b3b1 Add __builtin_labs and __builtin_llabs, to complete the set of __builtin_*abs. Patch by Ruben Van Boxem.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148340 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 22:11:30 +00:00
Richard Smith e7aa62de65 Remove constant member pointer support from Expr-based constant emission now
that APValue-based constant emission knows how to emit member pointers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148336 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 21:42:19 +00:00
Eli Friedman 8788491e10 Correctly resolve an overload set passed to an overloaded operator=. PR11784.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148335 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 21:27:43 +00:00
Richard Smith 7d580a4e9e Enable constant evaluation of implicit calls to constexpr conversion operators.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148333 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 21:17:26 +00:00
Dan Gohman a8398ea850 Enable the new ObjC ARC autorelease pool elimination pass.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148331 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 20:54:51 +00:00
John McCall b29b12d494 When initializing a catch variable in ARC, be sure to emit retains
or whatever else is required for the initialization instead of
assuming it can be done with a simple store.

Fixes PR11732.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148325 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 20:16:56 +00:00
Jean-Daniel Dupas 29c3f814b6 Fix a couples of issues in format strings checking.
PR 10274: format function attribute with the NSString archetype yields no compiler warnings
PR 10275: format function attribute isn't checked in Objective-C methods



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148324 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 20:03:31 +00:00
Douglas Gregor 56ca8a9c0f Rework the way in which we (de-)serialize the declarations
corresponding to TagType and ObjCInterfaceType. Previously, we would
serialize the definition (if available) or the canonical declaration
(if no definition was available). However, this can end up forcing the
deserialization of the definition even through we might not want to
yet. 

Instead, always serialize the canonical declaration reference in the
TagType/ObjCInterfaceType entry, and as part of loading a pending
definition, update the "decl" pointer within the type node to point at
the definition. This is more robust in hard-to-isolate cases
where the *Type gets built and filled in before we see the definition.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148323 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 19:21:53 +00:00
Fariborz Jahanian 6b81b0d82a objc: fixes a bug where struct used inside an
objc class was not being exported to parent decl
context resulting in bogus mismatch warning later on.
// rdar://10655530


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148320 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 18:52:07 +00:00
Argyrios Kyrtzidis 7fe90f3bfa [libclang] Make sure Preprocessor is set in ASTUnit during indexing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148319 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 18:48:07 +00:00
Douglas Gregor 4c86fdb84f Don't eagerly deserialize the 'Protocol' type when initializing code
generation for Objective-C; it may not be needed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148317 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 18:36:30 +00:00
Douglas Gregor 3efe999a9a When collecting all of the redeclarations of a declaration loaded from
a module file, be sure to also add the first (potentially canonical)
declarations to the chain. This isn't guaranteed to occur because the
first declaration is not listed in the stored redeclaration chain.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148314 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 18:13:45 +00:00
Douglas Gregor a6ea10e22b Delay the creation of the built-in Objective-C class 'Protocol' by
moving it from a "special type" to a predefined declaration, as we do
for id, Class, and SEL.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148313 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 18:09:05 +00:00
Hans Wennborg c8769460f1 Treat -Wformat=0 as an alias for -Wformat.
Fixes PR9195.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148300 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 09:30:38 +00:00
David Blaikie 9fdefb338e Re-add an over-zealously removed break.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148296 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 08:24:58 +00:00
David Blaikie 312ede8a6d Remove dead comments as per Chandler's feedback to r148292
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148294 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 07:28:46 +00:00
David Blaikie 7530c034c0 Remove unreachable code in Clang. (replace with llvm_unreachable where appropriate or when GCC requires it)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148292 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 06:56:22 +00:00
David Blaikie 561d3abc88 Remove unnecessary default cases in switches over enums.
This allows -Wswitch-enum to find switches that need updating when these enums are modified.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148281 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 02:30:50 +00:00
Argyrios Kyrtzidis 5e192a7d60 [libclang] Make clang_getCursorCompletionString not depend on the ASTUnit having
a Sema.

This allows it to work when Sema is not available, like when loading AST files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148279 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 02:15:54 +00:00
Argyrios Kyrtzidis ea8c59aaa6 Introduce a CodeCompletionResult::CreateCodeCompletionString() that
does not depend on Sema, it accepts an ASTContext and a Preprocessor.

Step towards making clang_getCursorCompletionString not depend on Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148278 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 02:15:51 +00:00
Argyrios Kyrtzidis 6fc9e1d982 Introduce a static Sema::MarkDeducedTemplateParameters() that only depends
on an ASTContext.

This is a step towards making clang_getCursorCompletionString not depend on Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148277 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 02:15:41 +00:00
Eli Friedman 55693fbe18 Revert r148271; this requires more thought.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148276 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 02:13:45 +00:00
Eli Friedman 58219e7f27 Change the behavior of the lvalue-to-rvalue conversion for varargs in PotentiallyPotentiallyEvaluated contexts so that we model it in a sane way in most cases, and give up for the edge case which hopefully doesn't matter too much.
In preparation for correctly treating sizeof() as a PotentiallyPotentiallyEvaluated context.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148271 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 01:17:46 +00:00
Nico Weber 883692ebd4 Improve diagnostics for dangling '}'.
Fixes PR6484. Patch from Jason Switzer!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148270 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 01:04:27 +00:00
Anna Zaks 0a151a137a Use Builtin ID as the return value
for FunctionDecl::getMemoryFunctionKind().

This is a follow up on the Chris's review for r148142: We don't want to
pollute FunctionDecl with an extra enum. (To make this work, added
memcmp and family to the library builtins.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148267 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 00:37:07 +00:00
Anna Zaks 022b3f4490 [analyzer] Taint: generalize taint propagation to simplify adding more
taint propagation functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148266 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 00:37:02 +00:00