Commit Graph

32001 Commits

Author SHA1 Message Date
Fariborz Jahanian 797f1e23f6 checking for __block variable captured by given
stmt expression, recursively walk down all substatements 
of the stmt expression. // rdar://10001085

llvm-svn: 138334
2011-08-23 16:47:15 +00:00
Nico Weber dd47363b3a enable -fstack-protector on 10.5 for usermode binaries by default.
This matches gcc's behavior.

llvm-svn: 138324
2011-08-23 07:38:27 +00:00
Jordy Rose 212e459164 [analyzer] Only allocate retain summaries for interesting functions/messages. This is a minor saving of memory but doesn't seem to cost any performance.
llvm-svn: 138320
2011-08-23 04:27:15 +00:00
Matt Beaumont-Gay 56381b8502 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.

llvm-svn: 138318
2011-08-23 01:35:51 +00:00
Fariborz Jahanian b50801f049 block IRgen - Fixes a crash when determining if given block variable
is captured by a given statement expression. // rdar://10001085

llvm-svn: 138314
2011-08-23 00:27:49 +00:00
Jordy Rose f5b0234992 [analyzer] Rename CFRefCount's evalSummary method to evalCallOrMessage, since it no longer, uh, evaluates call summaries.
llvm-svn: 138313
2011-08-23 00:03:01 +00:00
Eli Friedman c55efe4fb2 Make sure we don't inline functions marked with __attribute__((naked)). <rdar://problem/9973228>
llvm-svn: 138310
2011-08-22 23:55:33 +00:00
Jordy Rose 5b31d7acf7 [analyzer] Migrate the handling of retain-count-related RetEffects and ArgEffects from CFRefCount to RetainReleaseChecker. No intended functionality change.
llvm-svn: 138309
2011-08-22 23:48:23 +00:00
Anna Zaks bd7972b49e [analyzer] MacOSKeychainAPIChecker: Users of KeyChain API often use free() to deallocate the password. Catch this error explicitly and generate the error message at the place where free() is called.
llvm-svn: 138296
2011-08-22 23:18:12 +00:00
Fariborz Jahanian b66de9f37b objc refactoring - minor clean up.
llvm-svn: 138276
2011-08-22 21:44:58 +00:00
Anna Zaks 76c3fb6a51 Static Analyzer Diagnostics: Allow checkers to add ExtraDescriptiveText, now renamed into ExtraText, to the diagnostic without subclassing BugReport.
llvm-svn: 138272
2011-08-22 20:31:28 +00:00
Fariborz Jahanian a646084550 objc - use existing API for temporary switch of
objc's decl context.

llvm-svn: 138267
2011-08-22 20:15:24 +00:00
Ted Kremenek 618e574253 Do not perform check for missing '[super dealloc]' under ARC as calling -dealloc is illegal in that mode.
llvm-svn: 138261
2011-08-22 19:07:43 +00:00
Anna Zaks 752de1443f Clean up the CFRefBugReport - remove the members, which got moved to the CFRefReportVisitors.
llvm-svn: 138259
2011-08-22 18:54:07 +00:00
Eli Friedman 4acfbcd918 Don't warn on varaidic macros in C++0x mode.
llvm-svn: 138257
2011-08-22 18:48:28 +00:00
Fariborz Jahanian f36734dd2a objc - minor comment fix up and cleanup.
llvm-svn: 138253
2011-08-22 18:34:22 +00:00
Fariborz Jahanian 4bf8262a43 objc - Simplify switing objc decl context by using
a context switching object.

llvm-svn: 138248
2011-08-22 17:59:19 +00:00
Nico Weber 715abaf213 Warn on missing [super dealloc] calls.
This matches gcc's logic. Half of PR10661.

llvm-svn: 138240
2011-08-22 17:25:57 +00:00
Chandler Carruth 41c6dcc734 Fix a crash-on-valid that has been here for a very long time:
const int &x = x;

This crashed by inifinetly recursing within the lvalue evaluation
routine. I've added a (somewhat) braindead way of preventing this
recursion. If folks have better suggestions for how to avoid it I'm all
ears.

That said, we have some work to do. This doesn't trigger a single
warning for uninitialized, self-initialized or otherwise completely
wrong code. In some senses, the crash was almost better.

llvm-svn: 138239
2011-08-22 17:24:56 +00:00
Fariborz Jahanian 899c365257 objc- checking for objc decl context range is unreliable and
subject to change. Check for equality instead.

