Commit Graph

26405 Commits

Author SHA1 Message Date
Chad Rosier 1426a81a74 [ms-inline asm] Use the new Inline Asm Non-Standard Dialect attribute.
llvm-svn: 161642
2012-08-10 00:00:34 +00:00
Jordan Rose 637ff0cc0f [analyzer] Merge RegionStore's KillStruct and CopyLazyBindings: BindAggregate.
Both methods need to clear out existing bindings and provide a new default
binding. Originally KillStruct always provided UnknownVal as the default,
but it's allowed symbolic values for quite some time (for handling returned
structs in C).

No functionality change.

llvm-svn: 161637
2012-08-09 22:55:54 +00:00
Jordan Rose a44a55a8f2 [analyzer] Cluster bindings in RegionStore by base region.
This should speed up activities that need to access bindings by cluster,
such as invalidation and dead-bindings cleaning. In some cases all we save
is the cost of building the region cluster map, but other times we can
actually avoid traversing the rest of the store.

In casual testing, this produced a speedup of nearly 10% analyzing SQLite,
with /less/ memory used.

llvm-svn: 161636
2012-08-09 22:55:51 +00:00
Jordan Rose c91e01bc11 [analyzer] Cache the "concrete offset base" for regions with symbolic offsets.
This makes it faster to access and invalidate bindings with symbolic offsets
by only computing this information once.

No intended functionality change.

llvm-svn: 161635
2012-08-09 22:55:37 +00:00
Eli Friedman 5bb2ba0503 Followup to r161546, to unbreak linking on Bitrig. Patch by David Hill.
llvm-svn: 161630
2012-08-09 22:42:04 +00:00
Benjamin Kramer be1bc3c824 CMake: Add the new dependency from libSema to LLVM's libs.
Should fix the failures seen on some linux builders.

llvm-svn: 161629
2012-08-09 22:33:50 +00:00
Chad Rosier d82f647dee [ms-inline asm] Fix comment.
llvm-svn: 161622
2012-08-09 21:28:05 +00:00
Jordan Rose 996d309fb7 [analyzer] A CXXBaseObjectRegion should correspond to a DIRECT base.
An ASTContext's RecordLayoutInfo can only be used to look up offsets of
direct base classes, and we need the offset to make non-symbolic bindings
in RegionStore. This change makes sure that we have one layer of
CXXBaseObjectRegion for each base we are casting through.

This was causing crashes on an internal buildbot.

llvm-svn: 161621
2012-08-09 21:24:02 +00:00
Fariborz Jahanian 656b5a0937 objective-C: refactoring of objc's delayed parsing.
llvm-svn: 161620
2012-08-09 21:12:39 +00:00
Chad Rosier 8640a2a0db [ms-inline asm] Use StringRef here, per Jordan's suggestion.
llvm-svn: 161619
2012-08-09 21:06:32 +00:00
Anna Zaks a0105b2320 [analyzer] Rename the function to better reflect what it actually does.
llvm-svn: 161617
2012-08-09 21:02:45 +00:00
Anna Zaks 8d1f1f3b06 [analyzer] Clarify the values in Dyn. Dispatch Bifurcation map.
llvm-svn: 161616
2012-08-09 21:02:41 +00:00
Chad Rosier 543cb3e93a [ms-inline asm] Simplify logic for empty asm statements.
llvm-svn: 161615
2012-08-09 20:52:43 +00:00
Chad Rosier 11ede938e9 [ms-inline asm] Instantiate the various parts to the AsmParser.
llvm-svn: 161614
2012-08-09 20:47:38 +00:00
Richard Smith 10c6072d61 In 'delete []', the '[]' never starts a lambda. Update a FIXME with a standard reference and add a test.
llvm-svn: 161604
2012-08-09 19:01:51 +00:00
Anna Zaks 85383182ec [analyzer] Improve readability of the dyn. dispatch bifurcation patch
r161552.

As per Jordan's feedback.

llvm-svn: 161603
2012-08-09 18:43:00 +00:00
Dmitri Gribenko ba7aca3b38 Comment to HTML and XML conversion: ignore commands that contain a declaration
as their argument.  For example, \fn, \function, \typedef, \method, \class etc.

llvm-svn: 161601
2012-08-09 18:20:29 +00:00
Chad Rosier d5c43a5f4b [ms-inline asm] Initialize targets and assembly printers/parsers.
llvm-svn: 161595
2012-08-09 17:33:11 +00:00
Fariborz Jahanian db5743d1b4 objective-C: minor refactoring in method
definition parsing logic.

