]> granicus.if.org Git - clang/log
clang
13 years agoAdd a -fcxx-exceptions flag to the frontend, which can be used to enable
Anders Carlsson [Mon, 28 Feb 2011 02:27:16 +0000 (02:27 +0000)]
Add a -fcxx-exceptions flag to the frontend, which can be used to enable
C++ exceptions, even when exceptions have been turned off using -fno-exceptions.
Make the -fobjc-exceptions flag do the same thing, but for Objective-C exceptions.

C++ and Objective-C exceptions can also be disabled using -fno-cxx-excptions and
-fno-objc-exceptions.

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

13 years agoFix CMake build.
Anders Carlsson [Mon, 28 Feb 2011 02:13:22 +0000 (02:13 +0000)]
Fix CMake build.

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

13 years agoRetry r126357. Use CharUnits for the Size and DataSize calculations when
Ken Dyck [Mon, 28 Feb 2011 02:01:38 +0000 (02:01 +0000)]
Retry r126357. Use CharUnits for the Size and DataSize calculations when
they are known to be exact multiples of the width of the char type. Add a
test case to CodeGen/union.c that would have caught the problem with the
previous attempt. No change in functionality intended.

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

13 years ago[analyzer] Introduce SVal::getAsVarDecl().
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:28:18 +0000 (01:28 +0000)]
[analyzer] Introduce SVal::getAsVarDecl().

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

13 years ago[analzyer] Migrate CallAndMessageChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:28:13 +0000 (01:28 +0000)]
[analzyer] Migrate CallAndMessageChecker to CheckerV2.

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

13 years ago[analyzer] ExprEngine should not depend on checkers for not crashing.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:28:08 +0000 (01:28 +0000)]
[analyzer] ExprEngine should not depend on checkers for not crashing.

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

13 years ago[analyzer] Migrate AdjustedReturnValueChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:28:05 +0000 (01:28 +0000)]
[analyzer] Migrate AdjustedReturnValueChecker to CheckerV2.

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

13 years ago[analyzer] Migrate AttrNonNullChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:28:01 +0000 (01:28 +0000)]
[analyzer] Migrate AttrNonNullChecker to CheckerV2.

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

13 years ago[analyzer] ExprEngine should not depend on checkers for not crashing.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:57 +0000 (01:27 +0000)]
[analyzer] ExprEngine should not depend on checkers for not crashing.

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

13 years ago[analyzer] Migrate VLASizeChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:54 +0000 (01:27 +0000)]
[analyzer] Migrate VLASizeChecker to CheckerV2.

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

13 years ago[analyzer] Migrate DivZeroChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:50 +0000 (01:27 +0000)]
[analyzer] Migrate DivZeroChecker to CheckerV2.

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

13 years ago[analyzer] Migrate ReturnUndefChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:46 +0000 (01:27 +0000)]
[analyzer] Migrate ReturnUndefChecker to CheckerV2.

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

13 years ago[analyzer] Migrate UndefinedArraySubscriptChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:41 +0000 (01:27 +0000)]
[analyzer] Migrate UndefinedArraySubscriptChecker to CheckerV2.

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

13 years ago[analyzer] Migrate UndefinedAssignmentChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:37 +0000 (01:27 +0000)]
[analyzer] Migrate UndefinedAssignmentChecker to CheckerV2.

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

13 years ago[analyzer] Migrate UndefBranchChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:33 +0000 (01:27 +0000)]
[analyzer] Migrate UndefBranchChecker to CheckerV2.

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

13 years ago[analyzer] Migrate UndefCapturedBlockVarChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:26 +0000 (01:27 +0000)]
[analyzer] Migrate UndefCapturedBlockVarChecker to CheckerV2.

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

13 years ago[analyzer] Migrate UndefResultChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:22 +0000 (01:27 +0000)]
[analyzer] Migrate UndefResultChecker to CheckerV2.

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

13 years ago[analyzer] Migrate NoReturnFunctionChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:17 +0000 (01:27 +0000)]
[analyzer] Migrate NoReturnFunctionChecker to CheckerV2.

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

13 years ago[analyzer] Move the DeadStores checker out of the 'core' package.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:12 +0000 (01:27 +0000)]
[analyzer] Move the DeadStores checker out of the 'core' package.

-Now it gets enabled with '-analyzer-checker=DeadStores'.
-The driver passes the above flag by default.

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

