]> granicus.if.org Git - clang/log
clang
13 years agoRemove the Chaining argument from the PCH/module generator. It's no longer used
Douglas Gregor [Thu, 25 Aug 2011 22:35:51 +0000 (22:35 +0000)]
Remove the Chaining argument from the PCH/module generator. It's no longer used

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

13 years agoIntroduce a -cc1 option "-emit-module", that creates a binary module
Douglas Gregor [Thu, 25 Aug 2011 22:30:56 +0000 (22:30 +0000)]
Introduce a -cc1 option "-emit-module", that creates a binary module
from the given source. -emit-module behaves similarly to -emit-pch,
except that Sema is somewhat more strict about the contents of
-emit-module. In the future, there are likely to be more interesting
differences.

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

13 years agoobjc - fix a bug exposed by my recent decl context
Fariborz Jahanian [Thu, 25 Aug 2011 22:26:53 +0000 (22:26 +0000)]
objc - fix a bug exposed by my recent decl context
changes. // rdar://10015110

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

13 years ago[libclang] Fix getting a cursor that points inside tag definition that is part
Argyrios Kyrtzidis [Thu, 25 Aug 2011 22:24:47 +0000 (22:24 +0000)]
[libclang] Fix getting a cursor that points inside tag definition that is part
of a type specifier.

e.g. for:

typedef struct _MyS {
  int foo;
} MyS;

pointing at field 'foo' would give a cursor for the typedef declaration 'MyS'
instead of the field.

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

13 years agoClean up the reloading of identifier information following the load of
Douglas Gregor [Thu, 25 Aug 2011 21:19:59 +0000 (21:19 +0000)]
Clean up the reloading of identifier information following the load of
a top-level module. This code is still horrible and should go away,
but we're not there yet.

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

13 years agoPreload source location entries as soon as we've loaded a particular
Douglas Gregor [Thu, 25 Aug 2011 21:09:44 +0000 (21:09 +0000)]
Preload source location entries as soon as we've loaded a particular
AST file, rather than waiting until we finish loading the top-level
AST file.

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

13 years agoReverse r138567 until a buildbot failure is investigated.
Fariborz Jahanian [Thu, 25 Aug 2011 21:09:22 +0000 (21:09 +0000)]
Reverse r138567 until a buildbot failure is investigated.

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

13 years agoMove file validation in the ASTReader from "top of chain" validation
Douglas Gregor [Thu, 25 Aug 2011 20:58:51 +0000 (20:58 +0000)]
Move file validation in the ASTReader from "top of chain" validation
to "when loading a particular module" validation, since it was only
validating local information anyway. This shouldn't change anything.

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

13 years agoFactor the Module and ModuleManager classes out into separate headers
Douglas Gregor [Thu, 25 Aug 2011 20:47:51 +0000 (20:47 +0000)]
Factor the Module and ModuleManager classes out into separate headers
and .cpp files, since ASTReader.cpp was getting way too large. No
functionality change.

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

13 years agoUse stronger typing for the flags on AggValueSlot and require
John McCall [Thu, 25 Aug 2011 20:40:09 +0000 (20:40 +0000)]
Use stronger typing for the flags on AggValueSlot and require
creators to tell us whether something needs GC barriers.
No functionality change.

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

13 years agoMake Lexer::ComputePreamble accept a LangOptions parameter, otherwise it may be
Argyrios Kyrtzidis [Thu, 25 Aug 2011 20:39:19 +0000 (20:39 +0000)]
Make Lexer::ComputePreamble accept a LangOptions parameter, otherwise it may be
out-of-sync how a file is compiled. Patch by Matthias Kleine!

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

13 years ago80-column and spacing.
Chad Rosier [Thu, 25 Aug 2011 20:17:19 +0000 (20:17 +0000)]
80-column and spacing.

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

13 years agoTeach -Wunreachable-code about dead code caused by macro expansions. This should...
Ted Kremenek [Thu, 25 Aug 2011 19:28:55 +0000 (19:28 +0000)]
Teach -Wunreachable-code about dead code caused by macro expansions.  This should suppress false positives resulting from 'assert' and friends.

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

13 years agoSwitch ASTReader::GetHeaderFileInfo() from a walk over the module
Douglas Gregor [Thu, 25 Aug 2011 18:14:34 +0000 (18:14 +0000)]
Switch ASTReader::GetHeaderFileInfo() from a walk over the module
chain to a proper search.

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

