]> granicus.if.org Git - clang/log
clang
12 years ago[analyzer] Fix a false positive in the CFArrayCreate check that surfaces
Anna Zaks [Thu, 2 Feb 2012 01:30:08 +0000 (01:30 +0000)]
[analyzer] Fix a false positive in the CFArrayCreate check that surfaces
the the code like this (due to x and &x being the same value but
different size):

void* x[] = { ptr1, ptr2, ptr3 };
CFArrayCreate(NULL, (const void **) &x, count, NULL);

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

12 years agoconstexpr:
Richard Smith [Thu, 2 Feb 2012 01:16:57 +0000 (01:16 +0000)]
constexpr:
  * support the gcc __builtin_constant_p() ? ... : ... folding hack in C++11
  * check for unspecified values in pointer comparisons and pointer subtractions

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

12 years agoIntroduce a -cc1 option "-dependency-graphviz" that determines header
Douglas Gregor [Thu, 2 Feb 2012 00:54:52 +0000 (00:54 +0000)]
Introduce a -cc1 option "-dependency-graphviz" that determines header
dependencies and outputs them in GraphViz format.

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

12 years agoobjc: don't crash if primary class is missing and continuation class
Fariborz Jahanian [Thu, 2 Feb 2012 00:49:12 +0000 (00:49 +0000)]
objc: don't crash if primary class is missing and continuation class
is declaring ivars. // rdar://10752081

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

12 years agoChange the check for constant-conversion with width-1 bitfields so it doesn't suppres...
Eli Friedman [Thu, 2 Feb 2012 00:40:20 +0000 (00:40 +0000)]
Change the check for constant-conversion with width-1 bitfields so it doesn't suppress quite as many cases.  Based off a testcase in the gcc testsuite.

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

12 years agoback out r149504
Dylan Noblesmith [Thu, 2 Feb 2012 00:40:14 +0000 (00:40 +0000)]
back out r149504

Too many weird build failures.

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

12 years agoPer discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.
Ted Kremenek [Thu, 2 Feb 2012 00:16:13 +0000 (00:16 +0000)]
Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.

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

12 years agoobjc2: add __has_feature(objc_default_synthesize_properties).
Fariborz Jahanian [Thu, 2 Feb 2012 00:15:51 +0000 (00:15 +0000)]
objc2: add __has_feature(objc_default_synthesize_properties).
// rdar://10770497

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

12 years agor149474 went a bit too far when combined with type caching. If we want
Eric Christopher [Wed, 1 Feb 2012 23:39:00 +0000 (23:39 +0000)]
r149474 went a bit too far when combined with type caching. If we want
a full type go ahead and emit it if we currently only have a forward
declaration.

Fixes gdb bots for gdb1090.exp and call-ar-st.exp.

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

12 years agoReject mismatched "#pragma GCC visibility push" and "#pragma GCC visibility pop".
Rafael Espindola [Wed, 1 Feb 2012 23:24:59 +0000 (23:24 +0000)]
Reject mismatched "#pragma GCC visibility push" and "#pragma GCC visibility pop".

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

12 years agoLook for declaration of CFBridgingRetain/CFBridgingRetain before
Fariborz Jahanian [Wed, 1 Feb 2012 22:56:20 +0000 (22:56 +0000)]
Look for declaration of CFBridgingRetain/CFBridgingRetain before
changing the diagnostic. Also use correct spelling for both.

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

12 years agomake: fix installation of generated header files
Dylan Noblesmith [Wed, 1 Feb 2012 22:23:31 +0000 (22:23 +0000)]
make: fix installation of generated header files

The PROJ_SRC_DIR != PROJ_OBJ_DIR path was missing the directory
creation logic that was in the path for non-generated headers.
PR11903.

(The oversight was copied and pasted from LLVM's Makefile.rules,
where it apparently existed since time immemorial til it was
corrected in r127325.)

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

12 years agocmake: don't install config.h (v2)
Dylan Noblesmith [Wed, 1 Feb 2012 22:22:37 +0000 (22:22 +0000)]
cmake: don't install config.h (v2)

This header is private and shouldn't be used by clients.

(This reverts r149540, reinstating r149496. False alarm.)

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

