Commit Graph

28648 Commits

Author SHA1 Message Date
Rafael Espindola eb4fd01f7a Use private linkage to avoid symbol conflicts in corner cases like the one
in PR9301.

llvm-svn: 126422
2011-02-24 20:31:44 +00:00
Chandler Carruth 9682a2fd3a Likely fix for PR9316 and other unknown bugs: don't use the anonynmous
namespace blanket rule for variables and functions declared 'extern
"C"'.

llvm-svn: 126400
2011-02-24 19:03:39 +00:00
Douglas Gregor 869ad45f8f 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.

llvm-svn: 126391
2011-02-24 17:54:50 +00:00
Chandler Carruth e721185799 Simplify messages as requested by Chris.
llvm-svn: 126389
2011-02-24 17:13:15 +00:00
Axel Naumann 016538ad2a 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.

llvm-svn: 126387
2011-02-24 16:47:47 +00:00
Daniel Dunbar 30cdc7022b Revert "Use CharUnits values for Size and DataSize outside of the bitfield
layout", it broke some GCC tests.

llvm-svn: 126386
2011-02-24 16:40:53 +00:00
Argyrios Kyrtzidis c08d89e6c2 Allow passing a list of comma separated checker names to -analyzer-checker, e.g:
-analyzer-checker=cocoa,unix

llvm-svn: 126372
2011-02-24 08:42:20 +00:00
Argyrios Kyrtzidis dd407f423b [analyzer] Migrate ArrayBoundChecker to CheckerV2.
llvm-svn: 126371
2011-02-24 08:42:12 +00:00
Argyrios Kyrtzidis 8f38c3843d [analyzer] Don't pass a GRState to CheckerManager::runCheckersForLocation, terrible mistake.
If the state is new, make sure an ExplodedNode is associated with it.

llvm-svn: 126370
2011-02-24 08:42:04 +00:00
Argyrios Kyrtzidis 7bc0141043 [analyzer] Migrate ReturnPointerRangeChecker to CheckerV2.
llvm-svn: 126369
2011-02-24 08:41:57 +00:00
Chris Lattner abcf38a064 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.

llvm-svn: 126368
2011-02-24 07:31:28 +00:00
Chris Lattner d767a0300e Reimplement DefineTypeSize in terms of APInt. This eliminates some
magic integer arithmetic and allows it to work with types larger
than 64 bits.

llvm-svn: 126365
2011-02-24 06:54:56 +00:00
Chris Lattner 190aa10fe6 rework processing of unavailable and deprecated attributes to avoid
unneeded allocation of an empty StringLiteral when these don't have
a message.

llvm-svn: 126364
2011-02-24 05:42:24 +00:00
Ted Kremenek d813801384 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.

llvm-svn: 126362
2011-02-24 03:09:15 +00:00
Chandler Carruth f8da8c7fa7 Tweak this test a bit further to make it easier on grep. Who knows what
characters get dropped into the regular expression from %t.

llvm-svn: 126361
2011-02-24 02:39:40 +00:00
Douglas Gregor d7295bad84 Test case for previous commit
llvm-svn: 126360
2011-02-24 02:37:39 +00:00
Douglas Gregor 7b26ff912f 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.

llvm-svn: 126358
2011-02-24 02:36:08 +00:00
Ken Dyck 8e74e79145 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. 

llvm-svn: 126357
2011-02-24 02:12:14 +00:00
Ken Dyck 3c215f2fd1 Use Context.getCharWidth() in place of literal '8's in assertions.
llvm-svn: 126356
2011-02-24 01:33:05 +00:00
Ken Dyck ecfc75529f 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.

llvm-svn: 126354
2011-02-24 01:13:28 +00:00
Argyrios Kyrtzidis 4769e9376e [analyzer] Remove unused functions from CheckerManager.
llvm-svn: 126352
2011-02-24 01:05:37 +00:00
Argyrios Kyrtzidis 785459a2a9 [analyzer] Migrate StreamChecker to CheckerV2.
llvm-svn: 126351
2011-02-24 01:05:33 +00:00
Argyrios Kyrtzidis c26f15dbad [analyzer] Migrate CStringChecker to CheckerV2.
llvm-svn: 126350
2011-02-24 01:05:30 +00:00
Douglas Gregor 2ab3fee3f3 Tweak the CXXScopeSpec API a bit, so that we require the
nested-name-specifier and source range to be set at the same time.

llvm-svn: 126347
2011-02-24 00:49:34 +00:00
Douglas Gregor 90c9972fb2 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.