13 years agoSwitch the forward walk through the module chain over to a depth-first
Douglas Gregor [Thu, 25 Aug 2011 18:03:05 +0000 (18:03 +0000)]
Switch the forward walk through the module chain over to a depth-first
search in ASTReader::ReadPreprocessedEntities().

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

13 years agoFixes a typo in my last patch.
Fariborz Jahanian [Thu, 25 Aug 2011 18:01:27 +0000 (18:01 +0000)]
Fixes a typo in my last patch.

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

13 years agoobjc -arse: Use DeclGroup for forward class declarations;
Fariborz Jahanian [Thu, 25 Aug 2011 17:47:31 +0000 (17:47 +0000)]
objc -arse: Use DeclGroup for forward class declarations;
as in @class foo, bar. More cleanup to follow.

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

13 years ago[driver] Do not add -kext to the link command line when compiling with
Chad Rosier [Thu, 25 Aug 2011 17:33:03 +0000 (17:33 +0000)]
[driver] Do not add -kext to the link command line when compiling with
-fapple-kext.
Fixes <rdar://problem/10013310>. Reverts <rdar://problem/7809940>.

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

13 years agoRemove a bogus assertion from the AST reader, which assumed that
Douglas Gregor [Thu, 25 Aug 2011 15:28:26 +0000 (15:28 +0000)]
Remove a bogus assertion from the AST reader, which assumed that
redeclarations of a particular entity would occur in source
order. Friend declarations that occur within class templates (or
member classes thereof) do not follow this, nor would modules. Big
thanks to Erik Verbruggen for reducing this problem from the Very
Large Qt preamble testcase he found.

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

13 years agoUse the module manager's search facility to look for methods with a
Douglas Gregor [Thu, 25 Aug 2011 14:51:20 +0000 (14:51 +0000)]
Use the module manager's search facility to look for methods with a
given selector, rather than walking the chain backwards. Teach its
visitor how to merge multiple result sets into a single result set,
combining the results of selector lookup in several different modules
into a single result set.

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

13 years ago[analyzer] Move the leak bugs from CFRefCount to RetainReleaseChecker, with a level...
Jordy Rose [Thu, 25 Aug 2011 01:14:38 +0000 (01:14 +0000)]
[analyzer] Move the leak bugs from CFRefCount to RetainReleaseChecker, with a level of indirection to handle GC vs. non-GC.

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

13 years ago[analyzer] MacOSKeychainAPIChecker: Cleanup AllocationState structure.
Anna Zaks [Thu, 25 Aug 2011 00:59:06 +0000 (00:59 +0000)]
[analyzer] MacOSKeychainAPIChecker: Cleanup AllocationState structure.

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

13 years agoAdd support for Microsoft __ptr32 keyword.
Francois Pichet [Thu, 25 Aug 2011 00:36:46 +0000 (00:36 +0000)]
Add support for Microsoft __ptr32 keyword.
Patch by Chris Cudmore!

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

13 years ago[analyzer] Move the easy bug types from CFRefCount to RetainReleaseChecker.
Jordy Rose [Thu, 25 Aug 2011 00:34:03 +0000 (00:34 +0000)]
[analyzer] Move the easy bug types from CFRefCount to RetainReleaseChecker.

(These bug types may have just been leaked before...!)

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

