]> granicus.if.org Git - clang/log
clang
12 years agoComment XML: use xml:space="preserve" in Verbatim tags, so that XML tidy does
Dmitri Gribenko [Wed, 8 Aug 2012 22:10:24 +0000 (22:10 +0000)]
Comment XML: use xml:space="preserve" in Verbatim tags, so that XML tidy does
not compress spaces in verbatim content.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161531 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUnify the codepaths for emitting deprecation warnings. The test changes are just...
Eli Friedman [Wed, 8 Aug 2012 21:52:41 +0000 (21:52 +0000)]
Unify the codepaths for emitting deprecation warnings.  The test changes are just to account for us emitting notes more consistently.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161528 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAddress code review comments for Wstrncat-size warning (r161440).
Anna Zaks [Wed, 8 Aug 2012 21:42:23 +0000 (21:42 +0000)]
Address code review comments for Wstrncat-size warning (r161440).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161527 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Use more idiomatic logic. Thanks, Bill.
Chad Rosier [Wed, 8 Aug 2012 21:42:11 +0000 (21:42 +0000)]
[ms-inline asm] Use more idiomatic logic.  Thanks, Bill.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161526 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplicitly annotate __CFStringMakeConstantString with format_arg(1).
Jordan Rose [Wed, 8 Aug 2012 21:17:31 +0000 (21:17 +0000)]
Implicitly annotate __CFStringMakeConstantString with format_arg(1).

We handled the builtin version of this function in r157968, but the builtin
isn't used when compiling as -fno-constant-cfstrings.

This should complete <rdar://problem/6157200>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161525 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Add basic codegen support for simple asm stmts. Currently,
Chad Rosier [Wed, 8 Aug 2012 21:15:52 +0000 (21:15 +0000)]
[ms-inline asm] Add basic codegen support for simple asm stmts.  Currently,
only machine specific clobbers are modeled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161524 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't add attributes for "#pragma pack" and friends to tag declarations which
Eli Friedman [Wed, 8 Aug 2012 21:08:34 +0000 (21:08 +0000)]
Don't add attributes for "#pragma pack" and friends to tag declarations which
are not definitions. This follows the behavior of both gcc and earlier
versions of clang. Regression from r156531.  <rdar://problem/12048621>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161523 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Make sure IsSimple is correctly handled.
Chad Rosier [Wed, 8 Aug 2012 21:08:20 +0000 (21:08 +0000)]
[ms-inline asm] Make sure IsSimple is correctly handled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161522 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove extraneous comment.
Chad Rosier [Wed, 8 Aug 2012 20:38:22 +0000 (20:38 +0000)]
Remove extraneous comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161521 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Add a very simple test case. Basically, we're only testing for
Chad Rosier [Wed, 8 Aug 2012 20:37:31 +0000 (20:37 +0000)]
[ms-inline asm] Add a very simple test case.  Basically, we're only testing for
crashers at the moment (and coincidentally this case was causing a crash).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161520 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Refactor the logic to generate the AsmString into Sema. No
Chad Rosier [Wed, 8 Aug 2012 19:48:07 +0000 (19:48 +0000)]
[ms-inline asm] Refactor the logic to generate the AsmString into Sema.  No
functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161518 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhitespace.
Chad Rosier [Wed, 8 Aug 2012 18:51:50 +0000 (18:51 +0000)]
Whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161517 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhitespace.
Chad Rosier [Wed, 8 Aug 2012 18:46:20 +0000 (18:46 +0000)]
Whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161516 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Clean up the printing of FieldRegions for leaks.
Jordan Rose [Wed, 8 Aug 2012 18:23:36 +0000 (18:23 +0000)]
[analyzer] Clean up the printing of FieldRegions for leaks.

Unfortunately, generalized region printing is very difficult:
- ElementRegions are used both for casting and as actual elements.
- Accessing values through a pointer means going through an intermediate
  SymbolRegionValue; symbolic regions are untyped.
- Referring to implicitly-defined variables like 'this' and 'self' could be
  very confusing if they come from another stack frame.

We fall back to simply not printing the region name if we can't be sure it
will print well. This will allow us to improve in the future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161512 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Track malloc'd regions stored in structs.
Jordan Rose [Wed, 8 Aug 2012 18:23:31 +0000 (18:23 +0000)]
[analyzer] Track malloc'd regions stored in structs.

