Commit Graph

15841 Commits

Author SHA1 Message Date
Douglas Gregor 54e5b13a27 Add proper type-source information to UnaryTypeTraitExpr, including
libclang visitation.

llvm-svn: 113492
2010-09-09 16:14:44 +00:00
Douglas Gregor c9199f522f Clean up CMake dependencies
llvm-svn: 113489
2010-09-09 15:44:58 +00:00
Benjamin Kramer d4b4b7e8a1 Remove unused variable.
llvm-svn: 113482
2010-09-09 12:27:34 +00:00
Argyrios Kyrtzidis e262a9558e Fix C++ PCH issue.
Another beating by boost in this test case: http://llvm.org/PR8117
A function specialization wasn't properly initialized if it wasn't canonical.

I wish there was a nice little test case but this was boost.

llvm-svn: 113481
2010-09-09 11:28:23 +00:00
Gabor Greif 230ddf37af do not bind temporaries to non-const references
this fixes all analyser test failures in my gcc34-based
environment

how the cast result could bind to the non-const ref is
somewhat mysterious and remains to be investigated; to
avoid similar miscompilations (by gcc34 only?)

llvm-svn: 113480
2010-09-09 10:51:37 +00:00
Ted Kremenek 5f256da834 Rename GRState::getSVal() -> getRawSVal() and getSimplifiedSVal() -> getSVal().
The end result is now we eagarly constant-fold symbols in the analyzer that are perfectly constrained
to be a constant value.  This allows us to recover some path-sensitivity in some cases by lowering
the required level of reasoning power needed to evaluate some expressions.

The net win from this change is that the false positive in PR 8015 is fixed, and we also
find more idempotent operations bugs.

We do, however, regress with the BugReporterVisitors, which need to be modified to understand
this constant folding (and look past it).  This causes some diagnostic regressions in plist-output.m
which will get addressed in a future patch.  plist-output.m is now marked XFAIL, while
plist-output-alternate.m now tests that the plist output is working, but with the suboptimal
diagnostics.  This second test file will eventually be removed.

llvm-svn: 113477
2010-09-09 07:13:00 +00:00
Ted Kremenek 02627a22cf Fix indentation.
llvm-svn: 113476
2010-09-09 06:53:59 +00:00
Ted Kremenek b8176da314 Check format strings when a called function has more than one FormatAttr (one for 'scanf' and one for 'printf'). Fixes <rdar://problem/8409437>.
llvm-svn: 113472
2010-09-09 04:33:05 +00:00
Ted Kremenek 1520dae606 It appears that technically a null format string is not warned under -Wformat-nonliteral, as
the function processing the format string can decided whether or not to accept a null format string (e.g., asl_log).  Fixes <rdar://problem/8269537>.

llvm-svn: 113469
2010-09-09 03:51:42 +00:00
Ted Kremenek 808829351e Avoid redundant recursive calls in SemaCheckStringLiteral by just updating the expression
and trying again.

llvm-svn: 113468
2010-09-09 03:51:39 +00:00
Ted Kremenek bc5860b652 Remove tabs I accidentally introduced.
llvm-svn: 113467
2010-09-09 02:57:51 +00:00
Ted Kremenek f146cd1fa3 Remove stray ';' and convert tabs to spaces.
llvm-svn: 113466
2010-09-09 02:57:48 +00:00
Tom Care 68df12f0c4 Simplified reachability checking in IdempotentOperationChecker and added a helper function for path display.
- Created private class CFGReachabilityAnalysis, which provides cached reachability lookups in the CFG
- Simplified PathWasCompletelyAnalyzed to use the new reachability class
- Added getLastRelevantNodes function for future use with path displaying in BugReporter

llvm-svn: 113465
2010-09-09 02:04:52 +00:00
Ted Kremenek 0f107e4386 Relax __attribute_((nonnull)) checking to allow the attribute on functions with no pointer arguments. GCC doesn't warn
in this case, and the attribute is trivially satisfied (and benign).  Fixes <rdar://problem/8364828>.

llvm-svn: 113464
2010-09-09 01:17:32 +00:00
Ted Kremenek 8f0e834c4c Static analyzer fix: <rdar://problem/5880430> Switch on enum should not consider default case live if all enum values are covered
llvm-svn: 113457
2010-09-09 00:40:40 +00:00
Fariborz Jahanian cfddabf5a3 Block ivar layout must assume that the 'isa'
field of the block descriptor is GC'able (scanned)
as this what the runtime expects (one can send it 
messages). Radar 8394947.