13 years ago[analyzer] MacOSKeychainAPIChecker: Add the custom BugReport visitor(which highlights...
Anna Zaks [Thu, 25 Aug 2011 00:32:42 +0000 (00:32 +0000)]
[analyzer] MacOSKeychainAPIChecker: Add the custom BugReport visitor(which highlights the allocation site) to all the relevant reports within the checker.

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

13 years ago[analyzer] Move the RetainSummaryManager from CFRefCount to RetainReleaseChecker.
Jordy Rose [Thu, 25 Aug 2011 00:10:37 +0000 (00:10 +0000)]
[analyzer] Move the RetainSummaryManager from CFRefCount to RetainReleaseChecker.

Because Checkers live for an entire translation unit, this persists summary caches across multiple code bodies and avoids repeated initialization (but probably at the cost of memory). This removes the last references from RetainReleaseChecker to CFRefCount.

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

13 years agoblocks - capturing logic of byref block variable's expression
Fariborz Jahanian [Thu, 25 Aug 2011 00:06:26 +0000 (00:06 +0000)]
blocks - capturing logic of byref block variable's expression
statement initializer makes safe assumption when a substatement
is encounterred (with a fix me).

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

13 years ago[analyzer] Better fix for the "missing return" error, from Ted.
Jordy Rose [Wed, 24 Aug 2011 23:41:46 +0000 (23:41 +0000)]
[analyzer] Better fix for the "missing return" error, from Ted.

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

13 years ago[analyzer] Silence another incorrect warning ("control reaches end of non-void function")
Jordy Rose [Wed, 24 Aug 2011 22:58:49 +0000 (22:58 +0000)]
[analyzer] Silence another incorrect warning ("control reaches end of non-void function")

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

13 years ago[analyzer] Remove experimental FIXME that never actually applied to the code in trunk.
Jordy Rose [Wed, 24 Aug 2011 22:45:12 +0000 (22:45 +0000)]
[analyzer] Remove experimental FIXME that never actually applied to the code in trunk.

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

13 years ago[analyzer] CFRefReport and friends no longer depend on CFRefCount.
Jordy Rose [Wed, 24 Aug 2011 22:39:09 +0000 (22:39 +0000)]
[analyzer] CFRefReport and friends no longer depend on CFRefCount.

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

13 years agoRemove long-dead FIXME
Douglas Gregor [Wed, 24 Aug 2011 22:09:40 +0000 (22:09 +0000)]
Remove long-dead FIXME

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

13 years ago[analyzer] Do not use references in std::pair.
Anna Zaks [Wed, 24 Aug 2011 21:58:55 +0000 (21:58 +0000)]
[analyzer] Do not use references in std::pair.

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

13 years agoDon't force the complete deserialization of the visible-declarations
Douglas Gregor [Wed, 24 Aug 2011 21:56:08 +0000 (21:56 +0000)]
Don't force the complete deserialization of the visible-declarations
table when serializing an AST file. This was a holdover from the days
before chained PCH, and is a complete waste of time and storage
now. It's a good thing it's useless, because I have no idea how I
would have implemented MaterializeVisibleDecls efficiently in the
presence of modules.

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

13 years ago[analyzer] Unbreak the release buildbot.
Anna Zaks [Wed, 24 Aug 2011 21:40:10 +0000 (21:40 +0000)]
[analyzer] Unbreak the release buildbot.

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

13 years agoIntroduce a depth-first search of modules into the module manager,
Douglas Gregor [Wed, 24 Aug 2011 21:27:34 +0000 (21:27 +0000)]
Introduce a depth-first search of modules into the module manager,
which supports both pre-order and post-order traversal via a visitor
mechanism. Use this depth-first search with a post-order traversal to
give predictable ordering semantics when walking all of the lexical
declarations in the translation unit.

Eventually, module imports will occur in the source code rather than
at the beginning, and we'll have to revisit this walk.

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

13 years agoFollow up to r138470 (Add PNaCl TargetInfo). I've occasionally submitted wrong patch.
Ivan Krasin [Wed, 24 Aug 2011 21:22:25 +0000 (21:22 +0000)]
Follow up to r138470 (Add PNaCl TargetInfo). I've occasionally submitted wrong patch.

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

13 years ago[analyzer] MacOSKeychainAPIChecker: Provide reacher diagnostic trace by pointing...
Anna Zaks [Wed, 24 Aug 2011 20:52:46 +0000 (20:52 +0000)]
[analyzer] MacOSKeychainAPIChecker: Provide reacher diagnostic trace by pointing to the allocation site when reporting a leak.

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

13 years ago[analyzer] Silence an (incorrect) uninitialized variable warning, caught by Cameron.
Jordy Rose [Wed, 24 Aug 2011 20:38:42 +0000 (20:38 +0000)]
[analyzer] Silence an (incorrect) uninitialized variable warning, caught by Cameron.

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

13 years ago[analyzer] Copy GC mode setting from CFRefCount to RetainReleaseChecker in preparatio...
Jordy Rose [Wed, 24 Aug 2011 20:33:55 +0000 (20:33 +0000)]
[analyzer] Copy GC mode setting from CFRefCount to RetainReleaseChecker in preparation for getting rid of CFRefCount.

This is a little hacky for now but will get better once we decide the best way to handle this.

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

13 years agoSilence 'may be used uninitialized' warnings.
Argyrios Kyrtzidis [Wed, 24 Aug 2011 20:33:05 +0000 (20:33 +0000)]
Silence 'may be used uninitialized' warnings.

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

13 years ago[analyzer] Allow checker writes to specify that no region should be accosiated with...
Anna Zaks [Wed, 24 Aug 2011 20:31:06 +0000 (20:31 +0000)]
[analyzer] Allow checker writes to specify that no region should be accosiated with the report. (Useful when we report an error on endOfPath or deadSymbols, when the range of the last expression might have nothing to do with the error.)

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

13 years agoAdd PNaCl TargetInfo.
Ivan Krasin [Wed, 24 Aug 2011 20:22:22 +0000 (20:22 +0000)]
Add PNaCl TargetInfo.

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

13 years ago[analyzer] Remove unused DoNothingByRef and the special case for CFDictionaryCreate.
Jordy Rose [Wed, 24 Aug 2011 19:10:50 +0000 (19:10 +0000)]
[analyzer] Remove unused DoNothingByRef and the special case for CFDictionaryCreate.

This is a very small regression (actually introduced in r138309) because it won't catch leaks of objects passed by reference to CFDictionaryCreate (they're considered to have escaped and are ignored). If this is important we can put in a specific eval::Call to restore the functionality.

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