llvm-svn: 138238
2011-08-22 17:13:51 +00:00
Argyrios Kyrtzidis c7e50c5cbd Fix a bug in objc @encoding of C++ classes.
llvm-svn: 138235
2011-08-22 16:03:14 +00:00
Fariborz Jahanian 8d382dc781 Restore patch I reversed in r138040. Known buildbot
failures are resolved.

llvm-svn: 138234
2011-08-22 15:54:49 +00:00
Zhongxing Xu aec683afec Fix typo.
llvm-svn: 138227
2011-08-22 02:05:13 +00:00
Argyrios Kyrtzidis 8d32f754b8 Fix gcc build.
llvm-svn: 138226
2011-08-21 23:49:52 +00:00
Argyrios Kyrtzidis 61ef3db222 Boost the efficiency of SourceManager::getMacroArgExpandedLocation.
Currently getMacroArgExpandedLocation is very inefficient and for the case
of a location pointing at the main file it will end up checking almost all of
the SLocEntries. Make it faster:

-Use a map of macro argument chunks to their expanded source location. The map
 is for a single source file, it's stored in the file's ContentCache and lazily
 computed, like the source lines cache.
-In SLocEntry's FileInfo add an 'unsigned NumCreatedFIDs' field that keeps track
 of the number of FileIDs (files and macros) that were created during preprocessing
 of that particular file SLocEntry. This is useful when computing the macro argument
 map in skipping included files while scanning for macro arg FileIDs that lexed from
 a specific source file. Due to padding, the new field does not increase the size
 of SLocEntry.

llvm-svn: 138225
2011-08-21 23:33:04 +00:00
Jordy Rose 898a148d28 [analyzer] Migrate the aliasing effects of CFRetain and CFMakeCollectable from CFRefCount to RetainReleaseChecker. No intended functionality change.
llvm-svn: 138223
2011-08-21 21:58:18 +00:00
Jordy Rose 6582dde545 [analyzer] Remove FIXME; Ted reminded me that -init is not guaranteed to return its receiver and pretending that it does won't actually buy us anything. (Comment change only.)
llvm-svn: 138221
2011-08-21 21:04:38 +00:00
Jordy Rose 3f7f7568f2 [analyzer] Migrate return value handling from CFRefCount to ExprEngine. This seems to result in a minor performance hit, but I think that will go away again once we eliminate TransferFuncs from function calls entirely.
llvm-svn: 138220
2011-08-21 19:41:36 +00:00
Jordy Rose 82c673de33 [analyzer] Replace calls to getNameAsString() with StringRef equivalents.
llvm-svn: 138215
2011-08-21 05:25:15 +00:00
Benjamin Kramer 3cca223a2a Fix compile on platforms that don't implicitly include stdarg.h here.
llvm-svn: 138214
2011-08-20 21:50:41 +00:00
Jordy Rose a8f99ba749 [analyzer] RetainReleaseChecker always wants region change updates. There's no need for a flag, at least not right now.
llvm-svn: 138212
2011-08-20 21:17:59 +00:00
Jordy Rose 5c252ef7b1 Fix indentation.
llvm-svn: 138211
2011-08-20 21:16:58 +00:00
Jordy Rose 5a3c9ff3a3 [analyzer] Move handling of hardcoded noreturn ("panic") methods from CFRefCount to NoReturnFunctionChecker. No functionality change intended.
llvm-svn: 138210
2011-08-20 20:55:40 +00:00
NAKAMURA Takumi fbd46b0736 test/lit.cfg: Enable "crash-recovery" tests on Win32 hosts. CrashRecoveryContext supports Win32 since r138199.
FIXME: Shall we eliminate the feature "crash-recovery"?
llvm-svn: 138201
2011-08-20 07:09:20 +00:00
Chad Rosier aa9e24133f Typo spotted by Ivan Krasin.
llvm-svn: 138200
2011-08-20 06:56:17 +00:00
Chandler Carruth 4e6bd3955f Remove this test. It requires C++ standard library headers, which we'd
like to avoid within the Clang test suite, it doesn't verify the output
at all so it only servers as a test that Clang doesn't crash, and
finally all it does is declare a function that returns a vector and call
it. Probably the biggest thing being tested here is Clang's parsing of
the vector template, and we have lots of good template parsing tests. We
don't need another in codegen.

