Commit Graph

5067 Commits

Author SHA1 Message Date
Benjamin Kramer cf4371a689 Translate -mcmodel=X to -code-model X and pass it to clang-cc. Patch by Pawel Worach!
llvm-svn: 78190
2009-08-05 14:30:52 +00:00
Benjamin Kramer 72e211a47a Add support for the -fno-omit-frame-pointer option. Patch by Roman Divacky!
llvm-svn: 78188
2009-08-05 12:11:11 +00:00
Douglas Gregor 99709de6ae Fix a comment that trailed off
llvm-svn: 78167
2009-08-05 05:39:53 +00:00
Douglas Gregor 2211d345d2 Introduce the canonical type smart pointers, and use them in a few places to
tighten up the static type system.

llvm-svn: 78164
2009-08-05 05:36:45 +00:00
Zhongxing Xu fe97165587 If the UnaryOperator has non-location type, use its type to create the
constant value. If the UnaryOperator has location type, create the
constant with int type and pointer width.

This fixes the bug that all pointer increments 'p++' evaluated to Unknown.

llvm-svn: 78147
2009-08-05 02:51:59 +00:00
Fariborz Jahanian 800f37262c Support for use of default argument in constructors.
work in progress.

llvm-svn: 78132
2009-08-05 00:26:10 +00:00
Douglas Gregor d6ff33294a Refactor template instantiation for types into a generic tree
transformation template (TreeTransform) that handles the
transformation and reconstruction of AST nodes. Template instantiation
for types is a (relatively small) customization of the generic tree
transformation.

llvm-svn: 78071
2009-08-04 16:50:30 +00:00
Fariborz Jahanian 10ff786e1e Compare matching selectors in current and
super class(s) and warn on any parameter
type mismatch if potentially unsafe. 

llvm-svn: 78029
2009-08-04 01:07:16 +00:00
Ted Kremenek fb50bf5a6f Per advice that Doug Gregor gave me several months ago, clean up the
implementation of '#pragma unused' by not constructing intermediate
DeclRefExprs, but instead do the name lookup directly.  The
implementation is greatly simplified.

Along the way, degrade '#pragma unused(undeclaredvariable)' to a
warning instead of being a hard error.  This implements:

<rdar://problem/6761874> [sema] allow #pragma unused to reference undefined variable (with warning)

llvm-svn: 78019
2009-08-03 23:24:57 +00:00
Ted Kremenek 72ddac6cb8 Regression fix: reset 'DisplayedFunction' when a new function/method decl gets analyzed.
llvm-svn: 77996
2009-08-03 21:01:21 +00:00
John McCall 49bfce4227 Refactor methods on DeclSpec to take a diagnostic& parameter, and reflect this
elsewhere.  Very slightly decouples DeclSpec users from knowing the exact
diagnostics to report, and makes it easier to provide different diagnostics in
some places.

llvm-svn: 77990
2009-08-03 20:12:06 +00:00
John McCall 898cd0fced Templatize BadSpecifier and introduce DeclSpec::getSpecifier(T) for the
remaining specifier enums T.

llvm-svn: 77981
2009-08-03 18:47:27 +00:00
Zhongxing Xu 9ad0b46a80 add a bunch of routine methods to AnalysisContext.
llvm-svn: 77961
2009-08-03 07:23:22 +00:00
Eli Friedman 5032139548 Tweak diagnostic wording; patch by Sean Hunt.
llvm-svn: 77955
2009-08-03 05:14:16 +00:00
Zhongxing Xu b9a45a46f1 now we can let AnalysisManager to own the PathDiagnosticClient.
llvm-svn: 77945
2009-08-03 03:27:37 +00:00
Zhongxing Xu bcbe44fa90 Create only one AnalysisManager for each translation unit. In HandleCode(),
reset the current analysis context of the AnalysisManager.

llvm-svn: 77943
2009-08-03 03:13:46 +00:00
Zhongxing Xu 4f4b643afa Add LocationContext classes to enable creation of cross function
ProgramPoints. ProgramPoints will refer to them in the furture.

llvm-svn: 77941
2009-08-03 02:52:14 +00:00
Douglas Gregor 55137cbc85 Produce a warning that partial ordering of function templates is not yet supported
llvm-svn: 77928
2009-08-02 23:46:29 +00:00
Douglas Gregor 9dc8bd327f Keep track of the template arguments deduced when matching a class
template partial specialization. Then, use those template arguments
when instantiating members of that class template partial
specialization. Fixes PR4607.

