]> granicus.if.org Git - clang/log
clang
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

13 years ago[analyzer] Don't pass a GRState to CheckerManager::runCheckersForLocation, terrible...
Argyrios Kyrtzidis [Thu, 24 Feb 2011 08:42:04 +0000 (08:42 +0000)]
[analyzer] Don't pass a GRState to CheckerManager::runCheckersForLocation, terrible mistake.

If the state is new, make sure an ExplodedNode is associated with it.

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

13 years ago[analyzer] Migrate ReturnPointerRangeChecker to CheckerV2.
Argyrios Kyrtzidis [Thu, 24 Feb 2011 08:41:57 +0000 (08:41 +0000)]
[analyzer] Migrate ReturnPointerRangeChecker to CheckerV2.

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

13 years agocompute the integer width, not the memory width here. We want to know that
Chris Lattner [Thu, 24 Feb 2011 07:31:28 +0000 (07:31 +0000)]
compute the integer width, not the memory width here.  We want to know that
_Bool is 1 bit, not 8.  This fixes an assertion on the testcase, which is
PR9304 and rdar://9045501.

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

13 years agoReimplement DefineTypeSize in terms of APInt. This eliminates some
Chris Lattner [Thu, 24 Feb 2011 06:54:56 +0000 (06:54 +0000)]
Reimplement DefineTypeSize in terms of APInt.  This eliminates some
magic integer arithmetic and allows it to work with types larger
than 64 bits.

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

13 years agorework processing of unavailable and deprecated attributes to avoid
Chris Lattner [Thu, 24 Feb 2011 05:42:24 +0000 (05:42 +0000)]
rework processing of unavailable and deprecated attributes to avoid
unneeded allocation of an empty StringLiteral when these don't have
a message.

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

13 years agoFix tiny error in CFG construction for BinaryConditionalOperators, making sure the...
Ted Kremenek [Thu, 24 Feb 2011 03:09:15 +0000 (03:09 +0000)]
Fix tiny error in CFG construction for BinaryConditionalOperators, making sure the branch always has two successors.  Also teach Environment::getSVal() about OpaqueValueExprs.

This fixes a crash reported in PR9287, and also fixes a false positive involving the value of such ternary
expressions not properly getting propagated.

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

13 years agoTweak this test a bit further to make it easier on grep. Who knows what
Chandler Carruth [Thu, 24 Feb 2011 02:39:40 +0000 (02:39 +0000)]
Tweak this test a bit further to make it easier on grep. Who knows what
characters get dropped into the regular expression from %t.

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

13 years agoTest case for previous commit
Douglas Gregor [Thu, 24 Feb 2011 02:37:39 +0000 (02:37 +0000)]
Test case for previous commit

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

13 years agoTeach NestedNameSpecifier to keep track of namespace aliases the same
Douglas Gregor [Thu, 24 Feb 2011 02:36:08 +0000 (02:36 +0000)]
Teach NestedNameSpecifier to keep track of namespace aliases the same
way it keeps track of namespaces. Previously, we would map from the
namespace alias to its underlying namespace when building a
nested-name-specifier, losing source information in the process.

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

13 years agoUse CharUnits values for Size and DataSize outside of the bitfield layout
Ken Dyck [Thu, 24 Feb 2011 02:12:14 +0000 (02:12 +0000)]
Use CharUnits values for Size and DataSize outside of the bitfield layout
methods, when they are known to be exact multiples of the width of the char
type.

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

13 years agoUse Context.getCharWidth() in place of literal '8's in assertions.
Ken Dyck [Thu, 24 Feb 2011 01:33:05 +0000 (01:33 +0000)]
Use Context.getCharWidth() in place of literal '8's in assertions.

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

13 years agoMake the Size and DataSize members more CharUnits-friendly by wrapping them
Ken Dyck [Thu, 24 Feb 2011 01:13:28 +0000 (01:13 +0000)]
Make the Size and DataSize members more CharUnits-friendly by wrapping them
with getter and setter methods in both bit units and CharUnits. This will help
simplify some of the unit mismatch in the parts of the code where sizes are
known to be exact multiples of the width of the char type.