13 years ago[analyzer] Migrate BuiltinFunctionChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:07 +0000 (01:27 +0000)]
[analyzer] Migrate BuiltinFunctionChecker to CheckerV2.

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

13 years ago[analyzer] Migrate OSAtomicChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:02 +0000 (01:27 +0000)]
[analyzer] Migrate OSAtomicChecker to CheckerV2.

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

13 years ago[analyzer] Migrate ArrayBoundCheckerV2 to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:26:57 +0000 (01:26 +0000)]
[analyzer] Migrate ArrayBoundCheckerV2 to CheckerV2.

Turns -analyzer-check-buffer-overflows into -analyzer-checker=core.experimental.Overflow

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

13 years ago[analyzer] Turn -analyzer-stats into -analyzer-checker=debug.Stats
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:26:50 +0000 (01:26 +0000)]
[analyzer] Turn -analyzer-stats into -analyzer-checker=debug.Stats

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

13 years ago[analyzer] Remove '-analyzer-experimental-checks' flag.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:26:43 +0000 (01:26 +0000)]
[analyzer] Remove '-analyzer-experimental-checks' flag.

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

13 years ago[analyzer] Migrate MallocChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:26:35 +0000 (01:26 +0000)]
[analyzer] Migrate MallocChecker to CheckerV2.

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

13 years ago[analyzer] Have CheckerManager::registerChecker return a pointer to the checker objec...
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:26:28 +0000 (01:26 +0000)]
[analyzer] Have CheckerManager::registerChecker return a pointer to the checker object and
only allow a checker to be registered once.

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

13 years agoremove a bogus assertion, add a comment.
Chris Lattner [Mon, 28 Feb 2011 01:06:02 +0000 (01:06 +0000)]
remove a bogus assertion, add a comment.

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

13 years agomake switch condition constant folding much more aggressive, handling
Chris Lattner [Mon, 28 Feb 2011 01:02:29 +0000 (01:02 +0000)]
make switch condition constant folding much more aggressive, handling
compound statements and break statements.  This implements enough to
handle PR9322 and rdar://6970405.

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

13 years agoFactor code out into a helper function, shouldUseExceptionTablesForObjCExceptions.
Anders Carlsson [Mon, 28 Feb 2011 00:44:51 +0000 (00:44 +0000)]
Factor code out into a helper function, shouldUseExceptionTablesForObjCExceptions.

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

13 years agofix my containsBreak predicate.
Chris Lattner [Mon, 28 Feb 2011 00:42:31 +0000 (00:42 +0000)]
fix my containsBreak predicate.

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

13 years agoAdd -fcxx-exceptions to all tests that use C++ exceptions.
Anders Carlsson [Mon, 28 Feb 2011 00:40:07 +0000 (00:40 +0000)]
Add -fcxx-exceptions to all tests that use C++ exceptions.

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

13 years agoGet rid of the areExceptionsEnabled() getter from LangOptions.
Anders Carlsson [Mon, 28 Feb 2011 00:33:03 +0000 (00:33 +0000)]
Get rid of the areExceptionsEnabled() getter from LangOptions.

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

13 years agoFirst tiny step to implementing PR9322: build infrastructure for only emitting the
Chris Lattner [Mon, 28 Feb 2011 00:22:07 +0000 (00:22 +0000)]
First tiny step to implementing PR9322: build infrastructure for only emitting the
live case of a switch statement when switching on a constant.  This is terribly
limited, but enough to handle the trivial example included.  Before we would
emit:

define void @test1(i32 %i) nounwind {
entry:
  %i.addr = alloca i32, align 4
  store i32 %i, i32* %i.addr, align 4
  switch i32 1, label %sw.epilog [
    i32 1, label %sw.bb
  ]

sw.bb:                                            ; preds = %entry
  %tmp = load i32* %i.addr, align 4
  %inc = add nsw i32 %tmp, 1
  store i32 %inc, i32* %i.addr, align 4
  br label %sw.epilog

sw.epilog:                                        ; preds = %sw.bb, %entry
  switch i32 0, label %sw.epilog3 [
    i32 1, label %sw.bb1
  ]

sw.bb1:                                           ; preds = %sw.epilog
  %tmp2 = load i32* %i.addr, align 4
  %add = add nsw i32 %tmp2, 2
  store i32 %add, i32* %i.addr, align 4
  br label %sw.epilog3

sw.epilog3:                                       ; preds = %sw.bb1, %sw.epilog
  ret void
}