llvm-svn: 77925
2009-08-02 23:24:31 +00:00
Anders Carlsson 4ab4f7f416 Use the correct cast kind for dynamic_cast.
llvm-svn: 77905
2009-08-02 19:07:59 +00:00
Ted Kremenek ca7935d347 Remove RegionViews and RegionCasts. These are no longer used.
llvm-svn: 77876
2009-08-02 05:15:23 +00:00
Ted Kremenek f106ab91ff RegionStoreManager::RemoveDeadBindings() now removes dead 'default' bindings as well.
llvm-svn: 77875
2009-08-02 05:00:15 +00:00
Ted Kremenek cee28a4c4d Generalize the interface of 'StoreManager::RemoveDeadBindings()' to manipulate the entire GRState, not just the Store.
llvm-svn: 77870
2009-08-02 04:45:08 +00:00
Ted Kremenek 1f22aa7433 This is a fairly large patch, which resulted from a cascade of changes
made to RegionStore (and related classes) in order to handle some
analyzer failures involving casts and manipulation of symbolic memory.

The root of the change is in StoreManager::CastRegion().  Instead of
using ad hoc heuristics to decide when to layer an ElementRegion on a
casted MemRegion, we now always layer an ElementRegion when the cast
type is different than the original type of the region.  This carries
the current cast information associated with a region around without
resorting to the error prone recording of "casted types" in GRState.

Along with this new policy of layering ElementRegions, I added a new
algorithm to strip away existing ElementRegions when they simply
represented casts of a base memory object.  This algorithm computes
the raw "byte offset" that an ElementRegion represents from the base
region, and allows the new ElementRegion to be based off that offset.
The added benefit is that this naturally handles a series of casts of
a MemRegion without building up a set of redundant ElementRegions
(thus canonicalizing the region view).

Other related changes that cascaded from this one (as tests were
failing in RegionStore):

- Revamped RegionStoreManager::InvalidateRegion() to completely remove
  all bindings and default values from a region and all subregions.
  Now invalidated fields are not bound directly to new symbolic
  values; instead the base region has a "default" symbol value from
  which "derived symbols" can be created.  The main advantage of this
  approach is that it allows us to invalidate a region hierarchy and
  then lazily instantiate new values no matter how deep the hierarchy
  went (i.e., regardless of the number of field accesses,
  e.g. x->f->y->z->...).  The previous approach did not do this.

- Slightly reworked RegionStoreManager::RemoveDeadBindings() to also
  incorporate live symbols and live regions that do not have direct
  bindings but also have "default values" used for lazy instantiation.
  The changes to 'InvalidateRegion' revealed that these were necessary
  in order to achieve lazy instantiation of values in the region store
  with those bindings being removed too early.

- The changes to InvalidateRegion() and RemoveDeadBindings() revealed
  a serious bug in 'getSubRegionMap()' where not all region -> subregion
  relationships involved in actually bindings (explicit and implicit)
  were being recorded.  This has been fixed by using a worklist algorithm
  to iteratively fill in the region map.

- Added special support to RegionStoreManager::Bind()/Retrieve() to handle
  OSAtomicCompareAndSwap in light of the new 'CastRegion' changes and the
  layering of ElementRegions.

- Fixed a bug in SymbolReaper::isLive() where derived symbols were not
  being marked live if the symbol they were derived from was also live.
  This fix was critical for getting lazy instantiation in RegionStore
  to work.

- Tidied up the implementation of ValueManager::getXXXSymbolVal() methods
  to use SymbolManager::canSymbolicate() to decide whether or not a
  symbol should be symbolicated.

- 'test/Analysis/misc-ps-xfail.m' now passes; that test case has been
  moved to 'test/Analysis/misc-ps.m'.

- Tweaked some pretty-printing of MemRegions, and implemented
  'ElementRegion::getRawOffset()' for use with the CastRegion changes.

llvm-svn: 77782
2009-08-01 06:17:29 +00:00
Mike Stump 183c3d2f59 Add beginnigs of rtti generation, wire up more of -fno-exceptions.
llvm-svn: 77751
2009-07-31 23:15:31 +00:00
Mike Stump 67829f6493 And now we can generate a simple vtable. Still a work in progress...
llvm-svn: 77737
2009-07-31 21:43:43 +00:00
Douglas Gregor 1b2596ba36 Allow one to update the type representation of the declaration specifiers. Will be used by an upcoming commit.
llvm-svn: 77703
2009-07-31 18:34:30 +00:00
Douglas Gregor 4571a4a760 Fix 80-col violation
llvm-svn: 77683
2009-07-31 16:50:39 +00:00
Douglas Gregor 352169aed4 Canonicalize dependent extended vector types.
llvm-svn: 77663
2009-07-31 03:54:25 +00:00
John McCall 9bb74a5ef5 Rename Action::TagKind to Action::TagUseKind, which removes both a misnomer
and a name collision.