llvm-svn: 138197
2011-08-20 06:30:57 +00:00
Ted Kremenek 60d2ec5765 [analyzer] Handle reads of ObjCPropertyRefExprs implicitly in Environment. No need to bind an explicit value and create a new node.
llvm-svn: 138196
2011-08-20 06:23:25 +00:00
Ted Kremenek 876e34b7b5 [analyzer] Simplify ExprEngine::VisitBinaryOperator() by removing recursive visit to subexpressions (which is no longer needed).
llvm-svn: 138195
2011-08-20 06:16:31 +00:00
Ted Kremenek a9ce612fa2 Start partitioning ExprEngine.cpp into separate .cpp files that handle different parts
of the analysis (e.g., analysis of C expressions, analysis of Objective-C expressions, and so on).

llvm-svn: 138194
2011-08-20 06:00:03 +00:00
Ted Kremenek 10e2503177 Rename CXXExprEngine.cpp to ExprEngineCXX.cpp.
llvm-svn: 138193
2011-08-20 05:59:58 +00:00
NAKAMURA Takumi d0dc49e640 test/CodeGenCXX/2003-11-25-ReturningOpaqueByValue.cpp: Mark XFAIL: win32.
FIXME: Avoid using system headers. clang cannot handle MS <vector> yet.
llvm-svn: 138190
2011-08-20 05:38:29 +00:00
Douglas Gregor b36fc536d2 Make the loading of multiple records for the same identifier (from
different modules) more robust. It already handled (simple) merges of
the set of declarations attached to that identifier, so add a test
case that shows us getting two different declarations for the same
identifier (one struct, one function) from different modules, and are
able to use both of them.

llvm-svn: 138189
2011-08-20 05:09:43 +00:00
Douglas Gregor 18221d8eae Clean out some minor cruft in the AST reader; no functionality change.
llvm-svn: 138188
2011-08-20 04:58:43 +00:00
Douglas Gregor ab443b9da5 Introduce a module visitation function that starts at the top-level
modules (those that no other module depends on) and performs a search
over all of the modules, visiting a new module only when all of the
modules that depend on it have already been visited. The visitor can
abort the search for all modules that a module depends on, which
allows us to minimize the number of lookups necessary when performing
a search.

Switch identifier lookup from a linear walk over the set of modules to
this module visitation operation. The behavior is the same for simple
PCH and chained PCH, but provides the proper search order for
modules. Verified with printf debugging, since we don't have enough in
place to actually test this.

llvm-svn: 138187
2011-08-20 04:39:52 +00:00
Anna Zaks 88255cc533 Static Analyzer Diagnostics: Move the responsibility for generating the endOfPath diagnostic piece from BugReport to BugReporterVisitor. Switch CFRefCount to use visitors in order to generate the endOfPath piece.
llvm-svn: 138184
2011-08-20 01:27:22 +00:00
Ted Kremenek 417d566775 Remove dead code.
llvm-svn: 138183
2011-08-20 01:15:28 +00:00
Eric Christopher e480b1ef3d Remove XFAIL/XTARGET since this is passing on the other bots.
llvm-svn: 138182
2011-08-20 01:08:46 +00:00
Eric Christopher b4da65e631 Migrate, update and FileCheckize:
2010-02-01-utf16-with-null.m
	 2010-02-23-DbgInheritance.m
	 2010-03-17-StructRef.m
	 2011-03-08-IVarLookup.m

from llvm/test/FrontendObjC.

llvm-svn: 138180
2011-08-20 01:04:49 +00:00
Eric Christopher 19de6c75fd Migrate, update and FileCheckize:
2008-11-25-Blocks.m
2009-01-26-WriteBarrier-2.m
2009-02-05-VolatileProp.m
2009-08-05-utf16.m

from llvm/test/FrontendObjC.

llvm-svn: 138175
2011-08-20 00:49:25 +00:00
Eric Christopher fde9786b44 Migrate, FileCheckize and update:
2007-04-03-ObjcEH.m
2007-05-02-Strong.m
2007-10-18-ProDescriptor.m
2007-10-23-GC-WriteBarrier.m
2008-10-3-EhValue.m
2008-11-12-Metadata.m
2008-11-24-ConstCFStrings.m

from llvm/test/FrontendObjC.

llvm-svn: 138172
2011-08-20 00:37:56 +00:00