The main blocker on this (besides the previous commit) was that
ScanReachableSymbols was not looking through LazyCompoundVals.
Once that was fixed, it's easy enough to clear out malloc data on return,
just like we do when we bind to a global region.

<rdar://problem/10872635>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161511 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Revamp RegionStore to distinguish regions with symbolic offsets.
Jordan Rose [Wed, 8 Aug 2012 18:23:27 +0000 (18:23 +0000)]
[analyzer] Revamp RegionStore to distinguish regions with symbolic offsets.

RegionStore currently uses a (Region, Offset) pair to describe the locations
of memory bindings. However, this representation breaks down when we have
regions like 'array[index]', where 'index' is unknown. We used to store this
as (SubRegion, 0); now we mark them specially as (SubRegion, SYMBOLIC).

Furthermore, ProgramState::scanReachableSymbols depended on the existence of
a sub-region map, but RegionStore's implementation doesn't provide for such
a thing. Moving the store-traversing logic of scanReachableSymbols into the
StoreManager allows us to eliminate the notion of SubRegionMap altogether.

This fixes some particularly awkward broken test cases, now in
array-struct-region.c.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161510 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoConstify CXXRecordDecl::isVirtuallyDerivedFrom.
Jordan Rose [Wed, 8 Aug 2012 18:23:20 +0000 (18:23 +0000)]
Constify CXXRecordDecl::isVirtuallyDerivedFrom.

No functionality change. A couple ugly const_casts because the ancestor
search code is used for other purposes as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161509 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Add support for detecting simple ms-style inline asm. Simple
Chad Rosier [Wed, 8 Aug 2012 18:22:06 +0000 (18:22 +0000)]
[ms-inline asm] Add support for detecting simple ms-style inline asm.  Simple
asm statements are those that don't reference variable names, function names,
and labels.

Add logic to generate a patched AsmString that will eventually be consumed by
the AsmParser.  No functional change at this point, so unfortunately no test
case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161508 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd the IsSimple/IsVolatile parameters to the MSAsmStmt constructor.
Chad Rosier [Wed, 8 Aug 2012 17:35:36 +0000 (17:35 +0000)]
Add the IsSimple/IsVolatile parameters to the MSAsmStmt constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161503 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement warning for integral null pointer constants other than the literal 0.
David Blaikie [Wed, 8 Aug 2012 17:33:31 +0000 (17:33 +0000)]
Implement warning for integral null pointer constants other than the literal 0.

This is effectively a warning for code that violates core issue 903 & thus will
become standard error in the future, hopefully. It catches strange null
pointers such as: '\0', 1 - 1, const int null = 0; etc...

There's currently a flaw in this warning (& the warning for 'false' as a null
pointer literal as well) where it doesn't trigger on comparisons (ptr == '\0'
for example). Fix to come in a future patch.

Also, due to this only being a warning, not an error, it triggers quite
frequently on gtest code which tests expressions for null-pointer-ness in a
SFINAE context (so it wouldn't be a problem if this was an error as in an
actual implementation of core issue 903). To workaround this for now, the
diagnostic does not fire in unevaluated contexts.

Review by Sean Silva and Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161501 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjc: Include all types when issuing warning under
Fariborz Jahanian [Wed, 8 Aug 2012 16:41:04 +0000 (16:41 +0000)]
objc: Include all types when issuing warning under
-Wdirect-ivar-access.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161500 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd various MC components to clang build to support MS-style inline assembly.
Chad Rosier [Wed, 8 Aug 2012 16:27:29 +0000 (16:27 +0000)]
Add various MC components to clang build to support MS-style inline assembly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161498 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPreprocessor: fix __OPTIMIZE_SIZE__ and -Oz
Dylan Noblesmith [Wed, 8 Aug 2012 16:09:15 +0000 (16:09 +0000)]
Preprocessor: fix  __OPTIMIZE_SIZE__ and -Oz

Add some tests for __OPTIMIZE_SIZE__ and  __NO_INLINE__,
removing the superfluous copies in the target-specific
tests, since it's target-independent.

This uncovered a bug in the handling of -Oz: it would
attempt to store the value 2 in the 1-bit bitfield OptimizeSize,
leaving a value of 0 and never defining __OPTIMIZE_SIZE__.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161495 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFrontend: further document __BYTE_ORDER__
Dylan Noblesmith [Wed, 8 Aug 2012 16:09:12 +0000 (16:09 +0000)]
Frontend: further document __BYTE_ORDER__

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161494 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove unused variables.
Benjamin Kramer [Wed, 8 Aug 2012 09:26:28 +0000 (09:26 +0000)]
Remove unused variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161483 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert part of r161175 which was wrong for OpenBSD's PowerPC target.
Hans Wennborg [Wed, 8 Aug 2012 08:41:02 +0000 (08:41 +0000)]
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