llvm-svn: 113454
2010-09-09 00:21:45 +00:00
Ted Kremenek f2b0a1bfa0 Enhance -Wunreachable-code to not consider the 'default:' branch of a switch statement live if a switch on an enum value has
explicit 'case:' statements for each enum value.

llvm-svn: 113451
2010-09-09 00:06:10 +00:00
Ted Kremenek 50205744c3 Enhance -Wreturn-type to not warn when control-flow is most likely limited by a switch statement explicitly covering
all the cases for an enum value.

llvm-svn: 113450
2010-09-09 00:06:07 +00:00
Ted Kremenek b037185b52 Add 'filtered_pred_iterator' and 'filtered_succ_iterator' to CFGBlock. This allows a client
to selectively walk successors/predecessors based on commonly used filters.  For starters, add
a filter to ignore 'default:' cases for SwitchStmts when all enum values are covered by CaseStmts.

llvm-svn: 113449
2010-09-09 00:06:04 +00:00
Ted Kremenek fd525ef338 Initialize 'AllEnumCasesCovered' in SwitchStmt's constructor.
llvm-svn: 113448
2010-09-09 00:06:01 +00:00
Ted Kremenek c42f345157 When building SwitchStmts in Sema, record whether all the enum values of a switch(enum) where
covered by individual case statements.  Flow-based analyses may wish to consult this information,
and recording this in the AST allows us to obviate reconstructing this information later when
we build the CFG.

llvm-svn: 113447
2010-09-09 00:05:53 +00:00
Douglas Gregor a5614c5fe8 Push the range associated with a nested-name-specifier further through
TreeTransform, since we were getting an empty source range where we
shouldn't. Sadly, the test case is Boost.Proto, and isn't worth
reducing.

llvm-svn: 113446
2010-09-08 23:56:00 +00:00
Francois Pichet 5cc0a67f08 Fix warnings caused by new CXXUuidofExprClass enumerator.
llvm-svn: 113444
2010-09-08 23:47:05 +00:00
Daniel Dunbar c6f6df088f Add another missing CMake dependency.
llvm-svn: 113443
2010-09-08 23:40:30 +00:00
Douglas Gregor 4c7c109eec Fix a few minor issues with parsing and semantic analysis of C++
typeid expressions: 
  - make sure we have a proper source location for the closing ')'
  - cache the declaration of std::type_info once we've found it

llvm-svn: 113441
2010-09-08 23:14:30 +00:00
Douglas Gregor 67da50e18d When providing a completion for a function/method parameter of block
pointer type, actually provide a usable block literal expression.

llvm-svn: 113431
2010-09-08 22:47:51 +00:00
Argyrios Kyrtzidis e177863afc Decl::CheckAccessDeclContext() keeps asserting. Access is not set in some cases.
llvm-svn: 113419
2010-09-08 21:58:42 +00:00
Douglas Gregor b2f0713ddc Clean up some of the CMake dependencies
llvm-svn: 113416
2010-09-08 21:40:53 +00:00
Douglas Gregor 8ec5173f9a Use the new-initialization code for initializing scalars with a
function-style cast. Previously, we had a (redundant, incorrect)
semantic-checking path for non-class types, which allowed
value-initialization of a reference type and then crashed.

llvm-svn: 113415
2010-09-08 21:40:08 +00:00
Fariborz Jahanian db45278cbd Reverse r113397 until we decide what to do with
use of 'struct objc_object*' for 'is' (and others)
in clang.

llvm-svn: 113414
2010-09-08 21:36:35 +00:00
Argyrios Kyrtzidis 260b4a8e92 Re-enable CheckAccessDeclContext and make sure it doesn't trigger assertions.
llvm-svn: 113413
2010-09-08 21:32:35 +00:00
Bill Wendling 73f59c433d Initialize the MSVCGuidDecl variable in the correct order.
llvm-svn: 113412
2010-09-08 21:30:16 +00:00
Fariborz Jahanian 40efc0feb4 Fix a crash when overloading id with objc_object*.
Radar 8400356.