12 years agoRemove duplicated comment.
Eric Christopher [Wed, 1 Feb 2012 21:48:10 +0000 (21:48 +0000)]
Remove duplicated comment.

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

12 years agoFix comment.
Eric Christopher [Wed, 1 Feb 2012 21:44:56 +0000 (21:44 +0000)]
Fix comment.

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

12 years agocmake: revert r149496
Dylan Noblesmith [Wed, 1 Feb 2012 21:17:55 +0000 (21:17 +0000)]
cmake: revert r149496

It *looks* like this caused PR11903, somehow.

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

12 years agoMake sure that imported definitions get completed before we add
Douglas Gregor [Wed, 1 Feb 2012 21:00:38 +0000 (21:00 +0000)]
Make sure that imported definitions get completed before we add
anything into the corresponding DeclContext. Co-hacked with Sean;
fixes <rdar://problem/10768928>.

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

12 years agolibclang: Mark clang_Cursor_isNull with CINDEX_LINKAGE to make it available on windows.
Benjamin Kramer [Wed, 1 Feb 2012 20:37:28 +0000 (20:37 +0000)]
libclang: Mark clang_Cursor_isNull with CINDEX_LINKAGE to make it available on windows.

Patch by Timothy J Fontaine!

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

12 years ago[libclang] Make sure we don't ever leave a StoredDiagnostic associated with
Argyrios Kyrtzidis [Wed, 1 Feb 2012 19:54:02 +0000 (19:54 +0000)]
[libclang] Make sure we don't ever leave a StoredDiagnostic associated with
a SourceManager that has already been deleted, rdar://10768346.

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

12 years agoAdd missing dependency to unbreak the CMake build
Douglas Gregor [Wed, 1 Feb 2012 19:53:01 +0000 (19:53 +0000)]
Add missing dependency to unbreak the CMake build

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

12 years agosize() == 0 -> empty().
David Chisnall [Wed, 1 Feb 2012 19:16:56 +0000 (19:16 +0000)]
size() == 0 -> empty().

Spotted by rjmcall.

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

12 years ago[analyzer] Fix a crash in CheckerContext::isCLibraryFunction for C++
Anna Zaks [Wed, 1 Feb 2012 19:16:20 +0000 (19:16 +0000)]
[analyzer] Fix a crash in CheckerContext::isCLibraryFunction for C++
declarations with special names.

A patch by Dmitri Gribenko.

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

12 years agoAdd a new compiler warning, which flags anti-patterns used as the size
Anna Zaks [Wed, 1 Feb 2012 19:08:57 +0000 (19:08 +0000)]
Add a new compiler warning, which flags anti-patterns used as the size
argument in strncat.

The warning is ignored by default since it needs more qualification.

TODO: The warning message and the note are messy when
strncat is a builtin due to the macro expansion.

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

12 years agoDiagnose the restriction on default arguments in C++11 [expr.prim.lambda]p5.
Douglas Gregor [Wed, 1 Feb 2012 17:18:19 +0000 (17:18 +0000)]
Diagnose the restriction on default arguments in C++11 [expr.prim.lambda]p5.

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

12 years agoIntroduce the lambda scope before determining explicit captures, which
Douglas Gregor [Wed, 1 Feb 2012 17:04:21 +0000 (17:04 +0000)]
Introduce the lambda scope before determining explicit captures, which
cleans up and improves a few things:
  - We get rid of the ugly dance of computing all of the captures in
  data structures that clone those of CapturingScopeInfo, centralizing
  the logic for accessing/updating these data structures
  - We re-use the existing capture logic for 'this', which actually
  works now.

Cleaned up some diagnostic wording in minor ways as well.

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

12 years ago[analyzer] Testing: add 2 new checkers to the buildbot script.
Anna Zaks [Wed, 1 Feb 2012 16:46:57 +0000 (16:46 +0000)]
[analyzer] Testing: add 2 new checkers to the buildbot script.

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

12 years agotest/Driver/target.c: Relax expression for "gcc.exe" on win32.
NAKAMURA Takumi [Wed, 1 Feb 2012 15:16:22 +0000 (15:16 +0000)]
test/Driver/target.c: Relax expression for "gcc.exe" on win32.

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

12 years agoinclude clang's config.h unconditionally
Dylan Noblesmith [Wed, 1 Feb 2012 14:25:28 +0000 (14:25 +0000)]
include clang's config.h unconditionally

