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

38264 Коммитов

Автор SHA1 Сообщение Дата
Hans Wennborg f0e956bb37 Revert part of r161175 which was wrong for OpenBSD's PowerPC target.
Contributed by Brad Smith <brad@comstyle.com>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161481 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 08:41:02 +00:00
Richard Smith 50d61c8ccf Implement final piece of DR963 and also DR587:
A conditional operator between glvalues of types cv1 T and cv2 T produces a
glvalue if the expressions are of the same value kind and one of cv1 and cv2
is a subset of the other.

A conditional operator between two null pointer constants is permitted if one
of them is of type std::nullptr_t.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161476 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 06:13:49 +00:00
Chris Lattner 9a58584bb1 clarify that the advantages of the BSD license apply to when you incorporate clang into proprietary code bases,
patch by Jonathan Sauer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161475 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 05:26:51 +00:00
Eli Friedman 06808f1b88 Get rid of an early return in Sema::ActOnFields which doesn't make sense anymore.
Fixes a crash (<rdar://problem/11067144>), and generally seems to improve
recovery in other cases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161474 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 04:39:56 +00:00
Eli Friedman 859c65cdbe Fix an assertion failure with a C++ constructor initializing a
member of reference type in an anonymous struct.  PR13154.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161473 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 03:51:37 +00:00
Eli Friedman 15631b4d35 Fix a -ast-dump crash.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161472 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 03:47:15 +00:00
Fariborz Jahanian b25466e8b3 objc-arc: Make -Wdirect-ivar-access accessible to all
memory models, except when arc is accessing a weak
ivar (which is an error). // rdar://6505197


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161458 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 23:48:10 +00:00
Chad Rosier 0e2a86802b Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161455 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 23:12:23 +00:00
Richard Smith 604fb38cd9 When building a conditional operator where one operand is a throw-expression
and the other is a glvalue of class type, don't forget to copy-initialize a
temporary when performing the lvalue-to-rvalue conversion on the glvalue.
Strangely, DefaultLvalueConversions misses this part of the lvalue-to-rvalue
conversions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161450 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 22:06:48 +00:00
Richard Smith 0b8220ae34 -Wunused-private-fields: Don't try to check unresolved initializer expressions
for side-effects. Instead, check for side-effects after performing
initialization. Doing so also removes some strange corner cases and differences
between in-class initialization and constructor initialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161449 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 21:30:42 +00:00
Fariborz Jahanian c343dd87a1 objc-arc: set nonlazybind attribute on objc_retain/
objc_release for performance for these most often
called APIs. // rdar://12040837


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161448 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 21:30:31 +00:00
Dmitri Gribenko 3189d8c8f2 Remove obsolete comment. Obsoleted by r116524 when Type hierarhy bitfield
implementation was changed to a union of bitfields.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161447 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 21:19:46 +00:00
Douglas Gregor 62d20a75f5 Fix capitalization of LibXml2 for CMake on case-sensitive file systems
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161445 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 20:42:31 +00:00
Bob Wilson a7635f115e Don't complain about -fobjc-link-runtime being unused with -fobjc-arc.
If you build with -fobjc-arc, then -fobjc-link-runtime is implied but we
don't need to warn about it being unused in that case.  rdar://12039965

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161444 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 19:58:00 +00:00
Ted Kremenek 6e53137f44 Teach ccc-analyze about -fobjc-legacy-dispatch and -mios-simulator-version-min
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161443 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 19:27:08 +00:00
Dmitri Gribenko cff339a60a Comment AST: DeclInfo: add a special kind for enums.
Comment XML: add a root node kind for enums.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161442 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 18:59:04 +00:00
Anna Zaks d43e114291 Turn on strncat-size warning implemented a while ago.
Warns on anti-patterns/typos in the 'size' argument to strncat. The
correct size argument should look like the following:
 - strncat(dst, src, sizeof(dst) - strlen(dest) - 1);

We warn on: 
 - sizeof(dst)
 - sizeof(src)
 - sizeof(dst) - strlen(dst)
 - sizeof(src) - anything

(This has been implemented in void Sema::CheckStrncatArguments().)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161440 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 18:36:58 +00:00
Dmitri Gribenko 67bf7dd9fa c-index-test Makefile: fix build on Linux. Reviewed by Eric Christopher.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161439 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 18:36:33 +00:00
Dmitri Gribenko 16bec0630e Comment.h: fix typo in comment
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161436 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 18:20:04 +00:00
Dmitri Gribenko dd7b803e6c Comment AST: treat enumerators as "variables" in DeclInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161435 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 18:12:22 +00:00
Dmitri Gribenko f303d4cb10 libclang API for comment-to-xml conversion.
The implementation also includes a Relax NG schema and tests for the schema
itself.  The schema is used in c-index-test to verify that XML documents we
produce are valid.  In order to do the validation, we add an optional libxml2
dependency for c-index-test.

Credits for CMake part go to Doug Gregor.  Credits for Autoconf part go to Eric
Christopher.  Thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161431 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 17:54:38 +00:00
Fariborz Jahanian cff863fd80 objective-c: Exclude -Wdirect-ivar-access for arc.
Allow direct ivar access in init and dealloc methods
in mrr. // rdar://650197


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161426 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 16:38:44 +00:00
Hans Wennborg f7158fa034 Properly check length modfiers for %n in format strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161408 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 09:13:19 +00:00
Hans Wennborg 58e1e54476 Remove ScanfArgType and bake that logic into ArgType.
This is useful for example for %n in printf, which expects
a pointer to int with the same logic for checking as %d
would have in scanf.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161407 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 08:59:46 +00:00
Chandler Carruth 5d435b6001 Initial support for recursing into the new clang-tools-extra repository
if checked out under clang/tools/extra.

This is mostly so folks other than me can start to test. Documentation,
details, and an announcement are still in the works.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161405 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 08:37:42 +00:00
Hans Wennborg f3749f4168 Rename analyze_format_string::ArgTypeResult to ArgType
Also remove redundant constructors and unused member functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161403 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 08:11:26 +00:00
Douglas Gregor b38b491409 Objective-C pointer types don't have C-linkage, even though they are
non-POD. Fixes <rdar://problem/12031870>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161395 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 06:14:34 +00:00
Richard Smith 60b70388e4 Update documentation of HasSideEffects to match its callers' expectations, and
update implementation to match. An elidable, non-trivial constructor call is a
side-effect under this definition, but wasn't under the old one, because we are
not required to evaluate it even though it may have an effect.

Also rationalize checking for volatile reads: just look for lvalue-to-rvalue
conversions on volatile glvalues, and ignore whether a DeclRefExpr etc is for
a volatile variable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161393 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 05:18:29 +00:00
Anna Zaks acac844992 [analyzer] + New line at end of file
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161392 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 05:12:29 +00:00
Anna Zaks 8ed21ef726 [analyzer] Address Jordan's review of DynamicTypePropagation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161391 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 05:12:24 +00:00
Eric Christopher 387611eaf8 Fix the test RUN line for this better.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161390 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 05:04:19 +00:00
Ted Kremenek 4a535368eb Enhance ClangDiagnosticsEmitter to reject diagnostics that are errors that are also
included in warning groups.  Warning groups can only contain warnings, because only
warnings can be mapped to errors or ignored.

This caught a few diagnostics that were incorrectly in diagnostic groups, and
could have resulted in a compiler crash when those diagnostic groups were mapped.

Fixes <rdar://problem/12044436>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161389 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 05:01:49 +00:00
Richard Smith 8ae4ec2845 Teach Expr::HasSideEffects about all the Expr types, and fix a bug where it
was mistakenly classifying dynamic_casts which might throw as having no side
effects.

Switch it from a visitor to a switch, so it is kept up-to-date as future Expr
nodes are added. Move it from ExprConstant.cpp to Expr.cpp, since it's not
really related to constant expression evaluation.

Since we use HasSideEffect to determine whether to emit an unused global with
internal linkage, this has the effect of suppressing emission of globals in
some cases.

I've left many of the Objective-C cases conservatively assuming that the
expression has side-effects. I'll leave it to someone with better knowledge
of Objective-C than mine to improve them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161388 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 04:16:51 +00:00
Jordan Rose daa88985ed [analyzer] Add a test case for OS X 10.8's NSMakeCollectable under non-GC.
This is an additional test for r161349 (ignoring 10.8's annotations for
NSMakeCollectable).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161380 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 01:11:14 +00:00
Eric Christopher c7fb748061 If we don't have a complete type for the array type yet either then
just let the alignment be zero.

PR13531

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161379 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 00:48:43 +00:00
Ted Kremenek 97d0293059 Remove two fall through diagnostics from the IgnoredAttributes group, since they are errors, not warnings.
Only warnings should be in warning groups.  This was causing an assertion failure in
code using pragmas to map -Wignored-attributes to ignored, but this kind of
diagnostic mapping is disallowed for builtin errors.  We should just wire
up tablegen to reject errors being in diagnostic groups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161376 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 00:34:48 +00:00
Chad Rosier 79efe24e12 [ms-inline asm] Stmt destructors are never called, so allocate the AsmToks using
the ASTContext BumpPtr.  Also use the preferred llvm::ArrayRef interface.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161373 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 00:29:06 +00:00
Eric Christopher b3f46ec9a4 Specify a triple on this to make it easier to test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161372 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 00:28:23 +00:00
Eric Christopher d0a97c49c2 Remove some unintended changes from my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161369 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 00:18:40 +00:00
Eric Christopher 363e5acfd9 Make sure when we get the replacement type for a template argument
that we attach the lost qualifiers.

Fixes rdar://11882155

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161368 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 00:14:25 +00:00
Ted Kremenek b019489d42 Handle null suffixes in GetTemporaryPath (PCH files don't have suffixes).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161367 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 00:02:30 +00:00
Anna Zaks 3408681615 [analyzer] DynTypes: Add a test for improper cast performed by user.
Dynamic type inference does the right thing in this case. However, as
Jordan suggested, it would be nice to add a warning here as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161365 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 23:58:16 +00:00
Fariborz Jahanian c69d7356ca objective-c: Implement gcc's -Wdirect-ivar-access option.
// rdar://6505197


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161362 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 23:50:51 +00:00
Dmitri Gribenko 8a90393e7c Comment parsing: fix crash on \tparam followed immediately by another block
command, for example: \tparam\brief.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161361 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 23:48:44 +00:00
Anna Zaks c4c647c88c [analyzer] Dynamic type info - propagate through implicit casts.
I currently have a bit of redundancy with the cast kind switch statement
inside the ImplicitCast callback, but I might be adding more casts going
forward.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161358 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 23:25:45 +00:00
Anna Zaks c7ecc43c33 [analyzer] Add a checker to manage dynamic type propagation.
Instead of sprinkling dynamic type info propagation throughout
ExprEngine, the added checker would add the more precise type
information on known APIs (Ex: ObjC alloc, new) and propagate
the type info in other cases (ex: ObjC init method, casts (the second is
not implemented yet)).

Add handling of ObjC alloc, new and init to the checker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161357 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 23:25:39 +00:00
David Blaikie 71f55f7717 Refactor checks for unevaluated contexts into a common utility function.
The one caller that's surrounded by nearby code manipulating the underlying
evaluation context list is left unmodified for readability.

Review by Sean Silva and Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161355 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 22:47:24 +00:00
Dmitri Gribenko 04bf29eb1b Comment AST: DeclInfo: collapse a bunch of boolean flags into an enum.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161352 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 21:31:15 +00:00
Jordan Rose a801acd977 [analyzer] Add plist output checks for all four "path notes" tests.
No functionality change, but from now on, any new path notes should be
tested both with plain-text output (for ease of human auditing) and with
plist output (to ensure control flow and events are being correctly
represented in Xcode).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161351 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 21:28:14 +00:00
Jordan Rose 2b1b025fa6 [analyzer] Improve arrow locations for PseudoObjectExprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161350 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 21:28:11 +00:00