llvm-svn: 161593
2012-08-09 17:15:00 +00:00
Anna Zaks bc6d0ccf92 Unbreak the build.
Declaring "const Decl *Decl" is not a good idea.

llvm-svn: 161567
2012-08-09 02:57:02 +00:00
Anna Zaks 23a6201890 [analyzer] Cleanup of malloc checker.
Remove Escaped state, which is not really necessary. We can just stop
tracking the symbol instead of keeping it around and marking escaped.

llvm-svn: 161557
2012-08-09 00:42:24 +00:00
Eli Friedman e66abdafa6 Fix AAPCS ABI. I can't actually test this, but it restores the behavior from before r159168. PR13562.
llvm-svn: 161554
2012-08-09 00:31:40 +00:00
Anna Zaks 123af098b8 [analyzer] Bifurcate the path with dynamic dispatch.
This is an initial (unoptimized) version. We split the path when
inlining ObjC instance methods. On one branch we always assume that the
type information for the given memory region is precise. On the other we
assume that we don't have the exact type info. It is important to check
since the class could be subclassed and the method can be overridden. If
we always inline we can loose coverage.

Had to refactor some of the call eval functions.

llvm-svn: 161552
2012-08-09 00:21:33 +00:00
Dmitri Gribenko a7b3214c4e Add new file CommentCommandTraits.cpp to CMakeLists.txt.
llvm-svn: 161551
2012-08-09 00:16:26 +00:00
Dmitri Gribenko ca7f80ada0 Comment parsing: extract TableGen'able pieces into new CommandTraits class.
llvm-svn: 161548
2012-08-09 00:03:17 +00:00
Eli Friedman 9fa2885522 clang support for Bitrig (an OpenBSD fork); patch by David Hill.
llvm-svn: 161546
2012-08-08 23:57:20 +00:00
Eli Friedman 934dbbfa11 Minor simplification for r161534.
llvm-svn: 161544
2012-08-08 23:53:27 +00:00
Fariborz Jahanian 18d0a5d509 objective-C: refactor/simplify parsing of delayed
method/c-funcs defined in objc class implementation.
No intended functionality change.

llvm-svn: 161540
2012-08-08 23:41:08 +00:00
Eli Friedman ba01f2bc04 Fix r161534 so it actually builds.
llvm-svn: 161539
2012-08-08 23:35:12 +00:00
Richard Smith ac4e36d1af PR13558: Fix typo 'compatiblity'. Thinking of the children. Apparently.
llvm-svn: 161537
2012-08-08 23:32:13 +00:00
Eli Friedman 89b1f2c7e1 Handle deprecation diagnostics correctly for C struct fields and Objective-C properties/ivars. <rdar://problem/6642337>.
llvm-svn: 161534
2012-08-08 23:04:35 +00:00
Eli Friedman 971bfa11c6 Unify the codepaths for emitting deprecation warnings. The test changes are just to account for us emitting notes more consistently.
llvm-svn: 161528
2012-08-08 21:52:41 +00:00
Anna Zaks 13b0857ad0 Address code review comments for Wstrncat-size warning (r161440).
llvm-svn: 161527
2012-08-08 21:42:23 +00:00
Chad Rosier 5d4d8b746b [ms-inline asm] Use more idiomatic logic. Thanks, Bill.
llvm-svn: 161526
2012-08-08 21:42:11 +00:00
Jordan Rose 742c6079e2 Implicitly annotate __CFStringMakeConstantString with format_arg(1).
We handled the builtin version of this function in r157968, but the builtin
isn't used when compiling as -fno-constant-cfstrings.

This should complete <rdar://problem/6157200>.

llvm-svn: 161525
2012-08-08 21:17:31 +00:00
Chad Rosier 360e1763d5 [ms-inline asm] Add basic codegen support for simple asm stmts. Currently,
only machine specific clobbers are modeled.

llvm-svn: 161524
2012-08-08 21:15:52 +00:00
Eli Friedman 0415f3e138 Don't add attributes for "#pragma pack" and friends to tag declarations which
are not definitions. This follows the behavior of both gcc and earlier
versions of clang. Regression from r156531.  <rdar://problem/12048621>.