now we emit:

define void @test1(i32 %i) nounwind {
entry:
  %i.addr = alloca i32, align 4
  store i32 %i, i32* %i.addr, align 4
  %tmp = load i32* %i.addr, align 4
  %inc = add nsw i32 %tmp, 1
  store i32 %inc, i32* %i.addr, align 4
  ret void
}

This improves -O0 compile time (less IR to generate and shove through the code
generator) and the clever linux kernel people found a way to fail to build if we
don't do this optimization.  This step isn't enough to handle the kernel case
though.

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

13 years agoAdd some helper methods that will be used in my next patch.
Chris Lattner [Mon, 28 Feb 2011 00:18:40 +0000 (00:18 +0000)]
Add some helper methods that will be used in my next patch.

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

13 years agotidy up
Chris Lattner [Mon, 28 Feb 2011 00:18:06 +0000 (00:18 +0000)]
tidy up

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

13 years agoadd a const version of this accessor.
Chris Lattner [Mon, 28 Feb 2011 00:17:41 +0000 (00:17 +0000)]
add a const version of this accessor.

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

13 years agoWhen we encounter a dependent template name within a
Douglas Gregor [Mon, 28 Feb 2011 00:04:36 +0000 (00:04 +0000)]
When we encounter a dependent template name within a
nested-name-specifier, e.g.,

  T::template apply<U>::

represent the dependent template name specialization as a
DependentTemplateSpecializationType, rather than a
TemplateSpecializationType with a dependent TemplateName.

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

13 years agoChange the interface to ConstantFoldsToSimpleInteger to not encode
Chris Lattner [Sun, 27 Feb 2011 23:02:32 +0000 (23:02 +0000)]
Change the interface to ConstantFoldsToSimpleInteger to not encode
a bool + success into one tri-state integer, simplifying things.

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

13 years agoEliminate a silly little Parse/Sema dance when parsing typename
Douglas Gregor [Sun, 27 Feb 2011 22:46:49 +0000 (22:46 +0000)]
Eliminate a silly little Parse/Sema dance when parsing typename
specifiers such as

  typename T::template apply<U>

Previously, we would turn T::template apply<U> into a
TemplateSpecializationType. Then, we'd reprocess that
TemplateSpecializationType and turn it into either a
TemplateSpecializationType wrapped in an ElaboratedType (when we could
resolve "apply" to a template declaration) or a
DependentTemplateSpecializationType. We now produce the same ASTs but
without generating the intermediate TemplateSpecializationType.

The end goal here is to avoid generating TemplateSpecializationTypes
with dependent template-names, ever. We're not there yet.

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

13 years agoFix an obvious typo.
Benjamin Kramer [Sun, 27 Feb 2011 18:07:41 +0000 (18:07 +0000)]
Fix an obvious typo.

GCC -Waddress warns about this but clang doesn't (PR9043).

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

13 years agoCMake: updated list of installable header files. PR9321.
Oscar Fuentes [Sun, 27 Feb 2011 13:33:31 +0000 (13:33 +0000)]
CMake: updated list of installable header files. PR9321.

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

13 years agoFix this test case for CMake builds after r126502, which sneakily changed the actual...
Frits van Bommel [Sun, 27 Feb 2011 01:17:12 +0000 (01:17 +0000)]
Fix this test case for CMake builds after r126502, which sneakily  changed the actual executable name to clang-<version>.

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

13 years agocc1: Fix stats printing by default when using -mllvm -stats.
Daniel Dunbar [Sat, 26 Feb 2011 23:17:25 +0000 (23:17 +0000)]
cc1: Fix stats printing by default when using -mllvm -stats.

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

13 years agoImplement delegating constructors partially.
Sean Hunt [Sat, 26 Feb 2011 19:13:13 +0000 (19:13 +0000)]
Implement delegating constructors partially.

This successfully performs constructor lookup and verifies that a
delegating initializer is the only initializer present.

This does not perform loop detection in the initialization, but it also
doesn't codegen delegating constructors at all, so this won't cause
runtime infinite loops yet.

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

13 years agoDon't assume that whoever is asking for a message send is going
John McCall [Sat, 26 Feb 2011 09:48:59 +0000 (09:48 +0000)]
Don't assume that whoever is asking for a message send is going
to give us a non-null return slot.

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