And remove HAVE_CLANG_CONFIG_H, now that the header is generated
in the autoconf build, too. (clang r149497 / llvm r149498)

Also include the config.h header after all other headers, per
the LLVM coding standards.

It also turns out WindowsToolChain.cpp wasn't using the config
header at all, so that include's just deleted now.

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

12 years agotest/Modules/compiler_builtins.m: Appease Cygwin to add -D__need_wint_t.
NAKAMURA Takumi [Wed, 1 Feb 2012 14:09:19 +0000 (14:09 +0000)]
test/Modules/compiler_builtins.m: Appease Cygwin to add -D__need_wint_t.

On Cygwin, at first, <stddef.h> is included without __need_wint_t.
Next, <stddef.h> is included with __need_wint_t, though Modules feature would not process <stddef.h> twice.
Then, wint_t is not found in system headers.

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

12 years agotest/Modules/compiler_builtins.m: Mark this as XFAIL:win32. MS limits.h provides...
NAKAMURA Takumi [Wed, 1 Feb 2012 14:09:13 +0000 (14:09 +0000)]
test/Modules/compiler_builtins.m: Mark this as XFAIL:win32. MS limits.h provides size_t.

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

12 years agoautoconf: add private config.h to clang
Dylan Noblesmith [Wed, 1 Feb 2012 13:50:25 +0000 (13:50 +0000)]
autoconf: add private config.h to clang

This already exists in the CMake build, which is part of what makes
building clang separately from llvm via cmake possible. This cleans up
that discrepancy between the build systems (and sets the groundwork
for configuring clang separately, too).

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

12 years agocmake: don't install config.h
Dylan Noblesmith [Wed, 1 Feb 2012 13:50:22 +0000 (13:50 +0000)]
cmake: don't install config.h

This header is private and shouldn't be used by clients.

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

12 years agoFrontend: fix comment typos
Dylan Noblesmith [Wed, 1 Feb 2012 13:50:20 +0000 (13:50 +0000)]
Frontend: fix comment typos

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

12 years agoconstexpr: check for overflow in pointer subtraction.
Richard Smith [Wed, 1 Feb 2012 08:10:20 +0000 (08:10 +0000)]
constexpr: check for overflow in pointer subtraction.

This is a mess. According to the C++11 standard, pointer subtraction only has
undefined behavior if the difference of the array indices does not fit into a
ptrdiff_t.

However, common implementations effectively perform a char* subtraction first,
and then divide the result by the element size, which can cause overflows in
some cases. Those cases are not considered to be undefined behavior by this
change; perhaps they should be.

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

12 years agoCompatability fix for SwitchInst refactoring.
Stepan Dyatkovskiy [Wed, 1 Feb 2012 07:50:21 +0000 (07:50 +0000)]
Compatability fix for SwitchInst refactoring.

The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.

What was done:

1. Changed semantics of index inside the getCaseValue method:
getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.

Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.

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

12 years agoRevert r149363 which was part a series of commits that were reverted in llvm
Argyrios Kyrtzidis [Wed, 1 Feb 2012 06:36:49 +0000 (06:36 +0000)]
Revert r149363 which was part a series of commits that were reverted in llvm
commit 149470. This fixes test/CodeGen/PR3589-freestanding-libcalls.c.

Original log:

    ConstantArray::get() (for strings) is going away, use
    ConstantDataArray::getString instead.

    Many instances of ConstantArray::get() could be moved to
    use more efficient ConstantDataArray methods that avoid a ton
    of intermediate Constant*'s for each element (e.g.
    GetConstantArrayFromStringLiteral).  I don't plan on doing this
    in the short-term though.

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

12 years agoRemove redundant checks in CXXRecordDecl::isCLike(), as suggested by Sebastian.
Argyrios Kyrtzidis [Wed, 1 Feb 2012 06:36:44 +0000 (06:36 +0000)]
Remove redundant checks in CXXRecordDecl::isCLike(), as suggested by Sebastian.

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

12 years agoFor pass-by-value record arguments to functions emit a forward decl
Eric Christopher [Wed, 1 Feb 2012 06:07:23 +0000 (06:07 +0000)]
For pass-by-value record arguments to functions emit a forward decl
instead of the entire class definition.

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