13 years agoIn the AST reader, switch name lookup within a DeclContect over to the
Douglas Gregor [Wed, 24 Aug 2011 19:03:07 +0000 (19:03 +0000)]
In the AST reader, switch name lookup within a DeclContect over to the
module DAG-based lookup scheme. This required some reshuffling, so
that each module stores its own mapping from DeclContexts to their
lexical and visible sets for those DeclContexts (rather than one big
"chain").

Overall, this allows simple qualified name lookup into the translation
unit to gather results from multiple modules, with the lookup results
in module B shadowing the lookup results in module A when B imports A.

Walking all of the lexical declarations in a module DAG is still a
mess; we'll end up walking the loaded module list backwards, which
works fine for chained PCH but doesn't make sense in a DAG. I'll
tackle this issue as a separate commit.

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

13 years ago[analyzer] Slightly clean up the fix in 138432, so that it doesn't depend on the...
Jordy Rose [Wed, 24 Aug 2011 18:56:32 +0000 (18:56 +0000)]
[analyzer] Slightly clean up the fix in 138432, so that it doesn't depend on the relative ordering of path-sensitive and path-insensitive checks. Still not ideal, but I think a real fix would require infrastructure that doesn't exist yet.

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

13 years agoThread safety: Fix a few typos in last commit -- use LockID instead of Lock in commen...
Caitlin Sadowski [Wed, 24 Aug 2011 18:46:20 +0000 (18:46 +0000)]
Thread safety: Fix a few typos in last commit -- use LockID instead of Lock in comments and start a couple methods with a lowercase letter

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

13 years agoMatch LLVM change: TargetRegistry and TargetSelect have been moved to Support.
Evan Cheng [Wed, 24 Aug 2011 18:09:14 +0000 (18:09 +0000)]
Match LLVM change: TargetRegistry and TargetSelect have been moved to Support.

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

