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

13 years agoIssue AnalysisBasedWarnings as part of calling Sema::PopBlockOrFunctionScope(). ...
Ted Kremenek [Wed, 23 Feb 2011 01:51:48 +0000 (01:51 +0000)]
Issue AnalysisBasedWarnings as part of calling Sema::PopBlockOrFunctionScope().  No real functionality change.

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

13 years agoUpdate Sema::DiagRuntimeBehavior() to take an optional Stmt* to indicate the code...
Ted Kremenek [Wed, 23 Feb 2011 01:51:43 +0000 (01:51 +0000)]
Update Sema::DiagRuntimeBehavior() to take an optional Stmt* to indicate the code the diagnostic is associated with.

This Stmt* is unused, but we will use it shortly for pruning diagnostics associated
with unreachable code.

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

13 years agoChange -Warray-bounds logic to use DiagRuntimeBehavior in preparation for using basic...
Ted Kremenek [Wed, 23 Feb 2011 01:51:40 +0000 (01:51 +0000)]
Change -Warray-bounds logic to use DiagRuntimeBehavior in preparation for using basic dataflow to suppress warnings on unreachable array bounds checks.

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

13 years ago[analyzer] Migrate to CheckerV2:
Argyrios Kyrtzidis [Wed, 23 Feb 2011 01:05:36 +0000 (01:05 +0000)]
[analyzer] Migrate to CheckerV2:

CastToStructChecker
FixedAddressChecker
MacOSXAPIChecker
PointerArithChecker
PointerSubChecker
PthreadLockChecker
UnixAPIChecker

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

13 years agoSwitch the VerifyDiagnosticsClient to use PresumedLocs now that they
Chandler Carruth [Wed, 23 Feb 2011 00:47:48 +0000 (00:47 +0000)]
Switch the VerifyDiagnosticsClient to use PresumedLocs now that they
exist. Cheat and do this by adding some wrappers around the PresumedLoc
machinery that directly return the line and column number.

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

13 years agoUpdate the www to indicate that auto is now implemented.
Richard Smith [Wed, 23 Feb 2011 00:41:16 +0000 (00:41 +0000)]
Update the www to indicate that auto is now implemented.

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

13 years agoFix PR9276: We were missing the checks for auto deducing to different types in the...
Richard Smith [Wed, 23 Feb 2011 00:37:57 +0000 (00:37 +0000)]
Fix PR9276: We were missing the checks for auto deducing to different types in the same declaration group in the template instantiation case.

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

13 years ago[analyzer] Migrate the BasicObjCFoundationChecks to CheckerV2:
Argyrios Kyrtzidis [Wed, 23 Feb 2011 00:16:10 +0000 (00:16 +0000)]
[analyzer] Migrate the BasicObjCFoundationChecks to CheckerV2:

NilArgChecker
CFNumberCreateChecker
ClassReleaseChecker

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

13 years ago[analyzer] Fix CheckerManager::runCheckersForObjCMessage.
Argyrios Kyrtzidis [Wed, 23 Feb 2011 00:16:07 +0000 (00:16 +0000)]
[analyzer] Fix CheckerManager::runCheckersForObjCMessage.

It would run PostObjCMessage checkers even for PreObjCMessage checking.

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

13 years agoSilence a MSVC warning.
Argyrios Kyrtzidis [Wed, 23 Feb 2011 00:16:04 +0000 (00:16 +0000)]
Silence a MSVC warning.

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

13 years ago[analyzer] Refactor BugTypes and their ownership model.
Argyrios Kyrtzidis [Wed, 23 Feb 2011 00:16:01 +0000 (00:16 +0000)]
[analyzer] Refactor BugTypes and their ownership model.

-In general, don't have the BugReporter deleting BugTypes, BugTypes will eventually become owned by checkers
 and outlive the BugReporter. In the meantime, there will be some leaks since some checkers assume that
 the BugTypes they create will be destroyed by the BugReporter.
-Have BugReporter::EmitBasicReport create BugTypes that are reused if the same name & category strings
 are passed to EmitBasicReport. These BugTypes are owned and destroyed by the BugReporter.
 This allows bugs reported through EmitBasicReport to be coalesced.
-Remove the llvm::FoldingSet<BugReportEquivClass> from BugType and move it into the BugReporter.
 For uniquing BugReportEquivClass also use the BugType* so that we can iterate over all of them using only one set.

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

13 years agoIn the clang.xcodeproj modify the 'clang' target to do nothing, not try to build...
Argyrios Kyrtzidis [Wed, 23 Feb 2011 00:15:56 +0000 (00:15 +0000)]
In the clang.xcodeproj modify the 'clang' target to do nothing, not try to build anything.

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