13 years agoZero-initialize the struct-return slot of an Objective-C message
John McCall [Sat, 26 Feb 2011 09:12:15 +0000 (09:12 +0000)]
Zero-initialize the struct-return slot of an Objective-C message
send before making the call.  Fixes rdar://problem/7854674

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

13 years agoA much-delayed response to Ken Dyck's review: make this somewhat more
John McCall [Sat, 26 Feb 2011 08:41:59 +0000 (08:41 +0000)]
A much-delayed response to Ken Dyck's review:  make this somewhat more
char-width agnostic.

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

13 years agoDon't crash during constant-evaluation of 1/(1/0). PR9262.
John McCall [Sat, 26 Feb 2011 08:27:17 +0000 (08:27 +0000)]
Don't crash during constant-evaluation of 1/(1/0).  PR9262.

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

13 years agoPretty up the emission of field l-values and use volatile and TBAA when
John McCall [Sat, 26 Feb 2011 08:07:02 +0000 (08:07 +0000)]
Pretty up the emission of field l-values and use volatile and TBAA when
loading references as part of that.  Use 'char' TBAA when accessing
(immediate!) fields of a may_alias struct;  fixes PR9307.

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

13 years agoProvide a bit saying that a builtin undergoes custom type-checking, then
John McCall [Sat, 26 Feb 2011 05:39:39 +0000 (05:39 +0000)]
Provide a bit saying that a builtin undergoes custom type-checking, then
don't let calls to such functions go down the normal type-checking path.
Test this out with __builtin_classify_type and __builtin_constant_p.

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

13 years agoFix objc rewriting bug casting to qualified objective-c pointetr.
Fariborz Jahanian [Sat, 26 Feb 2011 01:31:36 +0000 (01:31 +0000)]
Fix objc rewriting bug casting to qualified objective-c pointetr.
// rdar://9056351

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

13 years agoFix a rewriter bug involving call to property's
Fariborz Jahanian [Sat, 26 Feb 2011 00:33:41 +0000 (00:33 +0000)]
Fix a rewriter bug involving call to property's
block. // rdar://9055596

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

13 years agoASTStmtReader is already a friend of DependentScopeDeclRefExpr, and GCC
Matt Beaumont-Gay [Fri, 25 Feb 2011 22:36:42 +0000 (22:36 +0000)]
ASTStmtReader is already a friend of DependentScopeDeclRefExpr, and GCC
doesn't like re-friending.

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

13 years agoUpdate test cases.
Ted Kremenek [Fri, 25 Feb 2011 22:19:14 +0000 (22:19 +0000)]
Update test cases.

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

13 years agoTidy up help text in Checkers.td, and rename StackAddrLeakChecker to StackAddrEscapeC...
Ted Kremenek [Fri, 25 Feb 2011 22:00:43 +0000 (22:00 +0000)]
Tidy up help text in Checkers.td, and rename StackAddrLeakChecker to StackAddrEscapeChecker.

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

13 years agoEnhance scan-build to print out available analyses using new checker registration...
Ted Kremenek [Fri, 25 Feb 2011 22:00:40 +0000 (22:00 +0000)]
Enhance scan-build to print out available analyses using new checker registration model.

This isn't totally complete.  Right now scan-build uses some heuristics to determine
which checkers are enabled by default, but it cannot always tell which checkers
are not enabled.

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

13 years agoDriver: Attmpt to fix some possibly UB that MSVC doesn't care for.
Daniel Dunbar [Fri, 25 Feb 2011 21:20:15 +0000 (21:20 +0000)]
Driver: Attmpt to fix some possibly UB that MSVC doesn't care for.

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

13 years agoSprinkle optional text of the "unavailable' attribute
Fariborz Jahanian [Fri, 25 Feb 2011 20:51:14 +0000 (20:51 +0000)]
Sprinkle optional text of the "unavailable' attribute
where ever such attribute causes an error diagnostic.

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

13 years agoPush nested-name-specifier source location information into
Douglas Gregor [Fri, 25 Feb 2011 20:49:16 +0000 (20:49 +0000)]
Push nested-name-specifier source location information into
DependentScopeDeclRefExpr. Plus, give NestedNameSpecifierLoc == and !=
operators, since we're going to need 'em elsewhere.

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

13 years agoClean up some gross code in the printer here. No more string stream
Chandler Carruth [Fri, 25 Feb 2011 20:09:13 +0000 (20:09 +0000)]
Clean up some gross code in the printer here. No more string stream
silliness, and actually use the existing facilities of raw_ostream to do
escaping.