13 years agoReset FirstID (first diagnostic's file ID) to allow for invocations of the VerifyDiag...
Axel Naumann [Wed, 24 Aug 2011 13:36:19 +0000 (13:36 +0000)]
Reset FirstID (first diagnostic's file ID) to allow for invocations of the VerifyDiagnosticsClient on several input files.

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

13 years ago[analyzer] Fix a Heisenbug concerning object lifetimes with a hack. Hopefully a bette...
Jordy Rose [Wed, 24 Aug 2011 09:27:24 +0000 (09:27 +0000)]
[analyzer] Fix a Heisenbug concerning object lifetimes with a hack. Hopefully a better fix coming soon. See comment for more details.

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

13 years ago[analyzer] Reapply 138390 "Clean up unused bits of CFRefCount", reverted in 138405...
Jordy Rose [Wed, 24 Aug 2011 09:22:31 +0000 (09:22 +0000)]
[analyzer] Reapply 138390 "Clean up unused bits of CFRefCount", reverted in 138405. Ended up unrelated to any problems.

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

13 years ago[analyzer] Fix potential crasher with RAII. No functionality change. (No test because...
Jordy Rose [Wed, 24 Aug 2011 09:02:37 +0000 (09:02 +0000)]
[analyzer] Fix potential crasher with RAII. No functionality change. (No test because this particular circumstance requires an impossible series of events, but this is future-proofing.)

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

13 years ago[analyzer] Reapply 138382 and 138388 (reverted in 138419 and 138420). The issue seems...
Jordy Rose [Wed, 24 Aug 2011 05:47:39 +0000 (05:47 +0000)]
[analyzer] Reapply 138382 and 138388 (reverted in 138419 and 138420). The issue seems to have been with the uninitialized variable fixed in 138424; a fix for another Heisencrasher coming soon.

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

13 years ago[analyzer] Correctly initialize a variable and hopefully fix crashes.
Jordy Rose [Wed, 24 Aug 2011 04:48:19 +0000 (04:48 +0000)]
[analyzer] Correctly initialize a variable and hopefully fix crashes.

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

13 years agoAdd testcase for r138411
Bruno Cardoso Lopes [Wed, 24 Aug 2011 01:35:04 +0000 (01:35 +0000)]
Add testcase for r138411

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

13 years agoRevert "[analyzer] Cleanup: Move temporary declarations of CFRefCount variables close...
Eric Christopher [Wed, 24 Aug 2011 00:39:51 +0000 (00:39 +0000)]
Revert "[analyzer] Cleanup: Move temporary declarations of CFRefCount variables closer to their uses. No functionality change."

This reverts commit d02b4af7bd6ca4a743c7074d64e205d718aa221d.

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

13 years agoRevert "[analyzer] Make CFRefBug and CFRefReportVisitor not dependent on CFRefCount...
Eric Christopher [Wed, 24 Aug 2011 00:39:48 +0000 (00:39 +0000)]
Revert "[analyzer] Make CFRefBug and CFRefReportVisitor not dependent on CFRefCount. Unfortunately, CFRefReport still is. No functionality change."

This reverts commit e3fb7e428b7ba0d5d902dfe3f165d70e09b03a15.

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

13 years agoMake constant aggregate constant initializers private linkage.
Eric Christopher [Wed, 24 Aug 2011 00:33:55 +0000 (00:33 +0000)]
Make constant aggregate constant initializers private linkage.
After talking with John making this the case for all of these is
the right way to go.

Fixes rdar://9804564 and PR10414

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

13 years ago[analyzer] MacOSKeychainAPIChecker: Add reasoning about functions which MIGHT dealloc...
Anna Zaks [Wed, 24 Aug 2011 00:06:27 +0000 (00:06 +0000)]
[analyzer] MacOSKeychainAPIChecker: Add reasoning about functions which MIGHT deallocate the memory region allocated with SecKeychain APIs. Specifically, when the buffer is passed to CFStringCreateWithBytesNoCopy along with a custom deallocator, which might potentially correctly release the memory.

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

13 years ago[analyzer] MacOSKeychainAPIChecker: Retrieve the memory region which we are tracking...
Anna Zaks [Tue, 23 Aug 2011 23:56:12 +0000 (23:56 +0000)]
[analyzer] MacOSKeychainAPIChecker: Retrieve the memory region which we are tracking even when it's no longer a SymbolicRegion, for example, when it is cast to char*.

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

13 years agoMove creation of the deallocation mismatch report into a separate function for future...
Anna Zaks [Tue, 23 Aug 2011 23:47:36 +0000 (23:47 +0000)]
Move creation of the deallocation mismatch report into a separate function for future reuse.

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

13 years agoWhitespace and 80-col cleanup.
Eric Christopher [Tue, 23 Aug 2011 23:44:09 +0000 (23:44 +0000)]
Whitespace and 80-col cleanup.

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

13 years agoobjc - fix up the builtin type for objc_assign_ivar.
Fariborz Jahanian [Tue, 23 Aug 2011 23:33:09 +0000 (23:33 +0000)]
objc - fix up the builtin type for objc_assign_ivar.
// rdar://9362887.

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

13 years agoFix _mm256_shuffle_ps mask! Example, for mask=203, Instead of:
Bruno Cardoso Lopes [Tue, 23 Aug 2011 23:29:45 +0000 (23:29 +0000)]
Fix _mm256_shuffle_ps mask! Example, for mask=203, Instead of:
  <i32 3, i32 2, i32 8, i32 11, i32 3, i32 6, i32 12, i32 15>
generate:
  <i32 3, i32 2, i32 8, i32 11, i32 7, i32 6, i32 12, i32 15>

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

13 years agoStart reworking -Wunreachable-code. The original analysis had serious flaws with...
Ted Kremenek [Tue, 23 Aug 2011 23:05:11 +0000 (23:05 +0000)]
Start reworking -Wunreachable-code.  The original analysis had serious flaws with how it
handled SCC's of dead code, or simply having false negatives by overly suppressing warnings.

WIP.

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

13 years agoCFG: record set of C++ 'try' dispatch blocks, which could be of interest to various...
Ted Kremenek [Tue, 23 Aug 2011 23:05:07 +0000 (23:05 +0000)]
CFG: record set of C++ 'try' dispatch blocks, which could be of interest to various analyses (e.g., reachability).

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

13 years agoConstify the result of CFGStmt::getStmt().
Ted Kremenek [Tue, 23 Aug 2011 23:05:04 +0000 (23:05 +0000)]
Constify the result of CFGStmt::getStmt().

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

13 years agoAdd 'const' version of CompoundStmt::children().
Ted Kremenek [Tue, 23 Aug 2011 23:05:01 +0000 (23:05 +0000)]
Add 'const' version of CompoundStmt::children().

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

13 years agoRevert "[analyzer] Clean up unused bits of CFRefCount."
Eric Christopher [Tue, 23 Aug 2011 22:38:04 +0000 (22:38 +0000)]
Revert "[analyzer] Clean up unused bits of CFRefCount."

This reverts commit 6886a92640f5bffc972f67c0a1f302d6c6e7c322.

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

13 years agoWhitespace.
Eric Christopher [Tue, 23 Aug 2011 22:38:00 +0000 (22:38 +0000)]
Whitespace.

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

13 years agoRefactor and fix checking for initialization of flexible array members. The old...
Eli Friedman [Tue, 23 Aug 2011 22:24:57 +0000 (22:24 +0000)]
Refactor and fix checking for initialization of flexible array members.  The old version had the checks scattered across the code, missed some checks, and had a couple nasty bugs in existing checks.

Fixes PR10648 and another similar accepts-invalid bug.

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

13 years ago[analyzer] Clean up unused bits of CFRefCount.
Jordy Rose [Tue, 23 Aug 2011 21:51:36 +0000 (21:51 +0000)]
[analyzer] Clean up unused bits of CFRefCount.

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

13 years agoRight now this requires asserts.
Eric Christopher [Tue, 23 Aug 2011 21:47:58 +0000 (21:47 +0000)]
Right now this requires asserts.

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

13 years ago[analyzer] Make CFRefBug and CFRefReportVisitor not dependent on CFRefCount. Unfortun...
Jordy Rose [Tue, 23 Aug 2011 21:47:17 +0000 (21:47 +0000)]
[analyzer] Make CFRefBug and CFRefReportVisitor not dependent on CFRefCount. Unfortunately, CFRefReport still is. No functionality change.

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

13 years ago[analyzer] Cleanup: Move temporary declarations of CFRefCount variables closer to...
Jordy Rose [Tue, 23 Aug 2011 21:06:32 +0000 (21:06 +0000)]
[analyzer] Cleanup: Move temporary declarations of CFRefCount variables closer to their uses. No functionality change.

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

13 years agoRemove one SourceManager::isInFileID overload and use isOffsetInFileID for the other.
Argyrios Kyrtzidis [Tue, 23 Aug 2011 21:02:45 +0000 (21:02 +0000)]
Remove one SourceManager::isInFileID overload and use isOffsetInFileID for the other.

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

13 years agoAmend r138129 (reduction of SLocEntries) which introduced performance regression due
Argyrios Kyrtzidis [Tue, 23 Aug 2011 21:02:41 +0000 (21:02 +0000)]
Amend r138129 (reduction of SLocEntries) which introduced performance regression due
to increased calls to SourceManager::getFileID. (rdar://9992664)

Use a slightly different approach that is more efficient both in terms of speed
(no extra getFileID calls) and in SLocEntries reduction.

Comparing pre-r138129 and this patch we get:

For compiling SemaExpr.cpp reduction of SLocEntries by 26%.
For the boost enum library:
  -SLocEntries -34% (note that this was -5% for r138129)
  -Memory consumption -50%
  -PCH size -31%

Reduced SLocEntries also benefit the hot function SourceManager::getFileID,
evident by the reduced "FileID scans".

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

13 years agoIntroduce SourceManager::isInSLocAddrSpace and use it in TokenLexer instead of isInFileID
Argyrios Kyrtzidis [Tue, 23 Aug 2011 21:02:38 +0000 (21:02 +0000)]
Introduce SourceManager::isInSLocAddrSpace and use it in TokenLexer instead of isInFileID
since it is a bit more efficient.

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

13 years agoRename SourceManager::isBeforeInSourceLocationOffset -> isBeforeInSLocAddrSpace.
Argyrios Kyrtzidis [Tue, 23 Aug 2011 21:02:35 +0000 (21:02 +0000)]
Rename SourceManager::isBeforeInSourceLocationOffset -> isBeforeInSLocAddrSpace.

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

13 years agoTokenLexer::getExpansionLocForMacroDefLoc doesn't need to return an invalid SourceLoc...
Argyrios Kyrtzidis [Tue, 23 Aug 2011 21:02:32 +0000 (21:02 +0000)]
TokenLexer::getExpansionLocForMacroDefLoc doesn't need to return an invalid SourceLocation.

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

13 years agoIn Lexer::isAtEndOfMacroExpansion use SourceManager::isInFileID and avoid
Argyrios Kyrtzidis [Tue, 23 Aug 2011 21:02:30 +0000 (21:02 +0000)]
In Lexer::isAtEndOfMacroExpansion use SourceManager::isInFileID and avoid
the extra SourceManager::getFileID call.

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

13 years agoMove a couple of SourceManager functions out-of-line; no functionality change.
Argyrios Kyrtzidis [Tue, 23 Aug 2011 21:02:28 +0000 (21:02 +0000)]
Move a couple of SourceManager functions out-of-line; no functionality change.

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

13 years ago[analyzer] Move function retain-count effect summary log from CFRefCount to RetainRel...
Jordy Rose [Tue, 23 Aug 2011 20:55:48 +0000 (20:55 +0000)]
[analyzer] Move function retain-count effect summary log from CFRefCount to RetainReleaseChecker, and then explicitly provide the summary log when creating CFRefReports. No functionality change.

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

13 years agoFix regression in -Wuninitialized involving VLAs. It turns out that we were modeling...
Ted Kremenek [Tue, 23 Aug 2011 20:30:50 +0000 (20:30 +0000)]
Fix regression in -Wuninitialized involving VLAs.  It turns out that we were modeling sizeof(VLAs)
incorrectly in the CFG, and also the static analyzer.  This patch regresses the analyzer a bit, but
that needs to be followed up with a better solution.

Fixes <rdar://problem/10008112>.

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

13 years ago[analyzer] Move helper method Update from CFRefCount to RetainReleaseChecker. No...
Jordy Rose [Tue, 23 Aug 2011 20:27:16 +0000 (20:27 +0000)]
[analyzer] Move helper method Update from CFRefCount to RetainReleaseChecker. No functionality change.

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

13 years agoCleanup to use helper.
Eli Friedman [Tue, 23 Aug 2011 20:22:34 +0000 (20:22 +0000)]
Cleanup to use helper.

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

13 years agoRemove function parameter which always used the default value.
Eli Friedman [Tue, 23 Aug 2011 20:17:13 +0000 (20:17 +0000)]
Remove function parameter which always used the default value.

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

13 years ago[analyzer] Move helper method handleAutoreleaseCounts from CFRefCount to RetainReleas...
Jordy Rose [Tue, 23 Aug 2011 20:07:14 +0000 (20:07 +0000)]
[analyzer] Move helper method handleAutoreleaseCounts from CFRefCount to RetainReleaseChecker. No functionality change.

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

13 years ago[analyzer] Move ReturnStmt retain-count analysis from CFRefCount to RetainReleaseChec...
Jordy Rose [Tue, 23 Aug 2011 19:43:16 +0000 (19:43 +0000)]
[analyzer] Move ReturnStmt retain-count analysis from CFRefCount to RetainReleaseChecker. Tweak CFRefReport to reflect that fact that ReturnStmt checks are pre-statement, not post-statement.  No intended functionality change.

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

13 years ago[analyzer] Move symbol death leak analysis from CFRefCount to RetainReleaseChecker.
Jordy Rose [Tue, 23 Aug 2011 19:01:07 +0000 (19:01 +0000)]
[analyzer] Move symbol death leak analysis from CFRefCount to RetainReleaseChecker.

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

13 years agoThread-safety analysis: adding in a basic lockset tracking system. This
Caitlin Sadowski [Tue, 23 Aug 2011 18:46:34 +0000 (18:46 +0000)]
Thread-safety analysis: adding in a basic lockset tracking system. This
system flags an error when unlocking a lock which was not held, locking
the same lock twice, having a different lockset on each iteration of a
loop, or going out of scope while still holding a lock. In order to
successfully use the lockset, this patch also makes sure that attribute
arguments are attached correctly for later parsing.

This patch was also worked on by DeLesley Hutchins.

Note: This patch has been reviewed by Chandler Carruth and Jeffrey
Yasskin. Feel free to provide post-commit review comments for a
subsequent patch.

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

13 years agoAdd support for a verifier to the driver. Currently only verifies debug
Eric Christopher [Tue, 23 Aug 2011 17:56:55 +0000 (17:56 +0000)]
Add support for a verifier to the driver. Currently only verifies debug
output on darwin so is hard coded there.

As a note this will need a little bit of refactoring in the class
hierarchy to separate it out for different verifiers based on input type.

Fixes rdar://8256258.

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

13 years agochecking for __block variable captured by given
Fariborz Jahanian [Tue, 23 Aug 2011 16:47:15 +0000 (16:47 +0000)]
checking for __block variable captured by given
stmt expression, recursively walk down all substatements
of the stmt expression. // rdar://10001085

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

13 years agoenable -fstack-protector on 10.5 for usermode binaries by default.
Nico Weber [Tue, 23 Aug 2011 07:38:27 +0000 (07:38 +0000)]
enable -fstack-protector on 10.5 for usermode binaries by default.

This matches gcc's behavior.

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

13 years ago[analyzer] Only allocate retain summaries for interesting functions/messages. This...
Jordy Rose [Tue, 23 Aug 2011 04:27:15 +0000 (04:27 +0000)]
[analyzer] Only allocate retain summaries for interesting functions/messages. This is a minor saving of memory but doesn't seem to cost any performance.

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

13 years agoFix an incorrect note.
Matt Beaumont-Gay [Tue, 23 Aug 2011 01:35:51 +0000 (01:35 +0000)]
Fix an incorrect note.

For the test case added to function-redecl.cpp, we were previously complaining
about a mismatch in the parameter types, since the definition used the
typedef'd type.

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

13 years agoblock IRgen - Fixes a crash when determining if given block variable
Fariborz Jahanian [Tue, 23 Aug 2011 00:27:49 +0000 (00:27 +0000)]
block IRgen - Fixes a crash when determining if given block variable
is captured by a given statement expression. // rdar://10001085

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

13 years ago[analyzer] Rename CFRefCount's evalSummary method to evalCallOrMessage, since it...
Jordy Rose [Tue, 23 Aug 2011 00:03:01 +0000 (00:03 +0000)]
[analyzer] Rename CFRefCount's evalSummary method to evalCallOrMessage, since it no longer, uh, evaluates call summaries.

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

13 years agoMake sure we don't inline functions marked with __attribute__((naked)). <rdar:/...
Eli Friedman [Mon, 22 Aug 2011 23:55:33 +0000 (23:55 +0000)]
Make sure we don't inline functions marked with __attribute__((naked)).  <rdar://problem/9973228>

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

13 years ago[analyzer] Migrate the handling of retain-count-related RetEffects and ArgEffects...
Jordy Rose [Mon, 22 Aug 2011 23:48:23 +0000 (23:48 +0000)]
[analyzer] Migrate the handling of retain-count-related RetEffects and ArgEffects from CFRefCount to RetainReleaseChecker. No intended functionality change.

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