llvm-svn: 161523
2012-08-08 21:08:34 +00:00
Chad Rosier b1886eb604 [ms-inline asm] Make sure IsSimple is correctly handled.
llvm-svn: 161522
2012-08-08 21:08:20 +00:00
Chad Rosier 66753b3835 Remove extraneous comment.
llvm-svn: 161521
2012-08-08 20:38:22 +00:00
Chad Rosier 83916498b8 [ms-inline asm] Add a very simple test case. Basically, we're only testing for
crashers at the moment (and coincidentally this case was causing a crash).

llvm-svn: 161520
2012-08-08 20:37:31 +00:00
Chad Rosier 3ed0bd9938 [ms-inline asm] Refactor the logic to generate the AsmString into Sema. No
functional change intended.

llvm-svn: 161518
2012-08-08 19:48:07 +00:00
Chad Rosier 1dcde96842 Whitespace.
llvm-svn: 161516
2012-08-08 18:46:20 +00:00
Jordan Rose d86b3bdb7a [analyzer] Clean up the printing of FieldRegions for leaks.
Unfortunately, generalized region printing is very difficult:
- ElementRegions are used both for casting and as actual elements.
- Accessing values through a pointer means going through an intermediate
  SymbolRegionValue; symbolic regions are untyped.
- Referring to implicitly-defined variables like 'this' and 'self' could be
  very confusing if they come from another stack frame.

We fall back to simply not printing the region name if we can't be sure it
will print well. This will allow us to improve in the future.

llvm-svn: 161512
2012-08-08 18:23:36 +00:00
Jordan Rose 356279ca2d [analyzer] Track malloc'd regions stored in structs.
The main blocker on this (besides the previous commit) was that
ScanReachableSymbols was not looking through LazyCompoundVals.
Once that was fixed, it's easy enough to clear out malloc data on return,
just like we do when we bind to a global region.

<rdar://problem/10872635>

llvm-svn: 161511
2012-08-08 18:23:31 +00:00
Jordan Rose 3a80cec5e9 [analyzer] Revamp RegionStore to distinguish regions with symbolic offsets.
RegionStore currently uses a (Region, Offset) pair to describe the locations
of memory bindings. However, this representation breaks down when we have
regions like 'array[index]', where 'index' is unknown. We used to store this
as (SubRegion, 0); now we mark them specially as (SubRegion, SYMBOLIC).

Furthermore, ProgramState::scanReachableSymbols depended on the existence of
a sub-region map, but RegionStore's implementation doesn't provide for such
a thing. Moving the store-traversing logic of scanReachableSymbols into the
StoreManager allows us to eliminate the notion of SubRegionMap altogether.

This fixes some particularly awkward broken test cases, now in
array-struct-region.c.

llvm-svn: 161510
2012-08-08 18:23:27 +00:00
Jordan Rose 55edf5ff14 Constify CXXRecordDecl::isVirtuallyDerivedFrom.
No functionality change. A couple ugly const_casts because the ancestor
search code is used for other purposes as well.

llvm-svn: 161509
2012-08-08 18:23:20 +00:00
Chad Rosier d12b7a64dc [ms-inline asm] Add support for detecting simple ms-style inline asm. Simple
asm statements are those that don't reference variable names, function names,
and labels.

Add logic to generate a patched AsmString that will eventually be consumed by
the AsmParser.  No functional change at this point, so unfortunately no test
case.

llvm-svn: 161508
2012-08-08 18:22:06 +00:00
Chad Rosier d2ff32aa94 Add the IsSimple/IsVolatile parameters to the MSAsmStmt constructor.
llvm-svn: 161503
2012-08-08 17:35:36 +00:00
David Blaikie 1c7c8f7637 Implement warning for integral null pointer constants other than the literal 0.
This is effectively a warning for code that violates core issue 903 & thus will
become standard error in the future, hopefully. It catches strange null
pointers such as: '\0', 1 - 1, const int null = 0; etc...

There's currently a flaw in this warning (& the warning for 'false' as a null
pointer literal as well) where it doesn't trigger on comparisons (ptr == '\0'
for example). Fix to come in a future patch.

Also, due to this only being a warning, not an error, it triggers quite
frequently on gtest code which tests expressions for null-pointer-ness in a
SFINAE context (so it wouldn't be a problem if this was an error as in an
actual implementation of core issue 903). To workaround this for now, the
diagnostic does not fire in unevaluated contexts.

Review by Sean Silva and Richard Smith.

llvm-svn: 161501
2012-08-08 17:33:31 +00:00
Fariborz Jahanian a5063a6208 objc: Include all types when issuing warning under
-Wdirect-ivar-access.

llvm-svn: 161500
2012-08-08 16:41:04 +00:00