This will also hopefully fix an assert when building with signed char
(MSVC I think).

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

13 years agoRemove the FIXME I introduced last night, and pull the logic for
Chandler Carruth [Fri, 25 Feb 2011 19:41:05 +0000 (19:41 +0000)]
Remove the FIXME I introduced last night, and pull the logic for
marking selected overloads into the callers. This allows a few callers
to skip it altogether (they would have anyways because they weren't
interested in successful overloads) or defer until after further checks
take place much like the check required for PR9323 to avoid marking
unused copy constructors.

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

13 years agoCMake: add version information into the clang executable and libclang
Douglas Gregor [Fri, 25 Feb 2011 19:24:02 +0000 (19:24 +0000)]
CMake: add version information into the clang executable and libclang
shared library.

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

13 years agos/clang-cc1/clang_cc1
Matt Beaumont-Gay [Fri, 25 Feb 2011 19:09:01 +0000 (19:09 +0000)]
s/clang-cc1/clang_cc1

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

13 years agoPrint optional message for attr(unavailable) in C++ mode.
Fariborz Jahanian [Fri, 25 Feb 2011 18:38:59 +0000 (18:38 +0000)]
Print optional message for attr(unavailable) in C++ mode.
// rdar://9046492

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

13 years agoPush nested-name-specifier source-location information into
Douglas Gregor [Fri, 25 Feb 2011 18:19:59 +0000 (18:19 +0000)]
Push nested-name-specifier source-location information into
pseudo-destructor expressions. Also, clean up some
template-instantiation and type-checking issues with
pseudo-destructors.

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

13 years agoTeach objc-rewriter to pass -fobjc-exceptions along.
Fariborz Jahanian [Fri, 25 Feb 2011 17:24:55 +0000 (17:24 +0000)]
Teach objc-rewriter to pass -fobjc-exceptions along.

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

13 years agoPush nested-name-specifier source location information into namespace
Douglas Gregor [Fri, 25 Feb 2011 17:08:07 +0000 (17:08 +0000)]
Push nested-name-specifier source location information into namespace
aliases.

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

13 years agoMake sure to give CXXScopeSpec::SetInvalid() a valid source
Douglas Gregor [Fri, 25 Feb 2011 16:51:05 +0000 (16:51 +0000)]
Make sure to give CXXScopeSpec::SetInvalid() a valid source
range. Fixes four new failures in the GCC testsuite.

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

13 years agoPush nested-name-specifier source location information into using directives.
Douglas Gregor [Fri, 25 Feb 2011 16:33:46 +0000 (16:33 +0000)]
Push nested-name-specifier source location information into using directives.

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

13 years agoDirect testing of source-location information on using declarations, via libclang
Douglas Gregor [Fri, 25 Feb 2011 16:13:46 +0000 (16:13 +0000)]
Direct testing of source-location information on using declarations, via libclang

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

13 years agoSwitch a few CXXScopeSpec::MakeTrivial() calls over to appropriate
Douglas Gregor [Fri, 25 Feb 2011 16:07:42 +0000 (16:07 +0000)]
Switch a few CXXScopeSpec::MakeTrivial() calls over to appropriate
NestedNameSpecifierLoc handling.

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

13 years agoMaintain nested-name-specifier source-location information through
Douglas Gregor [Fri, 25 Feb 2011 15:54:31 +0000 (15:54 +0000)]
Maintain nested-name-specifier source-location information through
instantiation of using declarations (all three forms).

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

13 years agoRename test/Sema/expr-comma-c89.c to expr-comma-c99.c. Spotted by
Peter Collingbourne [Fri, 25 Feb 2011 12:37:11 +0000 (12:37 +0000)]
Rename test/Sema/expr-comma-c89.c to expr-comma-c99.c.  Spotted by
Anton Lokhmotov.

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

13 years agoRough fix for PR9323 that prevents Clang from marking copy constructor
Chandler Carruth [Fri, 25 Feb 2011 08:52:25 +0000 (08:52 +0000)]
Rough fix for PR9323 that prevents Clang from marking copy constructor
declarations as referenced when in fact we're not going to even form
a call in the AST. This is significant because we attempt to allow as an
extension classes with intentionally private and undefined copy
constructors to have temporaries bound to references, and so shouldn't
warn about the lack of definition for that copy constructor when the
class is internal.