13 years agoBetter parser recovery when method is
Fariborz Jahanian [Wed, 23 Feb 2011 00:11:21 +0000 (00:11 +0000)]
Better parser recovery when method is
errornously defined inside an objc class.
// rdar://7029784

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

13 years agoDeclGroup's operator[] always returned the first Decl in the group.
Richard Smith [Wed, 23 Feb 2011 00:09:59 +0000 (00:09 +0000)]
DeclGroup's operator[] always returned the first Decl in the group.

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

13 years agoClean up the error recovery at the bottom of Sema::LookupMemberExpr. This
Matt Beaumont-Gay [Tue, 22 Feb 2011 23:52:53 +0000 (23:52 +0000)]
Clean up the error recovery at the bottom of Sema::LookupMemberExpr. This
mostly just shuffles various possibilities for recovery into a more
straightforward order, but also unifies a couple of diagnostics.

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

13 years agoWhen checking for abstract types, don't crash when we have a
Douglas Gregor [Tue, 22 Feb 2011 23:21:06 +0000 (23:21 +0000)]
When checking for abstract types, don't crash when we have a
FunctionProtoTypeLoc with NULL function parameter types, which can
occur in invalid code. Fixes PR9247 / <rdar://problem/9037911>.

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

13 years agoProvide Fixit warning when 'auto' is intended as storage
Fariborz Jahanian [Tue, 22 Feb 2011 23:17:49 +0000 (23:17 +0000)]
Provide Fixit warning when 'auto' is intended as storage
specifier in legacy code. Patch is reviewed offline by Doug.
// rdar://9036633.

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

13 years agoEmit the structure layout of the block literal parameter to a block
John McCall [Tue, 22 Feb 2011 22:38:33 +0000 (22:38 +0000)]
Emit the structure layout of the block literal parameter to a block
invocation function into the debug info.  Rather than faking up a class,
which is tricky because of the custom layout we do, we just emit a struct
directly from the layout information we've already got.

Also, don't emit an unnecessarily parameter alloca for this "variable".

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

13 years agoGive ImplicitParamDecl a public constructor so that it can be allocated on
John McCall [Tue, 22 Feb 2011 22:25:56 +0000 (22:25 +0000)]
Give ImplicitParamDecl a public constructor so that it can be allocated on
the stack.

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