12 years agoconstexpr: overflow checking for integral and floating-point arithmetic.
Richard Smith [Wed, 1 Feb 2012 05:53:12 +0000 (05:53 +0000)]
constexpr: overflow checking for integral and floating-point arithmetic.

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

12 years agoWhen providing code completions for a switch over a scoped enumeration
Douglas Gregor [Wed, 1 Feb 2012 05:02:47 +0000 (05:02 +0000)]
When providing code completions for a switch over a scoped enumeration
type, be sure to add the qualifier for the enumeration type.

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

12 years agoconstexpr: Unlike other incomplete types, 'void' cannot possibly be completed as
Richard Smith [Wed, 1 Feb 2012 04:40:02 +0000 (04:40 +0000)]
constexpr: Unlike other incomplete types, 'void' cannot possibly be completed as
a literal type. Disallow it as the return type of a constexpr function
declaration.

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

12 years agoconstexpr: require 'this' to point to an object in a constexpr method call.
Richard Smith [Wed, 1 Feb 2012 02:39:43 +0000 (02:39 +0000)]
constexpr: require 'this' to point to an object in a constexpr method call.

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

12 years agoconstexpr: add support for comparisons of pointer-to-members.
Richard Smith [Wed, 1 Feb 2012 01:42:44 +0000 (01:42 +0000)]
constexpr: add support for comparisons of pointer-to-members.

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

12 years agoImprove checking of explicit captures in a C++11 lambda expression:
Douglas Gregor [Wed, 1 Feb 2012 01:18:43 +0000 (01:18 +0000)]
Improve checking of explicit captures in a C++11 lambda expression:
  - Actually building the var -> capture mapping properly (there was an off-by-one error)
  - Keeping track of the source location of each capture
  - Minor QoI improvements, e.g, highlighing the prior capture if
  there are multiple captures, pointing at the variable declaration we
  found if we reject it.

As part of this, add standard citations for the various semantic
checks we perform, and note where we're not performing those checks as
we should.

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

12 years agoFix crash on invalid in microsoft anonymous struct extension.
Nico Weber [Wed, 1 Feb 2012 00:41:00 +0000 (00:41 +0000)]
Fix crash on invalid in microsoft anonymous struct extension.

Fixes PR11847. Patch from Jason Haslam!

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

12 years agoDiagnose attempts to explicitly capture a __block variable in a lambda.
Douglas Gregor [Wed, 1 Feb 2012 00:09:55 +0000 (00:09 +0000)]
Diagnose attempts to explicitly capture a __block variable in a lambda.

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

12 years agoUse the new Triple::getMacOSXVersion function in another place.
Bob Wilson [Tue, 31 Jan 2012 23:52:58 +0000 (23:52 +0000)]
Use the new Triple::getMacOSXVersion function in another place.

I removed support for "*-darwin*-iphoneos" triples, since we now have
iOS listed as a separate OS in the triples.

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

12 years agoFix an assertion failure in isMacOSXVersionLT for IOS targets.
Bob Wilson [Tue, 31 Jan 2012 23:52:54 +0000 (23:52 +0000)]
Fix an assertion failure in isMacOSXVersionLT for IOS targets.

Check if the triple OS is IOS instead of checking for arm/thumb architectures
and check that before calling isMacOSXVersionLT.

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

12 years agoMake the callback object to Sema::CorrectTypo mandatory.
Kaelyn Uhrain [Tue, 31 Jan 2012 23:49:25 +0000 (23:49 +0000)]
Make the callback object to Sema::CorrectTypo mandatory.

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

12 years agoExtend for-range temporary cleanups codegen test to catch the bug which Eli
Richard Smith [Tue, 31 Jan 2012 23:43:25 +0000 (23:43 +0000)]
Extend for-range temporary cleanups codegen test to catch the bug which Eli
fixed in r149440.

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

12 years agoobjc-arc: In various diagnostics mention
Fariborz Jahanian [Tue, 31 Jan 2012 23:42:37 +0000 (23:42 +0000)]
objc-arc: In various diagnostics mention
CFBridgingRetain/CFBridgingRelease calls instead
of __bridge_retained/__bridge_transfer casts as preferred
way of moving cf objects to arc land. // rdar://10207950

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