12 years agoImplement final piece of DR963 and also DR587:
Richard Smith [Wed, 8 Aug 2012 06:13:49 +0000 (06:13 +0000)]
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

12 years agoclarify that the advantages of the BSD license apply to when you incorporate clang...
Chris Lattner [Wed, 8 Aug 2012 05:26:51 +0000 (05:26 +0000)]
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

12 years agoGet rid of an early return in Sema::ActOnFields which doesn't make sense anymore.
Eli Friedman [Wed, 8 Aug 2012 04:39:56 +0000 (04:39 +0000)]
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

12 years agoFix an assertion failure with a C++ constructor initializing a
Eli Friedman [Wed, 8 Aug 2012 03:51:37 +0000 (03:51 +0000)]
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

12 years agoFix a -ast-dump crash.
Eli Friedman [Wed, 8 Aug 2012 03:47:15 +0000 (03:47 +0000)]
Fix a -ast-dump crash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161472 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjc-arc: Make -Wdirect-ivar-access accessible to all
Fariborz Jahanian [Tue, 7 Aug 2012 23:48:10 +0000 (23:48 +0000)]
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

12 years agoWhitespace.
Chad Rosier [Tue, 7 Aug 2012 23:12:23 +0000 (23:12 +0000)]
Whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161455 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen building a conditional operator where one operand is a throw-expression
Richard Smith [Tue, 7 Aug 2012 22:06:48 +0000 (22:06 +0000)]
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

12 years ago-Wunused-private-fields: Don't try to check unresolved initializer expressions
Richard Smith [Tue, 7 Aug 2012 21:30:42 +0000 (21:30 +0000)]
-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

12 years agoobjc-arc: set nonlazybind attribute on objc_retain/
Fariborz Jahanian [Tue, 7 Aug 2012 21:30:31 +0000 (21:30 +0000)]
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

12 years agoRemove obsolete comment. Obsoleted by r116524 when Type hierarhy bitfield
Dmitri Gribenko [Tue, 7 Aug 2012 21:19:46 +0000 (21:19 +0000)]
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

12 years agoFix capitalization of LibXml2 for CMake on case-sensitive file systems
Douglas Gregor [Tue, 7 Aug 2012 20:42:31 +0000 (20:42 +0000)]
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

12 years agoDon't complain about -fobjc-link-runtime being unused with -fobjc-arc.
Bob Wilson [Tue, 7 Aug 2012 19:58:00 +0000 (19:58 +0000)]
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

12 years agoTeach ccc-analyze about -fobjc-legacy-dispatch and -mios-simulator-version-min
Ted Kremenek [Tue, 7 Aug 2012 19:27:08 +0000 (19:27 +0000)]
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

12 years agoComment AST: DeclInfo: add a special kind for enums.
Dmitri Gribenko [Tue, 7 Aug 2012 18:59:04 +0000 (18:59 +0000)]
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

12 years agoTurn on strncat-size warning implemented a while ago.
Anna Zaks [Tue, 7 Aug 2012 18:36:58 +0000 (18:36 +0000)]
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

12 years agoc-index-test Makefile: fix build on Linux. Reviewed by Eric Christopher.
Dmitri Gribenko [Tue, 7 Aug 2012 18:36:33 +0000 (18:36 +0000)]
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

12 years agoComment.h: fix typo in comment
Dmitri Gribenko [Tue, 7 Aug 2012 18:20:04 +0000 (18:20 +0000)]
Comment.h: fix typo in comment

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161436 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment AST: treat enumerators as "variables" in DeclInfo.
Dmitri Gribenko [Tue, 7 Aug 2012 18:12:22 +0000 (18:12 +0000)]
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

12 years agolibclang API for comment-to-xml conversion.
Dmitri Gribenko [Tue, 7 Aug 2012 17:54:38 +0000 (17:54 +0000)]
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

12 years agoobjective-c: Exclude -Wdirect-ivar-access for arc.
Fariborz Jahanian [Tue, 7 Aug 2012 16:38:44 +0000 (16:38 +0000)]
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