llvm-svn: 77658
2009-07-31 02:45:11 +00:00
John McCall ef50e99783 sp.
llvm-svn: 77656
2009-07-31 02:20:35 +00:00
Anders Carlsson a076d14514 Add CK_DerivedToBase and use it PerformObjectMemberConversion.
llvm-svn: 77652
2009-07-31 01:23:52 +00:00
Anders Carlsson a26159261c Add a CastKind enum to CastExpr. Right now it's not used for much but it will be :)
llvm-svn: 77650
2009-07-31 00:48:10 +00:00
Ted Kremenek df4b3dc3a4 Fix use-after-release bug introduced in r77585 where the PathDiagnosticClient
created by AnalysisConsumer would be released by an instance of AnalysisManager
and then reused by later instances of AnalysisManager. Ownership of the
PathDiagnosticClient now belongs (for now) in AnalysisConsumer.

We also need this layering (for now) because the HTMLDiagnostiClient requires
that the entire translation unit be processed before emitting diagnostics. This
is done in its destructor (which should also be fixed, but that is another
issue).

This fixes PR 4653.

llvm-svn: 77648
2009-07-31 00:34:52 +00:00
Douglas Gregor f3f955279b Build canonical types for dependently-sized array types.
llvm-svn: 77647
2009-07-31 00:23:35 +00:00
Douglas Gregor a21f6c3c71 Canonicalization of dependent C++0x decltype types.
llvm-svn: 77643
2009-07-30 23:36:40 +00:00
Douglas Gregor a5dd9f858f Canonicalization for dependent typeof(expr) types.
llvm-svn: 77639
2009-07-30 23:18:24 +00:00
Fariborz Jahanian aa01d2a532 Patch for future ir-gen for destructor calls.
llvm-svn: 77608
2009-07-30 17:49:11 +00:00
Douglas Gregor 1530138fd0 Support out-of-line definitions of the members of class template
partial specializations.

llvm-svn: 77606
2009-07-30 17:40:51 +00:00
Zhongxing Xu 4b03d4913a Make AnalysisManager into its own source file and a pure data management class.
Move all components creation code into AnalysisConsumer::DigestAnalyzerOptions().

llvm-svn: 77585
2009-07-30 09:11:52 +00:00
Ryan Flynn 7d470f3466 PR3679 - handle #pragma weak
llvm-svn: 77573
2009-07-30 03:15:39 +00:00
Zhongxing Xu 14407bf25a This patch collects all analysis context data into a new class
AnalysisContext.

llvm-svn: 77563
2009-07-30 01:17:21 +00:00
Mike Stump 776d3401d2 Fix type to be consistent with the rest of the code.
llvm-svn: 77560
2009-07-30 01:02:10 +00:00
Eli Friedman b0e2986baf Add support for -Wno-long-long.
llvm-svn: 77552
2009-07-30 00:04:39 +00:00
Argyrios Kyrtzidis bd92767014 Add support for ObjC message expressions, in the Analyzer:
-Accept an ObjC method and find all message expressions that this method may respond to.
-Accept an ObjC message expression and find all methods that may respond to it.

llvm-svn: 77551
2009-07-30 00:03:55 +00:00
Argyrios Kyrtzidis 2eff90515f Support ObjC methods as Entities.
llvm-svn: 77547
2009-07-29 23:41:46 +00:00
Argyrios Kyrtzidis 97fb3e5323 Use a STL helper template 'pair_value_iterator', by both DeclReferenceMap and SelectorMap.
llvm-svn: 77545
2009-07-29 23:41:33 +00:00
Argyrios Kyrtzidis 2e592966f8 Add ObjCMethodDecl::isThisDeclarationADefinition().
llvm-svn: 77544
2009-07-29 23:41:26 +00:00
Argyrios Kyrtzidis d70a92139f Index the selectors and provide the translation units that contain them
through the IndexProvider.

llvm-svn: 77543
2009-07-29 23:41:18 +00:00
Argyrios Kyrtzidis f7f56741e0 Add TranslationUnit::getSelectorMap().
llvm-svn: 77542
2009-07-29 23:41:08 +00:00