12 years agoconstexpr: Treat INT_MIN % -1 as undefined behavior in C++11. Technically, it
Richard Smith [Tue, 31 Jan 2012 23:24:19 +0000 (23:24 +0000)]
constexpr: Treat INT_MIN % -1 as undefined behavior in C++11. Technically, it
isn't, but this is just a (reported) defect in the wording.

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

12 years agoMake sure we call MaybeCreateExprWithCleanups for the sub-expression of an indirect...
Eli Friedman [Tue, 31 Jan 2012 22:47:07 +0000 (22:47 +0000)]
Make sure we call MaybeCreateExprWithCleanups for the sub-expression of an indirect goto.

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

12 years agoA couple minor fixes to template instantiation for for-range loops.
Eli Friedman [Tue, 31 Jan 2012 22:45:40 +0000 (22:45 +0000)]
A couple minor fixes to template instantiation for for-range loops.

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

12 years agoUse new Triple::getMacOSXVersion function.
Bob Wilson [Tue, 31 Jan 2012 22:43:59 +0000 (22:43 +0000)]
Use new Triple::getMacOSXVersion function.

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

12 years agoarc migrator: twik previous patch to exclude user provided
Fariborz Jahanian [Tue, 31 Jan 2012 22:09:44 +0000 (22:09 +0000)]
arc migrator: twik previous patch to exclude user provided
explicit type cast. // rdar://10521744

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

12 years agoarc migrator: Do not attempt to migrate to bridge casts which
Fariborz Jahanian [Tue, 31 Jan 2012 21:58:23 +0000 (21:58 +0000)]
arc migrator: Do not attempt to migrate to bridge casts which
cancel out each other. Leave it alone so users can take a look
(unmigrated code forces error diagnostic). // rdar://10521744

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

12 years agoSplit compiler builtin module into "stdlib" builtins and "intrinsic"
Douglas Gregor [Tue, 31 Jan 2012 21:57:50 +0000 (21:57 +0000)]
Split compiler builtin module into "stdlib" builtins and "intrinsic"
builds, and bring mm_alloc.h into the fold. Start playing some tricks
with these builtin modules to mirror the include_next tricks that the
headers already perform.

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

12 years agoRemove extraneous whitespace.
Chad Rosier [Tue, 31 Jan 2012 21:45:04 +0000 (21:45 +0000)]
Remove extraneous whitespace.

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

12 years agoFix more fallout from the introduction of "macosx" and "ios" triples.
Bob Wilson [Tue, 31 Jan 2012 21:30:03 +0000 (21:30 +0000)]
Fix more fallout from the introduction of "macosx" and "ios" triples.

The Darwin toolchain constructor was assuming that all Darwin triples would
have an OS string starting with "darwin".  Triples starting with "macosx"
would misinterpret the version number, and "ios" triples would completely
miss the version number (or worse) because the OS name is not 6 characters
long.  We lose some sanity checking of triple strings here, since the
Triple.getOSVersion function doesn't do all the checking that the previous
code did, but this still seems like a step in the right direction.

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

12 years ago[analyzer] Add checks for common anti-patterns in strncat.
Anna Zaks [Tue, 31 Jan 2012 19:33:39 +0000 (19:33 +0000)]
[analyzer] Add checks for common anti-patterns in strncat.
(Since this is syntax only, might be a good candidate for turning into a
compiler warning.)

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

12 years ago[analyzer] Change the warning to suggest 'strlcat/strlcpy' as
Anna Zaks [Tue, 31 Jan 2012 19:33:31 +0000 (19:33 +0000)]
[analyzer] Change the warning to suggest 'strlcat/strlcpy' as
replacements for 'starcat/strcpy' instead of 'strncat/strncpy'.

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

12 years agoFix 80-column violation.
Chad Rosier [Tue, 31 Jan 2012 19:31:12 +0000 (19:31 +0000)]
Fix 80-column violation.

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

12 years agoRevert r149359. This was a hack to a problem with an easy workaround, and it doesn...
Ted Kremenek [Tue, 31 Jan 2012 19:19:25 +0000 (19:19 +0000)]
Revert r149359.  This was a hack to a problem with an easy workaround, and it doesn't feel like general solution.

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