12 years agoProperly check length modfiers for %n in format strings.
Hans Wennborg [Tue, 7 Aug 2012 09:13:19 +0000 (09:13 +0000)]
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

12 years agoRemove ScanfArgType and bake that logic into ArgType.
Hans Wennborg [Tue, 7 Aug 2012 08:59:46 +0000 (08:59 +0000)]
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

12 years agoInitial support for recursing into the new clang-tools-extra repository
Chandler Carruth [Tue, 7 Aug 2012 08:37:42 +0000 (08:37 +0000)]
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

12 years agoRename analyze_format_string::ArgTypeResult to ArgType
Hans Wennborg [Tue, 7 Aug 2012 08:11:26 +0000 (08:11 +0000)]
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

12 years agoObjective-C pointer types don't have C-linkage, even though they are
Douglas Gregor [Tue, 7 Aug 2012 06:14:34 +0000 (06:14 +0000)]
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

12 years agoUpdate documentation of HasSideEffects to match its callers' expectations, and
Richard Smith [Tue, 7 Aug 2012 05:18:29 +0000 (05:18 +0000)]
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

12 years ago[analyzer] + New line at end of file
Anna Zaks [Tue, 7 Aug 2012 05:12:29 +0000 (05:12 +0000)]
[analyzer] + New line at end of file

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161392 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Address Jordan's review of DynamicTypePropagation.
Anna Zaks [Tue, 7 Aug 2012 05:12:24 +0000 (05:12 +0000)]
[analyzer] Address Jordan's review of  DynamicTypePropagation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161391 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix the test RUN line for this better.
Eric Christopher [Tue, 7 Aug 2012 05:04:19 +0000 (05:04 +0000)]
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

12 years agoEnhance ClangDiagnosticsEmitter to reject diagnostics that are errors that are also
Ted Kremenek [Tue, 7 Aug 2012 05:01:49 +0000 (05:01 +0000)]
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

12 years agoTeach Expr::HasSideEffects about all the Expr types, and fix a bug where it
Richard Smith [Tue, 7 Aug 2012 04:16:51 +0000 (04:16 +0000)]
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