llvm-svn: 126346
2011-02-24 00:17:56 +00:00
Chandler Carruth 60ed89dc54 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.

llvm-svn: 126345
2011-02-24 00:03:53 +00:00
Chandler Carruth 220617c1ba 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.

llvm-svn: 126344
2011-02-23 23:52:14 +00:00
Chandler Carruth 4c6fdca035 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.

llvm-svn: 126342
2011-02-23 23:34:11 +00:00
Ted Kremenek e4b316c15c Fix bogus -Warray-bounds warning involving 'array[true]' reported in PR 9296.
llvm-svn: 126341
2011-02-23 23:06:04 +00:00
Nick Lewycky 3607989847 Preserve what the user passed to -include when emitting .d files. Fixes PR8974!
llvm-svn: 126334
2011-02-23 21:16:44 +00:00
Argyrios Kyrtzidis 506220fef7 [analyzer] Migrate StackAddrLeakChecker to CheckerV2.
llvm-svn: 126333
2011-02-23 21:04:54 +00:00
Argyrios Kyrtzidis f1b5d1f01b [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.

llvm-svn: 126332
2011-02-23 21:04:49 +00:00
Argyrios Kyrtzidis 66b38c2261 [analyzer] Migrate IdempotentOperationChecker to CheckerV2.
llvm-svn: 126331
2011-02-23 21:04:44 +00:00
Matt Beaumont-Gay b7edc188e2 fix typo in *all* of the test cases
llvm-svn: 126328
2011-02-23 19:40:41 +00:00
Matt Beaumont-Gay 006cdae008 fix typo in test too
llvm-svn: 126327
2011-02-23 19:39:05 +00:00
Argyrios Kyrtzidis 68cab73ab9 [analyzer] const goodness.
llvm-svn: 126326
2011-02-23 19:38:45 +00:00
Argyrios Kyrtzidis d0732a660a [analyzer] Rename runPathSensitiveCheckers -> expandGraphWithCheckers.
llvm-svn: 126325
2011-02-23 19:38:41 +00:00
Argyrios Kyrtzidis da02a25ae6 [analyzer] Migrate ChrootChecker to CheckerV2.
llvm-svn: 126324
2011-02-23 19:38:39 +00:00
Matt Beaumont-Gay 5d2144602f fix typo
llvm-svn: 126323
2011-02-23 18:55:30 +00:00
Chandler Carruth e71b378dc7 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.

llvm-svn: 126321
2011-02-23 18:51:59 +00:00
Douglas Gregor 4a4e0eb782 Mention libclang in the Doxygen documentation
llvm-svn: 126316
2011-02-23 17:45:25 +00:00
David Chisnall 8aab5de75c Fix type mismatch between property function that CGObjCGNU was returning and the one CGObjC was calling. Fixes bug r9294.
llvm-svn: 126312
2011-02-23 14:05:31 +00:00
NAKAMURA Takumi ff75d8d502 CMake: Don't use ${CMAKE_CFG_INTDIR} for installed llvm-lit on Visual Studio.
llvm-svn: 126310
2011-02-23 12:07:49 +00:00
Argyrios Kyrtzidis bf61d97a98 [analyzer] Migrate UnreachableCodeChecker to CheckerV2.
llvm-svn: 126308
2011-02-23 07:19:23 +00:00
Argyrios Kyrtzidis aad8372516 [analyzer] Migrate to CheckerV2:
NSAutoreleasePoolChecker
	ObjCAtSyncChecker

llvm-svn: 126307
2011-02-23 07:19:18 +00:00
Argyrios Kyrtzidis 99ea46462a [analyzer] Add LangOptions in CheckerManager.
llvm-svn: 126306
2011-02-23 07:19:14 +00:00
Ted Kremenek 1a241d1619 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.
llvm-svn: 126305
2011-02-23 05:11:46 +00:00
Ted Kremenek c49211c79a Add null check in CursorVisitor::RunVisitorWorkList() when visiting LabelDecls. Fixes <rdar://problem/9040579>.
llvm-svn: 126304
2011-02-23 04:54:51 +00:00
Anders Carlsson d99dbcc2a9 Don't give an error for 'try' and 'throw' if they occur in system headers.
llvm-svn: 126303
2011-02-23 03:46:46 +00:00
Anders Carlsson 33e56a047f Add a -fcxx-exceptions flag to clang -cc1. This controls the newly added CXXExceptions flag.
llvm-svn: 126300
2011-02-23 03:16:42 +00:00