12 years agoPacify gcc's -Wreturn-type.
Matt Beaumont-Gay [Tue, 31 Jan 2012 18:59:25 +0000 (18:59 +0000)]
Pacify gcc's -Wreturn-type.

A separate unreachable message will make it easier to debug if either of the
unreachables is reached.

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

12 years agoSupport @compatibility_alias at run time (GNUstep Runtime)
David Chisnall [Tue, 31 Jan 2012 18:59:20 +0000 (18:59 +0000)]
Support @compatibility_alias at run time (GNUstep Runtime)

Patch by Niels Grewe!

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

12 years agofix a crash on:
Chris Lattner [Tue, 31 Jan 2012 18:53:44 +0000 (18:53 +0000)]
fix a crash on:

__has_builtin

in an empty file, as we were overwriting the EOF token.  Overwriting an arbitrary token
never seems like a good idea in the error case.  This fixes a bug reported on the GCC
list :)

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

12 years agoFormatCheckers should emit all diagnostics using EmitFormatDiagnostic().
Jean-Daniel Dupas [Tue, 31 Jan 2012 18:12:08 +0000 (18:12 +0000)]
FormatCheckers should emit all diagnostics using EmitFormatDiagnostic().

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

12 years agoFormat string warnings: don't a.k.a. wchar_t with wchar_t.
Hans Wennborg [Tue, 31 Jan 2012 14:59:59 +0000 (14:59 +0000)]
Format string warnings: don't a.k.a. wchar_t with wchar_t.

This fixes the case where Clang would output:
 error: format specifies type 'wchar_t *' (aka 'wchar_t *')

ArgTypeResult::getRepresentativeTypeName needs to take into account
that wchar_t can be a built-in type (as opposed to in C, where it is a
typedef).

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

12 years ago[CFG] Removed unused local variable.
Erik Verbruggen [Tue, 31 Jan 2012 13:44:00 +0000 (13:44 +0000)]
[CFG] Removed unused local variable.

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

12 years agoDon't zero terminate the bitmap twice.
Benjamin Kramer [Tue, 31 Jan 2012 10:30:46 +0000 (10:30 +0000)]
Don't zero terminate the bitmap twice.

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

12 years agoconstexpr: the result of a relational operator between pointers to void is
Richard Smith [Tue, 31 Jan 2012 06:41:30 +0000 (06:41 +0000)]
constexpr: the result of a relational operator between pointers to void is
unspecified unless the pointers are equal; therefore, such a comparison is not
a constant expression unless the pointers are equal.

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

12 years agoConstantArray::get() (for strings) is going away, use
Chris Lattner [Tue, 31 Jan 2012 06:13:55 +0000 (06:13 +0000)]
ConstantArray::get() (for strings) is going away, use
ConstantDataArray::getString instead.

Many instances of ConstantArray::get() could be moved to
use more efficient ConstantDataArray methods that avoid a ton
of intermediate Constant*'s for each element (e.g.
GetConstantArrayFromStringLiteral).  I don't plan on doing this
in the short-term though.

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

12 years agoDon't warn about -Wshorten-64-to-32 in unreachable code. Fixes <rdar://problem/10759...
Ted Kremenek [Tue, 31 Jan 2012 05:37:48 +0000 (05:37 +0000)]
Don't warn about -Wshorten-64-to-32 in unreachable code.  Fixes <rdar://problem/10759934>.  Apparently this is a common idiom in Linux (among other places).

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

12 years agoMake a bunch of local functions 'static'.
Ted Kremenek [Tue, 31 Jan 2012 05:37:37 +0000 (05:37 +0000)]
Make a bunch of local functions 'static'.

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

12 years agoenhance some optimization logic to handle ConstantDataSequential
Chris Lattner [Tue, 31 Jan 2012 04:36:19 +0000 (04:36 +0000)]
enhance some optimization logic to handle ConstantDataSequential
as well as ConstantArray.

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

12 years agoconstexpr: catch a collection of integral undefined behaviors:
Richard Smith [Tue, 31 Jan 2012 04:08:20 +0000 (04:08 +0000)]
constexpr: catch a collection of integral undefined behaviors:
  -INT_MIN and INT_MIN / -1
  Shift by a negative or too large quantity
  Left shift of negative value
  Overflow in left shift

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