12 years ago[analyzer] Add a test case for OS X 10.8's NSMakeCollectable under non-GC.
Jordan Rose [Tue, 7 Aug 2012 01:11:14 +0000 (01:11 +0000)]
[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

12 years agoIf we don't have a complete type for the array type yet either then
Eric Christopher [Tue, 7 Aug 2012 00:48:43 +0000 (00:48 +0000)]
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

12 years agoRemove two fall through diagnostics from the IgnoredAttributes group, since they...
Ted Kremenek [Tue, 7 Aug 2012 00:34:48 +0000 (00:34 +0000)]
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

12 years ago[ms-inline asm] Stmt destructors are never called, so allocate the AsmToks using
Chad Rosier [Tue, 7 Aug 2012 00:29:06 +0000 (00:29 +0000)]
[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

12 years agoSpecify a triple on this to make it easier to test.
Eric Christopher [Tue, 7 Aug 2012 00:28:23 +0000 (00:28 +0000)]
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

12 years agoRemove some unintended changes from my last patch.
Eric Christopher [Tue, 7 Aug 2012 00:18:40 +0000 (00:18 +0000)]
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

12 years agoMake sure when we get the replacement type for a template argument
Eric Christopher [Tue, 7 Aug 2012 00:14:25 +0000 (00:14 +0000)]
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

12 years agoHandle null suffixes in GetTemporaryPath (PCH files don't have suffixes).
Ted Kremenek [Tue, 7 Aug 2012 00:02:30 +0000 (00:02 +0000)]
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

12 years ago[analyzer] DynTypes: Add a test for improper cast performed by user.
Anna Zaks [Mon, 6 Aug 2012 23:58:16 +0000 (23:58 +0000)]
[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

12 years agoobjective-c: Implement gcc's -Wdirect-ivar-access option.
Fariborz Jahanian [Mon, 6 Aug 2012 23:50:51 +0000 (23:50 +0000)]
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

12 years agoComment parsing: fix crash on \tparam followed immediately by another block
Dmitri Gribenko [Mon, 6 Aug 2012 23:48:44 +0000 (23:48 +0000)]
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

12 years ago[analyzer] Dynamic type info - propagate through implicit casts.
Anna Zaks [Mon, 6 Aug 2012 23:25:45 +0000 (23:25 +0000)]
[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

12 years ago[analyzer] Add a checker to manage dynamic type propagation.
Anna Zaks [Mon, 6 Aug 2012 23:25:39 +0000 (23:25 +0000)]
[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

12 years agoRefactor checks for unevaluated contexts into a common utility function.
David Blaikie [Mon, 6 Aug 2012 22:47:24 +0000 (22:47 +0000)]
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

12 years agoComment AST: DeclInfo: collapse a bunch of boolean flags into an enum.
Dmitri Gribenko [Mon, 6 Aug 2012 21:31:15 +0000 (21:31 +0000)]
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

12 years ago[analyzer] Add plist output checks for all four "path notes" tests.
Jordan Rose [Mon, 6 Aug 2012 21:28:14 +0000 (21:28 +0000)]
[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

12 years ago[analyzer] Improve arrow locations for PseudoObjectExprs.
Jordan Rose [Mon, 6 Aug 2012 21:28:11 +0000 (21:28 +0000)]
[analyzer] Improve arrow locations for PseudoObjectExprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161350 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Ignore OS X 10.8's annotations for NSMakeCollectable.
Jordan Rose [Mon, 6 Aug 2012 21:28:02 +0000 (21:28 +0000)]
[analyzer] Ignore OS X 10.8's annotations for NSMakeCollectable.

The frameworks correctly use the 'cf_consumed' and 'ns_returns_retained'
attributes for NSMakeCollectable, but we can model the behavior under
garbage collection more precisely than that.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161349 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFor global record types, the self reference checker was called twice, resulting
Richard Trieu [Mon, 6 Aug 2012 21:09:23 +0000 (21:09 +0000)]
For global record types, the self reference checker was called twice, resulting
in duplicate -Wuninitialized warnings.  Change so that only the check in
TryConstructorInitialization() will be used and a single warning be emitted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161345 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoscan-build: factor out setting of environment variables.
Ted Kremenek [Mon, 6 Aug 2012 20:19:19 +0000 (20:19 +0000)]
scan-build: factor out setting of environment variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161343 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Pass Tokens to Sema and store them in the AST. No functional
Chad Rosier [Mon, 6 Aug 2012 20:03:45 +0000 (20:03 +0000)]
[ms-inline asm] Pass Tokens to Sema and store them in the AST.  No functional
change intended.  No test case as there's no real way to test at this time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161342 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix MIPS DSP Rev1 intrinsics memory properties.
Simon Atanasyan [Mon, 6 Aug 2012 19:48:16 +0000 (19:48 +0000)]
Fix MIPS DSP Rev1 intrinsics memory properties.
The patch reviewed by Akira Hatanaka.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161333 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment parser and sema: remove useless return values
Dmitri Gribenko [Mon, 6 Aug 2012 19:03:12 +0000 (19:03 +0000)]
Comment parser and sema: remove useless return values

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161331 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPull 'xcodebuild' wrapper logic into a separate function.
Ted Kremenek [Mon, 6 Aug 2012 18:54:19 +0000 (18:54 +0000)]
Pull 'xcodebuild' wrapper logic into a separate function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161330 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment diagnostics: warn on duplicate \brief and \return commands.
Dmitri Gribenko [Mon, 6 Aug 2012 17:08:27 +0000 (17:08 +0000)]
Comment diagnostics: warn on duplicate \brief and \return commands.

Doxygen manual claims that multiple \brief or \returns commands will be merged
together, but actual behavior is different (second \brief command becomes a
part of a discussion, second \returns becomes a "Returns: blah" paragraph on
its own).  Anyway, it seems to be a bad idea to use multiple \brief or \returns
commands in a single command.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161325 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoComment diagnostics: \return in void function: specialize diagnostic text for
Dmitri Gribenko [Mon, 6 Aug 2012 16:29:26 +0000 (16:29 +0000)]
Comment diagnostics: \return in void function: specialize diagnostic text for
ObjC methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161324 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRe-enable pcmpistri/pcmpestri builtins in clang now that llvm supports them properly.
Craig Topper [Mon, 6 Aug 2012 07:07:06 +0000 (07:07 +0000)]
Re-enable pcmpistri/pcmpestri builtins in clang now that llvm supports them properly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161319 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPR13529: Don't crash if the driver sees an unused input file when running as
Richard Smith [Mon, 6 Aug 2012 04:09:06 +0000 (04:09 +0000)]
PR13529: Don't crash if the driver sees an unused input file when running as
'clang-cpp'.

For now, the test uses "REQUIRES: shell" to determine if the host system
supports "ln -s", which it uses to create a 'clang-cpp' symlink. This is a bit
hacky and should likely be directly supported by lit.cfg.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161317 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPR13499: Don't try to check whether 'override' has been validly applied until
Richard Smith [Mon, 6 Aug 2012 03:25:17 +0000 (03:25 +0000)]
PR13499: Don't try to check whether 'override' has been validly applied until
we know whether the function is virtual. But check it as soon as we do know;
in some cases we don't need to wait for an instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161316 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPR13527: don't assert if a function is explicitly defaulted when it's already
Richard Smith [Mon, 6 Aug 2012 02:25:10 +0000 (02:25 +0000)]
PR13527: don't assert if a function is explicitly defaulted when it's already
been defined.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161315 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd __builtin_readcyclecounter() to produce the @llvm.readcyclecounter() intrinsic.
Hal Finkel [Sun, 5 Aug 2012 22:03:08 +0000 (22:03 +0000)]
Add __builtin_readcyclecounter() to produce the @llvm.readcyclecounter() intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161310 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSimplify code, no functionality change.
Benjamin Kramer [Sat, 4 Aug 2012 17:00:46 +0000 (17:00 +0000)]
Simplify code, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161303 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Malloc: remove assert since is not valid as of r161248
Anna Zaks [Sat, 4 Aug 2012 02:04:27 +0000 (02:04 +0000)]
[analyzer] Malloc: remove assert since is not valid as of r161248

We can be in the situation where we did not track the symbol before
realloc was called on it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161294 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjective-C string literal has no side-effect,
Fariborz Jahanian [Sat, 4 Aug 2012 01:24:33 +0000 (01:24 +0000)]
objective-C string literal has no side-effect,
resulting in issuance of unused static variable
warning now. // rdar://10777111

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161291 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Use a more robust check for null in CallAndMessageChecker.
Jordan Rose [Sat, 4 Aug 2012 01:04:52 +0000 (01:04 +0000)]
[analyzer] Use a more robust check for null in CallAndMessageChecker.

This should fix the failing test on the buildbot as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161290 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Don't assume values bound to references are automatically non-null.
Jordan Rose [Sat, 4 Aug 2012 00:25:30 +0000 (00:25 +0000)]
[analyzer] Don't assume values bound to references are automatically non-null.

While there is no such thing as a "null reference" in the C++ standard,
many implementations of references (including Clang's) do not actually
check that the location bound to them is non-null. Thus unlike a regular
null dereference, this will not cause a problem at runtime until the
reference is actually used. In order to catch these cases, we need to not
prune out paths on which the input pointer is null.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161288 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix the name of this variable.
Eric Christopher [Sat, 4 Aug 2012 00:11:22 +0000 (00:11 +0000)]
Fix the name of this variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161287 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate comment to accurately reflect what should happen.
Eric Christopher [Sat, 4 Aug 2012 00:11:20 +0000 (00:11 +0000)]
Update comment to accurately reflect what should happen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161286 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Update initializer assertion for delegating constructors.
Jordan Rose [Fri, 3 Aug 2012 23:31:15 +0000 (23:31 +0000)]
[analyzer] Update initializer assertion for delegating constructors.

Like base constructors, delegating constructors require no further
processing in the CFGInitializer node.

Also, add PrettyStackTraceLoc to the initializer and destructor logic
so we can get better stack traces in the future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161283 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] When a symbol is null, we should track its constraints.
Jordan Rose [Fri, 3 Aug 2012 23:09:01 +0000 (23:09 +0000)]
[analyzer] When a symbol is null, we should track its constraints.

Because of this, we would previously emit NO path notes when a parameter
is constrained to null (because there are no stores). Now we show where we
made the assumption, which is much more useful.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161280 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Flatten path diagnostics for text output like we do for HTML.
Jordan Rose [Fri, 3 Aug 2012 23:08:54 +0000 (23:08 +0000)]
[analyzer] Flatten path diagnostics for text output like we do for HTML.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161279 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Track null/uninitialized C++ objects used in method calls.
Jordan Rose [Fri, 3 Aug 2012 23:08:49 +0000 (23:08 +0000)]
[analyzer] Track null/uninitialized C++ objects used in method calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161278 91177308-0d34-0410-b5e6-96231b3b80d8