Doug, John wasn't really satisfied with the presence of overloading at
all. This is a stop-gap and there may be a better solution. If you can
give me some hints for how you'd prefer to see this solved, I'll happily
switch things over.

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

13 years agoGive this warning a flag that can be used to turn it off in old, crufty,
Chandler Carruth [Fri, 25 Feb 2011 06:53:20 +0000 (06:53 +0000)]
Give this warning a flag that can be used to turn it off in old, crufty,
legacy code that contains dead code paths referring to such
declarations.

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

13 years agoAdd support for ArchLinux, patch by Kevin Winchester.
Chandler Carruth [Fri, 25 Feb 2011 06:39:53 +0000 (06:39 +0000)]
Add support for ArchLinux, patch by Kevin Winchester.

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

13 years agoFormatting, etc.
John McCall [Fri, 25 Feb 2011 05:21:17 +0000 (05:21 +0000)]
Formatting, etc.

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

13 years agoTame an assert; the scope depth of a jump destination does not
John McCall [Fri, 25 Feb 2011 04:19:13 +0000 (04:19 +0000)]
Tame an assert;  the scope depth of a jump destination does not
necessarily enclose the innermost normal cleanup depth, because
the top of the jump scope stack might be an EH cleanup or EH scope.
Fixes PR9303.

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

13 years agoUse NestedNameSpecifierLoc within out-of-line variables, function, and
Douglas Gregor [Fri, 25 Feb 2011 02:25:35 +0000 (02:25 +0000)]
Use NestedNameSpecifierLoc within out-of-line variables, function, and
tag definitions. Also, add support for template instantiation of
NestedNameSpecifierLocs.

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

13 years agoTeach TextDiagnosticPrinter to print out '-Werror' in addition to the warning flag...
Ted Kremenek [Fri, 25 Feb 2011 01:28:26 +0000 (01:28 +0000)]
Teach TextDiagnosticPrinter to print out '-Werror' in addition to the warning flag for a warning mapped to an error.

For example:

t.c:7:9: error: using the result of an assignment as a condition without parentheses [-Werror,-Wparentheses]

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

13 years agoNth time's a charm?
Douglas Gregor [Fri, 25 Feb 2011 00:46:48 +0000 (00:46 +0000)]
Nth time's a charm?

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

13 years agoCMake target check.deps only exists when LLVM_INCLUDE_TESTS
Douglas Gregor [Fri, 25 Feb 2011 00:43:05 +0000 (00:43 +0000)]
CMake target check.deps only exists when LLVM_INCLUDE_TESTS

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

13 years agoUpdate UsingDecl, UnresolvedUsingTypenameDecl, and
Douglas Gregor [Fri, 25 Feb 2011 00:36:19 +0000 (00:36 +0000)]
Update UsingDecl, UnresolvedUsingTypenameDecl, and
UnresolvedUsingValueDecl to use NestedNameSpecifierLoc rather than the
extremely-lossy NestedNameSpecifier/SourceRange pair it used to use,
improving source-location information.

Various infrastructure updates to support NestedNameSpecifierLoc:
  - AST/PCH (de-)serialization
  - Recursive AST visitor
  - libclang traversal (including the first tests of this
    functionality)

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

13 years agoLLVM_INCLUDE_TESTS applies to unit tests, not the normal Clang tests
Douglas Gregor [Fri, 25 Feb 2011 00:32:30 +0000 (00:32 +0000)]
LLVM_INCLUDE_TESTS applies to unit tests, not the normal Clang tests

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

13 years agoDon't include Clang's unit tests if LLVM's unit tests aren't being built
Douglas Gregor [Fri, 25 Feb 2011 00:12:04 +0000 (00:12 +0000)]
Don't include Clang's unit tests if LLVM's unit tests aren't being built

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

13 years agoIntoduce '-analyzer-checker-help' flag which outputs a list of all available static...
Argyrios Kyrtzidis [Fri, 25 Feb 2011 00:09:51 +0000 (00:09 +0000)]
Intoduce '-analyzer-checker-help' flag which outputs a list of all available static analyzer checkers.

This is pretty basic for now, eventually checkers should be grouped according to package, hidden checkers should be indicated etc.

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

13 years agoFix the rest of PR9316 along with some other bugs spotted by inspection.
Chandler Carruth [Fri, 25 Feb 2011 00:05:02 +0000 (00:05 +0000)]
Fix the rest of PR9316 along with some other bugs spotted by inspection.
I tried to add test cases for these, but I can't because variables
aren't warned on the way functions are and the codegen layer appears to
use different logic for determining that 'a' and 'g' in the test case
should receive C mangling. I've included the test so that if we ever
switch the codegen layer to use these functions, we won't regress due to
latent bugs.

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