Assertions in the getters help guard against accidentally converting to
CharUnits when sizes are not exact multiples of the char width.

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

13 years ago[analyzer] Remove unused functions from CheckerManager.
Argyrios Kyrtzidis [Thu, 24 Feb 2011 01:05:37 +0000 (01:05 +0000)]
[analyzer] Remove unused functions from CheckerManager.

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

13 years ago[analyzer] Migrate StreamChecker to CheckerV2.
Argyrios Kyrtzidis [Thu, 24 Feb 2011 01:05:33 +0000 (01:05 +0000)]
[analyzer] Migrate StreamChecker to CheckerV2.

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

13 years ago[analyzer] Migrate CStringChecker to CheckerV2.
Argyrios Kyrtzidis [Thu, 24 Feb 2011 01:05:30 +0000 (01:05 +0000)]
[analyzer] Migrate CStringChecker to CheckerV2.

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

13 years agoTweak the CXXScopeSpec API a bit, so that we require the
Douglas Gregor [Thu, 24 Feb 2011 00:49:34 +0000 (00:49 +0000)]
Tweak the CXXScopeSpec API a bit, so that we require the
nested-name-specifier and source range to be set at the same time.

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

13 years agoTeach CXXScopeSpec to handle the extension of a nested-name-specifier
Douglas Gregor [Thu, 24 Feb 2011 00:17:56 +0000 (00:17 +0000)]
Teach CXXScopeSpec to handle the extension of a nested-name-specifier
with another component in the nested-name-specifiers, updating its
representation (a NestedNameSpecifier) and source-location information
(currently a SourceRange) simultaneously. This is groundwork for
adding source-location information to nested-name-specifiers.

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

13 years agoHandle value dependent LHS as well as RHS. Test both of these, they
Chandler Carruth [Thu, 24 Feb 2011 00:03:53 +0000 (00:03 +0000)]
Handle value dependent LHS as well as RHS. Test both of these, they
don't seem to have been covered by our tests previously.

This should fix bootstrap failure.

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

13 years agoClean up the CMake test execution by nuking this directory before we try
Chandler Carruth [Wed, 23 Feb 2011 23:52:14 +0000 (23:52 +0000)]
Clean up the CMake test execution by nuking this directory before we try
to create it. Lit doesn't apparently clean up test directories
effectively, and so this broke randomly on subsequent runs.

Also XFAIL the test on windows, as there's not much hope for these
commands doing the right thing there.

Paired with Nick Lewycky.

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

13 years agoImplement a warning for known shift overflows on constant shift
Chandler Carruth [Wed, 23 Feb 2011 23:34:11 +0000 (23:34 +0000)]
Implement a warning for known shift overflows on constant shift
expressions. Consider the code:

  int64_t i = 10 << 30;

This compiles fine, but most developers expect it to produce the value
for 10 gigs, not -2 gigs. This is actually undefined behavior because
the LHS is a signed integer type.

The warning is currently gated behind -Wshift-overflow.

There is a special case where only the sign bit is overridden that gets
a custom error message and is by default ignored. This case is much less
likely to cause observed buggy behavior, it's just undefined behavior
according to the spec. This warning can be enabled with
-Wshift-sign-overflow.

Original patch by Oleg Slezberg, with style tweaks and some correctness
fixes by me.

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

13 years agoFix bogus -Warray-bounds warning involving 'array[true]' reported in PR 9296.
Ted Kremenek [Wed, 23 Feb 2011 23:06:04 +0000 (23:06 +0000)]
Fix bogus -Warray-bounds warning involving 'array[true]' reported in PR 9296.

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

13 years agoPreserve what the user passed to -include when emitting .d files. Fixes PR8974!
Nick Lewycky [Wed, 23 Feb 2011 21:16:44 +0000 (21:16 +0000)]
Preserve what the user passed to -include when emitting .d files. Fixes PR8974!

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

13 years ago[analyzer] Migrate StackAddrLeakChecker to CheckerV2.
Argyrios Kyrtzidis [Wed, 23 Feb 2011 21:04:54 +0000 (21:04 +0000)]
[analyzer] Migrate StackAddrLeakChecker to CheckerV2.

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