12 years agoReapply r149311 which I reverted by mistake.
Argyrios Kyrtzidis [Tue, 31 Jan 2012 02:23:28 +0000 (02:23 +0000)]
Reapply r149311 which I reverted by mistake.

 Original log:

 Convert ProgramStateRef to a smart pointer for managing the reference counts of ProgramStates.  This leads to a slight memory
 improvement, and a simplification of the logic for managing ProgramState objects.
 # Please enter the commit message for your changes. Lines starting

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

12 years agoRevert r149083 which is not the direction we're going in the Clang
Chandler Carruth [Tue, 31 Jan 2012 02:21:20 +0000 (02:21 +0000)]
Revert r149083 which is not the direction we're going in the Clang
driver based on discussions with Doug Gregor. There are several issues:
1) The patch was not reviewed prior to commit and there were review comments.
2) The design of the functionality (triple-prefixed tool invocation)
   isn't the design we want for Clang going forward: it focuses on the
   "user triple" rather than on the "toolchain triple", and forces that
   bit of state into the API of every single toolchain instead of
   handling it automatically in the common base classes.
3) The tests provided are not stable. They fail on a few Linux variants
   (Gentoo among them) and on mingw32 and some other environments.

I *am* interested in the Clang driver being able to invoke
triple-prefixed tools, but we need to design that feature the right way.
This patch just extends the previous hack without fixing the underlying
problems with it. I'm working on a new design for this that I will mail
for review by tomorrow.

I am aware that this removes functionality that NetBSD relies on, but
this is ToT, not a release. This functionality hasn't been properly
designed, implemented, and tested yet. We can't "regress" until we get
something that really works, both with the immediate use cases and with
long term maintenance of the Clang driver.

For reference, the original commit log:
Keep track of the original target the user specified before
normalization. This used to be captured in DefaultTargetTriple and is
used for the (optional) $triple-$tool lookup for cross-compilation.
Do this properly by making it an attribute of the toolchain and use it
in combination with the computed triple as index for the toolchain
lookup.

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

12 years agoRevert r149311 which failed to compile.
Argyrios Kyrtzidis [Tue, 31 Jan 2012 02:14:24 +0000 (02:14 +0000)]
Revert r149311 which failed to compile.

Original log:

Convert ProgramStateRef to a smart pointer for managing the reference counts of ProgramStates.  This leads to a slight memory
improvement, and a simplification of the logic for managing ProgramState objects.

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

12 years agoFix "long double" and __SIZE_TYPE__ on powerpc, now with test fix.
Nico Weber [Tue, 31 Jan 2012 02:07:33 +0000 (02:07 +0000)]
Fix "long double" and __SIZE_TYPE__ on powerpc, now with test fix.

Fixes PR11867. Patch from Jeremy Huddleston!

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

12 years agoconstexpr: remove integral conversion overflow checking introduced in r149286.
Richard Smith [Tue, 31 Jan 2012 01:47:46 +0000 (01:47 +0000)]
constexpr: remove integral conversion overflow checking introduced in r149286.
As Eli points out, this is implementation-defined, and the way we define it
makes this fine.

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

12 years agoLet %S, %ls, %C match 16bit types in NSStrings.
Nico Weber [Tue, 31 Jan 2012 01:43:25 +0000 (01:43 +0000)]
Let %S, %ls, %C match 16bit types in NSStrings.

As discussed at http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120130/052200.html

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

12 years agoClean up switch in Expr::CanThrow. No functional change.
Eli Friedman [Tue, 31 Jan 2012 01:21:45 +0000 (01:21 +0000)]
Clean up switch in Expr::CanThrow.  No functional change.

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

12 years agoMinor refactor within ExplodedGraph::reclaimRecentlyAllocatedNodes(). No functionali...
Ted Kremenek [Tue, 31 Jan 2012 01:20:02 +0000 (01:20 +0000)]
Minor refactor within ExplodedGraph::reclaimRecentlyAllocatedNodes().  No functionality change.

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

12 years agoConvert checker over to using ProgramStateRef.
Ted Kremenek [Tue, 31 Jan 2012 01:19:57 +0000 (01:19 +0000)]
Convert checker over to using ProgramStateRef.

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

12 years agofix test.
Fariborz Jahanian [Tue, 31 Jan 2012 01:05:11 +0000 (01:05 +0000)]
fix test.

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