llvm-svn: 113397
2010-09-08 20:08:18 +00:00
Argyrios Kyrtzidis f4bc0d87ee Fix C++ PCH issues.
PCH got a severe beating by the boost-using test case reported here: http://llvm.org/PR8099
Fix issues like:

-When PCH reading, make sure Decl's getASTContext() doesn't get called since a Decl in the parent hierarchy may be initializing.
-In ASTDeclReader::VisitFunctionDecl VisitRedeclarable should be called before using FunctionDecl's isCanonicalDecl()
-In ASTDeclReader::VisitRedeclarableTemplateDecl CommonOrPrev must be initialized before anything else.

llvm-svn: 113391
2010-09-08 19:31:22 +00:00
Daniel Dunbar 04ebde017f Frontend/-H: Add comment on why I used a temporary string here.
llvm-svn: 113379
2010-09-08 18:19:55 +00:00
Francois Pichet 9f4f2078d6 Microsoft's __uuidof operator implementation part 1.
llvm-svn: 113356
2010-09-08 12:20:18 +00:00
Francois Pichet 4ad4b58639 Allow type definitions inside anonymous struct/union in Microsoft mode.
llvm-svn: 113354
2010-09-08 11:32:25 +00:00
Sebastian Redl 02f1eebdc0 Don't give 'global constructor' warnings for function statics, even if they have a direct initializer. Fixes PR8095.
llvm-svn: 113344
2010-09-08 04:46:19 +00:00
John McCall 68ff03728a Implement ARM static local initialization guards, which are more compact than
Itanium guards and use a slightly different compiled-in API.

llvm-svn: 113330
2010-09-08 01:44:27 +00:00
Sebastian Redl a190d3605f Allow (cv) void and incomplete arrays to be passed to the type traits.
Fixes PR8110, and thus PR8109, PR8097, and parts of PR8101, PR8105 and PR8107. Only a few traits have tests for incomplete arrays, since I'm not yet clear what the result for them should be; Howards wants to file a DR to change the standard.

llvm-svn: 113326
2010-09-08 00:48:43 +00:00
Gabor Greif 80c218386f add a fixit when 'main' does ot return 'int'; review welcome
llvm-svn: 113324
2010-09-08 00:31:13 +00:00
Douglas Gregor 2b88c115f9 Provide proper type-source location information for
CXXTemporaryObjectExpr, CXXScalarValueInitExpr, and
CXXUnresolvedConstructExpr, getting rid of a bunch of FIXMEs in the
process.

llvm-svn: 113319
2010-09-08 00:15:04 +00:00
Fariborz Jahanian 366a94822b Local static block variable referecned in its
block-literal initializer expression causes IRgen to crash.
This patch fixes by saving it in StaticLocalDecl map
already used for such purposes. (radar 8390455).

llvm-svn: 113307
2010-09-07 23:26:17 +00:00
Ted Kremenek 41994fd45d Fix DeclPrinter to not include '=' in printing when no initializer is provided for a VarDecl. Patch by Jim Goodnow II!
llvm-svn: 113296
2010-09-07 22:21:59 +00:00
Douglas Gregor 0744ef6371 Improve source-location information for CXXNewExpr, by hanging on to
the TypeSourceInfo for the allocated type. Fixes PR7501.

llvm-svn: 113291
2010-09-07 21:49:58 +00:00
Ted Kremenek aba4958db2 Fix null pointer dereference in StreamChecker::Fseek (reported in PR 8081) and simplify surrounding checking logic.
llvm-svn: 113282
2010-09-07 20:45:26 +00:00
Tom Care bc9eaef24c Re-enabled truncation/extension checking in IdempotentOperationChecker and added a test case.
llvm-svn: 113269
2010-09-07 20:27:56 +00:00
Fariborz Jahanian 535618b927 get rid of a warning.
llvm-svn: 113256
2010-09-07 19:57:04 +00:00
Fariborz Jahanian 56603ef7b2 Have Sema check for validity of CGString literal
instead of asserting in IRGen. Fixes radar 8390459.

llvm-svn: 113253
2010-09-07 19:38:13 +00:00
Dale Johannesen 8499f47ef4 Allow 'o' and 'V' as constraints for output asm operands.
Allow '<' and '>' as constraints for input or output.

llvm-svn: 113246
2010-09-07 18:40:41 +00:00