13 years agoDon't warn about using PredefinedExprs as format string literals. These never can...
Ted Kremenek [Thu, 24 Feb 2011 23:03:04 +0000 (23:03 +0000)]
Don't warn about using PredefinedExprs as format string literals.  These never can be a real security issue.

Fixes PR 9314.

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

13 years ago[analyzer] Remove '-analyzer-experimental-internal-checks' flag, it doesn't have...
Argyrios Kyrtzidis [Thu, 24 Feb 2011 21:43:08 +0000 (21:43 +0000)]
[analyzer] Remove '-analyzer-experimental-internal-checks' flag, it doesn't have any checkers associated with it anymore.

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

13 years ago[analyzer] Allow a checker to be hidden even if its package is hidden & enabled.
Argyrios Kyrtzidis [Thu, 24 Feb 2011 21:42:52 +0000 (21:42 +0000)]
[analyzer] Allow a checker to be hidden even if its package is hidden & enabled.

For example, if 'core.experimental.UnreachableCode' is hidden, it should not be enabled with 'core.experimental'.
Note that this requires llvm commit r126436.

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

13 years ago[analyzer] Migrate CastSizeChecker to CheckerV2.
Argyrios Kyrtzidis [Thu, 24 Feb 2011 21:42:49 +0000 (21:42 +0000)]
[analyzer] Migrate CastSizeChecker to CheckerV2.

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

13 years agoFix a rewrite bug. // rdar://9039342
Fariborz Jahanian [Thu, 24 Feb 2011 21:29:21 +0000 (21:29 +0000)]
Fix a rewrite bug. // rdar://9039342

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

13 years agoUse private linkage to avoid symbol conflicts in corner cases like the one
Rafael Espindola [Thu, 24 Feb 2011 20:31:44 +0000 (20:31 +0000)]
Use private linkage to avoid symbol conflicts in corner cases like the one
in PR9301.

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

13 years agoLikely fix for PR9316 and other unknown bugs: don't use the anonynmous
Chandler Carruth [Thu, 24 Feb 2011 19:03:39 +0000 (19:03 +0000)]
Likely fix for PR9316 and other unknown bugs: don't use the anonynmous
namespace blanket rule for variables and functions declared 'extern
"C"'.

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

13 years agoRetain complete source-location information for C++
Douglas Gregor [Thu, 24 Feb 2011 17:54:50 +0000 (17:54 +0000)]
Retain complete source-location information for C++
nested-name-specifiers throughout the parser, and provide a new class
(NestedNameSpecifierLoc) that contains a nested-name-specifier along
with its type-source information.

Right now, this information is completely useless, because we don't
actually store the source-location information anywhere in the
AST. Call this Step 1/N.

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

13 years agoSimplify messages as requested by Chris.
Chandler Carruth [Thu, 24 Feb 2011 17:13:15 +0000 (17:13 +0000)]
Simplify messages as requested by Chris.

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

13 years agoFrom Vassil Vassilev:
Axel Naumann [Thu, 24 Feb 2011 16:47:47 +0000 (16:47 +0000)]
From Vassil Vassilev:
Add an interface for last resort, unqualified lookup. It can provide results for unqualified lookup when Sema fails to find anything itself.

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

13 years agoRevert "Use CharUnits values for Size and DataSize outside of the bitfield
Daniel Dunbar [Thu, 24 Feb 2011 16:40:53 +0000 (16:40 +0000)]
Revert "Use CharUnits values for Size and DataSize outside of the bitfield
layout", it broke some GCC tests.

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

13 years agoAllow passing a list of comma separated checker names to -analyzer-checker, e.g:
Argyrios Kyrtzidis [Thu, 24 Feb 2011 08:42:20 +0000 (08:42 +0000)]
Allow passing a list of comma separated checker names to -analyzer-checker, e.g:
  -analyzer-checker=cocoa,unix

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

13 years ago[analyzer] Migrate ArrayBoundChecker to CheckerV2.
Argyrios Kyrtzidis [Thu, 24 Feb 2011 08:42:12 +0000 (08:42 +0000)]
[analyzer] Migrate ArrayBoundChecker to CheckerV2.

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