13 years agoProvide a Decl::getNonClosureContext to look through any "closure" (i.e.
John McCall [Tue, 22 Feb 2011 22:25:23 +0000 (22:25 +0000)]
Provide a Decl::getNonClosureContext to look through any "closure" (i.e.
block and, eventually, C++ lambda) contexts.

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

13 years agoWe need a longer long when testing this pathe Microsoft fixed-underlying-type extensi...
Douglas Gregor [Tue, 22 Feb 2011 21:42:31 +0000 (21:42 +0000)]
We need a longer long when testing this pathe Microsoft fixed-underlying-type extension for enumeration types

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

13 years agoA constructor call should force class's debug info even if -flimit-debug-info is...
Devang Patel [Tue, 22 Feb 2011 20:55:26 +0000 (20:55 +0000)]
A constructor call should force class's debug info even if -flimit-debug-info is enabled.

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

13 years agoimprove support for SUSE Linux Enterprise Server 11 SP1 (x86_64).
Chris Lattner [Tue, 22 Feb 2011 20:47:07 +0000 (20:47 +0000)]
improve support for SUSE Linux Enterprise Server 11 SP1  (x86_64).
Patch by Csaba Raduly!

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

13 years agoEnable enumeration types with a fixed underlying type, e.g.,
Douglas Gregor [Tue, 22 Feb 2011 20:32:04 +0000 (20:32 +0000)]
Enable enumeration types with a fixed underlying type, e.g.,

  enum X : long { Value = 0x100000000 };

when in Microsoft-extension mode (-fms-extensions). This (now C++0x)
feature has been supported since Microsoft Visual Studio .NET 2003.

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

13 years agoUse an unused-except-in-Debug variable.
Matt Beaumont-Gay [Tue, 22 Feb 2011 20:00:16 +0000 (20:00 +0000)]
Use an unused-except-in-Debug variable.

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

13 years agoUse LLVM coding standard.
Devang Patel [Tue, 22 Feb 2011 18:56:36 +0000 (18:56 +0000)]
Use LLVM coding standard.

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

13 years agoImplement the GNU C extension which permits the initialization of an
Douglas Gregor [Tue, 22 Feb 2011 18:29:51 +0000 (18:29 +0000)]
Implement the GNU C extension which permits the initialization of an
array from a constant array compound literal. Fixes PR9261.

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

13 years ago[analyzer] Start moving the path-sensitive checkers to CheckerV2.
Argyrios Kyrtzidis [Tue, 22 Feb 2011 17:30:38 +0000 (17:30 +0000)]
[analyzer] Start moving the path-sensitive checkers to CheckerV2.

-Migrate ObjCSelfInitChecker to CheckerV2. In the process remove the 'preCallSelfFlags' field
 from the checker class and use GRState for storing that info.
-Get ExprEngine to start delegating checker running to CheckerManager.

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

13 years ago[analyzer] Separate CheckerContext into its own include file. No functionality change.
Argyrios Kyrtzidis [Tue, 22 Feb 2011 17:30:32 +0000 (17:30 +0000)]
[analyzer] Separate CheckerContext into its own include file. No functionality change.

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

13 years ago[analyzer] Fix GRStatePartialTrait<bool> and introduce GRStatePartialTrait<unsigned>.
Argyrios Kyrtzidis [Tue, 22 Feb 2011 17:30:28 +0000 (17:30 +0000)]
[analyzer] Fix GRStatePartialTrait<bool> and introduce GRStatePartialTrait<unsigned>.

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

13 years agoRemove the storage for -cxx-system-include. Make libcxx toolchain
Joerg Sonnenberger [Tue, 22 Feb 2011 15:19:35 +0000 (15:19 +0000)]
Remove the storage for -cxx-system-include. Make libcxx toolchain
use -nostdinc++ and -cxx-isystem.

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

13 years agoReimplement __pragma support using a TokenLexer
Peter Collingbourne [Tue, 22 Feb 2011 13:49:06 +0000 (13:49 +0000)]
Reimplement __pragma support using a TokenLexer

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

13 years agoMake TokenLexer capable of storing preprocessor directive tokens
Peter Collingbourne [Tue, 22 Feb 2011 13:49:00 +0000 (13:49 +0000)]
Make TokenLexer capable of storing preprocessor directive tokens

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

13 years agoCMAKE_EXECUTABLE_SUFFIX is undefined when a cmake script is executed
Oscar Fuentes [Tue, 22 Feb 2011 13:05:15 +0000 (13:05 +0000)]
CMAKE_EXECUTABLE_SUFFIX is undefined when a cmake script is executed
with cmake -P ... so we need to deduce the correct executable prefix.

Fixes PR9286.

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

13 years agoEstablish the iteration variable of an ObjC for-in loop before
John McCall [Tue, 22 Feb 2011 07:16:58 +0000 (07:16 +0000)]
Establish the iteration variable of an ObjC for-in loop before
emitting the collection expression.  Fixes some really, really broken
code.

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

13 years agoReorganize the emission of local variables.
John McCall [Tue, 22 Feb 2011 06:44:22 +0000 (06:44 +0000)]
Reorganize the emission of local variables.

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

13 years agoAdd CStringChecker support for strncpy. Patch by Lenny Maiorani!
Ted Kremenek [Tue, 22 Feb 2011 04:58:34 +0000 (04:58 +0000)]
Add CStringChecker support for strncpy.  Patch by Lenny Maiorani!

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

13 years agoAdd CStringChecker support for strnlen. Patch by Lenny Maiorani!
Ted Kremenek [Tue, 22 Feb 2011 04:55:05 +0000 (04:55 +0000)]
Add CStringChecker support for strnlen.  Patch by Lenny Maiorani!

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

13 years agolib/CodeGen/TargetInfo.cpp: On Win64, arg i128 should be emitted as INDIRECT.
NAKAMURA Takumi [Tue, 22 Feb 2011 03:56:57 +0000 (03:56 +0000)]
lib/CodeGen/TargetInfo.cpp: On Win64, arg i128 should be emitted as INDIRECT.

mingw-w64's i128 tweak should be done with x86_64-mingw32.

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

13 years agoFix a little bug in the handling of enumeration types with a fixed
Douglas Gregor [Tue, 22 Feb 2011 02:55:24 +0000 (02:55 +0000)]
Fix a little bug in the handling of enumeration types with a fixed
underlying type: we weren't parsing unnamed enumeration types with a
fixed underlying type.

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

13 years agoWarn about implicit conversions between values of different, named
Douglas Gregor [Tue, 22 Feb 2011 02:45:07 +0000 (02:45 +0000)]
Warn about implicit conversions between values of different, named
enumeration types. Fixes <rdar://problem/8559831>.

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

13 years agoMake clang -cc1 disable Objective-C exceptions by default, and add a -fobjc-exception...
Anders Carlsson [Tue, 22 Feb 2011 01:52:06 +0000 (01:52 +0000)]
Make clang -cc1 disable Objective-C exceptions by default, and add a -fobjc-exceptions flag to turn them on.

Update all tests accordingly.

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

13 years agoMove some Objective-C tests to SemaObjC and CodeGenObjC.
Anders Carlsson [Tue, 22 Feb 2011 01:23:29 +0000 (01:23 +0000)]
Move some Objective-C tests to SemaObjC and CodeGenObjC.

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

13 years agoIn Objective-C, there are no trailing return types, so don't produce diagnostics...
Richard Smith [Tue, 22 Feb 2011 01:22:29 +0000 (01:22 +0000)]
In Objective-C, there are no trailing return types, so don't produce diagnostics suggesting they are missing.

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

13 years agoBug#8945: Add -cxx-isystem option to specify C++ system directories.
Joerg Sonnenberger [Tue, 22 Feb 2011 00:40:56 +0000 (00:40 +0000)]
Bug#8945: Add -cxx-isystem option to specify C++ system directories.
It works like -isystem and the search path keeps -isystem and
-cxx-isystem in order relative to each other. -cxx-isystem is only used
for C++ sources though. Drop the existing -cxx-system-include option for
cc1 as it is now redundant.

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

13 years agoFix a few auto-related issues:
Richard Smith [Tue, 22 Feb 2011 00:36:53 +0000 (00:36 +0000)]
Fix a few auto-related issues:

 * 'auto' was being rejected on abstract-declarators with trailing return
types and on typedefs with trailing return types. 'auto' is always
allowed in these cases. This was found while testing the fix for PR 9278.

 * A very poor diagnostic was being issued for auto (f() -> int): "return
type must be 'auto', not 'auto'". This is closely related to PR 9060.

 * Trailing return type handling was happening slightly too late,
resulting in the checks for functions returning arrays and functions
returning functions being missed.

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

13 years agoAdd reference to PR 9278 for archaeologists.
Richard Smith [Tue, 22 Feb 2011 00:19:36 +0000 (00:19 +0000)]
Add reference to PR 9278 for archaeologists.

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

13 years agoWarn when type modifiers on objc method declarations in
Fariborz Jahanian [Mon, 21 Feb 2011 23:49:15 +0000 (23:49 +0000)]
Warn when type modifiers on objc method declarations in
protocols do not match with method implementation.
// rdar://7076235

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

13 years agoThe instance size of a metaclass should be the size of a class. This is not, in...
David Chisnall [Mon, 21 Feb 2011 23:47:40 +0000 (23:47 +0000)]
The instance size of a metaclass should be the size of a class.  This is not, in fact, 0, even for very small classes.  (GNU runtime)

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

13 years agoC++0x's deduced auto is illegal in typedefs.
Richard Smith [Mon, 21 Feb 2011 23:18:00 +0000 (23:18 +0000)]
C++0x's deduced auto is illegal in typedefs.

This actually rules out too much, since it also catches typedefs for pointers to functions with trailing return types:

  typedef auto (*F)() -> int;

Fix for that (and the same issue in all abstract-declarators) to follow shortly.

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

13 years agoTargets/Darwin: mcount name on Darwin needs to be unmangled.
Daniel Dunbar [Mon, 21 Feb 2011 23:12:51 +0000 (23:12 +0000)]
Targets/Darwin: mcount name on Darwin needs to be unmangled.

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

13 years agoFix a CFGBuilder bug exposed on convoluted control-flow in the Linux kernel.
Ted Kremenek [Mon, 21 Feb 2011 22:11:26 +0000 (22:11 +0000)]
Fix a CFGBuilder bug exposed on convoluted control-flow in the Linux kernel.

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

13 years agoadd one more case of mismatched input/output constraints.
Chris Lattner [Mon, 21 Feb 2011 22:09:29 +0000 (22:09 +0000)]
add one more case of mismatched input/output constraints.
When the mismatch is due to a larger input operand that is
a constant, truncate it down to the size of the output.  This
allows us to accept some cases in the linux kernel and elsewhere.
Pedantically speaking, we generate different code than GCC, though
I can't imagine how it would matter:

Clang:
movb $-1, %al
frob %al

GCC:

movl $255, %eax
frob %al

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