12 years agoConvert ProgramStateRef to a smart pointer for managing the reference counts of Progr...
Ted Kremenek [Tue, 31 Jan 2012 00:57:20 +0000 (00:57 +0000)]
Convert ProgramStateRef to a smart pointer for managing the reference counts of ProgramStates.  This leads to a slight memory
improvement, and a simplification of the logic for managing ProgramState objects.

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

12 years agoConvert more uses of 'const ProgramState *' to 'ProgramStateRef' (and related cleanups).
Ted Kremenek [Tue, 31 Jan 2012 00:57:15 +0000 (00:57 +0000)]
Convert more uses of 'const ProgramState *' to 'ProgramStateRef' (and related cleanups).

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

12 years agoRevert r149285, it breaks test/Preprocessor/init.c.
Nico Weber [Mon, 30 Jan 2012 23:53:44 +0000 (23:53 +0000)]
Revert r149285, it breaks test/Preprocessor/init.c.

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

12 years agotest for a v-table dispatch that consumes an
Fariborz Jahanian [Mon, 30 Jan 2012 23:39:30 +0000 (23:39 +0000)]
test for a v-table dispatch that consumes an
argument. twik to support the test case.
// rdar://10444476

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

12 years agoconstexpr: disallow signed integer overflow in integral conversions in constant
Richard Smith [Mon, 30 Jan 2012 22:27:01 +0000 (22:27 +0000)]
constexpr: disallow signed integer overflow in integral conversions in constant
expressions in C++11.

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

12 years agoFix "long double" and __SIZE_TYPE__ on powerpc.
Nico Weber [Mon, 30 Jan 2012 22:25:29 +0000 (22:25 +0000)]
Fix "long double" and __SIZE_TYPE__ on powerpc.

Fixes PR11867. Patch from Jeremy Huddleston!

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

12 years agoRemove tgmath.h from the module map for now, because it currently causes a
Douglas Gregor [Mon, 30 Jan 2012 22:22:39 +0000 (22:22 +0000)]
Remove tgmath.h from the module map for now, because it currently causes a
cyclic module dependency due to its inclusion of math.h and
complex.h. I'll take another shot at it later.

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

12 years agoobjc-arc: Perform null check on receiver before sending methods which
Fariborz Jahanian [Mon, 30 Jan 2012 21:40:37 +0000 (21:40 +0000)]
objc-arc: Perform null check on receiver before sending methods which
consume one or more of their arguments. If not done, this will cause a leak
as method will not consume the argument when receiver is null.
In this patch, the null path releases consumed argument.
// rdar://10444474

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

12 years ago[analyzer] Rename the checker as per Ted's comment. Remove the reference
Anna Zaks [Mon, 30 Jan 2012 21:14:16 +0000 (21:14 +0000)]
[analyzer] Rename the checker as per Ted's comment. Remove the reference
from the driver.

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

12 years agoDisable "non literal format string" for NSString that result from a macro expansion.
Jean-Daniel Dupas [Mon, 30 Jan 2012 19:46:17 +0000 (19:46 +0000)]
Disable "non literal format string" for NSString that result from a macro expansion.
This is to prevent diagnostic when using NSLocalizedString or CFCopyLocalizedString
macros which are usually used in place of NS and CF strings literals.

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

12 years ago[analyzer] Make osx.cocos.CFContainersSyntax a default checker.
Anna Zaks [Mon, 30 Jan 2012 19:12:37 +0000 (19:12 +0000)]
[analyzer] Make osx.cocos.CFContainersSyntax a default checker.

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

12 years agoFix typo spotted by Sebastian. Thanks!
Douglas Gregor [Mon, 30 Jan 2012 18:49:05 +0000 (18:49 +0000)]
Fix typo spotted by Sebastian. Thanks!

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

12 years agoPer discussion on cxx-abi-dev, don't drop leading zeroes from the
John McCall [Mon, 30 Jan 2012 18:36:31 +0000 (18:36 +0000)]
Per discussion on cxx-abi-dev, don't drop leading zeroes from the
mangling of floating-point literals.  I just went ahead and
reimplemented toString() here;  if someone wants to generalize
the library routine to do this, or feels strongly that we should
be post-processing, please feel free.

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