13 years ago[analyzer] Refactor EndOfFunctionNodeBuilder.
Argyrios Kyrtzidis [Wed, 23 Feb 2011 21:04:49 +0000 (21:04 +0000)]
[analyzer] Refactor EndOfFunctionNodeBuilder.

-Introduce EndOfFunctionNodeBuilder::withCheckerTag to allow it be "specialized" with a
 checker tag and not require the checkers to pass a tag.
-For EndOfFunctionNodeBuilder::generateNode, reverse the order of tag/P parameters since
 there are actual calls that assume the second parameter is ExplodedNode.

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

13 years ago[analyzer] Migrate IdempotentOperationChecker to CheckerV2.
Argyrios Kyrtzidis [Wed, 23 Feb 2011 21:04:44 +0000 (21:04 +0000)]
[analyzer] Migrate IdempotentOperationChecker to CheckerV2.

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

13 years agofix typo in *all* of the test cases
Matt Beaumont-Gay [Wed, 23 Feb 2011 19:40:41 +0000 (19:40 +0000)]
fix typo in *all* of the test cases

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

13 years agofix typo in test too
Matt Beaumont-Gay [Wed, 23 Feb 2011 19:39:05 +0000 (19:39 +0000)]
fix typo in test too

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

13 years ago[analyzer] const goodness.
Argyrios Kyrtzidis [Wed, 23 Feb 2011 19:38:45 +0000 (19:38 +0000)]
[analyzer] const goodness.

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

13 years ago[analyzer] Rename runPathSensitiveCheckers -> expandGraphWithCheckers.
Argyrios Kyrtzidis [Wed, 23 Feb 2011 19:38:41 +0000 (19:38 +0000)]
[analyzer] Rename runPathSensitiveCheckers -> expandGraphWithCheckers.

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

13 years ago[analyzer] Migrate ChrootChecker to CheckerV2.
Argyrios Kyrtzidis [Wed, 23 Feb 2011 19:38:39 +0000 (19:38 +0000)]
[analyzer] Migrate ChrootChecker to CheckerV2.

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

13 years agofix typo
Matt Beaumont-Gay [Wed, 23 Feb 2011 18:55:30 +0000 (18:55 +0000)]
fix typo

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

13 years agoFix the behavior of -Wignored-qualifiers on return type qualifiers in
Chandler Carruth [Wed, 23 Feb 2011 18:51:59 +0000 (18:51 +0000)]
Fix the behavior of -Wignored-qualifiers on return type qualifiers in
several ways. We now warn for more of the return types, and correctly
locate the ignored ones. Also adds fix-it hints to remove the ignored
qualifiers. Fixes much of PR9058, although not all of it.

Patch by Hans Wennborg, a couple of minor style tweaks from me.

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

13 years agoMention libclang in the Doxygen documentation
Douglas Gregor [Wed, 23 Feb 2011 17:45:25 +0000 (17:45 +0000)]
Mention libclang in the Doxygen documentation

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

13 years agoFix type mismatch between property function that CGObjCGNU was returning and the...
David Chisnall [Wed, 23 Feb 2011 14:05:31 +0000 (14:05 +0000)]
Fix type mismatch between property function that CGObjCGNU was returning and the one CGObjC was calling.  Fixes bug r9294.

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

13 years agoCMake: Don't use ${CMAKE_CFG_INTDIR} for installed llvm-lit on Visual Studio.
NAKAMURA Takumi [Wed, 23 Feb 2011 12:07:49 +0000 (12:07 +0000)]
CMake: Don't use ${CMAKE_CFG_INTDIR} for installed llvm-lit on Visual Studio.

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

13 years ago[analyzer] Migrate UnreachableCodeChecker to CheckerV2.
Argyrios Kyrtzidis [Wed, 23 Feb 2011 07:19:23 +0000 (07:19 +0000)]
[analyzer] Migrate UnreachableCodeChecker to CheckerV2.

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

13 years ago[analyzer] Migrate to CheckerV2:
Argyrios Kyrtzidis [Wed, 23 Feb 2011 07:19:18 +0000 (07:19 +0000)]
[analyzer] Migrate to CheckerV2:

NSAutoreleasePoolChecker
ObjCAtSyncChecker

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

13 years ago[analyzer] Add LangOptions in CheckerManager.
Argyrios Kyrtzidis [Wed, 23 Feb 2011 07:19:14 +0000 (07:19 +0000)]
[analyzer] Add LangOptions in CheckerManager.

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

13 years agoTeach CFGBuilder about null pointer constants in conditionals, and how they can be...
Ted Kremenek [Wed, 23 Feb 2011 05:11:46 +0000 (05:11 +0000)]
Teach CFGBuilder about null pointer constants in conditionals, and how they can be used to prune branches.  Fixes false null pointer dereference warning in PR 8183.

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

13 years agoAdd null check in CursorVisitor::RunVisitorWorkList() when visiting LabelDecls. ...
Ted Kremenek [Wed, 23 Feb 2011 04:54:51 +0000 (04:54 +0000)]
Add null check in CursorVisitor::RunVisitorWorkList() when visiting LabelDecls.  Fixes <rdar://problem/9040579>.

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

13 years agoDon't give an error for 'try' and 'throw' if they occur in system headers.
Anders Carlsson [Wed, 23 Feb 2011 03:46:46 +0000 (03:46 +0000)]
Don't give an error for 'try' and 'throw' if they occur in system headers.

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

13 years agoAdd a -fcxx-exceptions flag to clang -cc1. This controls the newly added CXXException...
Anders Carlsson [Wed, 23 Feb 2011 03:16:42 +0000 (03:16 +0000)]
Add a -fcxx-exceptions flag to clang -cc1. This controls the newly added CXXExceptions flag.

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

13 years agoAdd a CXXExceptions flag to LangOptions.
Anders Carlsson [Wed, 23 Feb 2011 03:04:54 +0000 (03:04 +0000)]
Add a CXXExceptions flag to LangOptions.

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

13 years agoAdd doxygen comments to Sema::DiagRuntimeBehavior().
Ted Kremenek [Wed, 23 Feb 2011 02:26:43 +0000 (02:26 +0000)]
Add doxygen comments to Sema::DiagRuntimeBehavior().

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

13 years agoAdd test case (from PR 8876) for suppressing 'indirection of non-volatile null pointe...
Ted Kremenek [Wed, 23 Feb 2011 02:15:19 +0000 (02:15 +0000)]
Add test case (from PR 8876) for suppressing 'indirection of non-volatile null pointer...' warning due to reachability analysis.

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

13 years agoSema: diagnose kernel calls to non-global functions
Peter Collingbourne [Wed, 23 Feb 2011 01:53:29 +0000 (01:53 +0000)]
Sema: diagnose kernel calls to non-global functions

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

13 years agoAdd test case for PR 9284, a false positive for -Warray-bounds that is now addressed...
Ted Kremenek [Wed, 23 Feb 2011 01:52:07 +0000 (01:52 +0000)]
Add test case for PR 9284, a false positive for -Warray-bounds that is now addressed using basic reachability analysis.

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

13 years agoEnhance Sema::DiagRuntimeBehavior() to delay some diagnostics to see if the related...
Ted Kremenek [Wed, 23 Feb 2011 01:52:04 +0000 (01:52 +0000)]
Enhance Sema::DiagRuntimeBehavior() to delay some diagnostics to see if the related code is reachable.  This suppresses some
diagnostics that occur in unreachable code (e.g., -Warray-bound).

We only pay the cost of doing the reachability analysis when we issue one of these diagnostics.

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

13 years agoMigrate CFGReachabilityAnalysis out of the IdempotentOperationsChecker and into its...
Ted Kremenek [Wed, 23 Feb 2011 01:51:59 +0000 (01:51 +0000)]
Migrate CFGReachabilityAnalysis out of the IdempotentOperationsChecker and into its own analysis file.

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

13 years agoHave IdempotentOperationsChecker pull its CFGStmtMap from AnalysisContext.
Ted Kremenek [Wed, 23 Feb 2011 01:51:53 +0000 (01:51 +0000)]
Have IdempotentOperationsChecker pull its CFGStmtMap from AnalysisContext.

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