Mike Stump
d3bb557559
Fix 80-col violations, reflow a few comments and zap some extra
...
whitespace at ends of lines.
llvm-svn: 76992
2009-07-24 19:02:52 +00:00
Anders Carlsson
5e66fb5d16
Fix a release build warning.
...
llvm-svn: 76985
2009-07-24 18:20:38 +00:00
Fariborz Jahanian
2a1b5af130
More work toward initialization of objects
...
in constructors.
llvm-svn: 76980
2009-07-24 17:57:02 +00:00
Steve Naroff
e87026a08f
Allow front-end 'isa' access on object's of type 'id'.
...
Enhance test case to cover 'isa' access on interface types (clang produces an error, GCC produces a warning).
Still need back-end CodeGen for ObjCIsaExpr.
llvm-svn: 76979
2009-07-24 17:54:45 +00:00
Anders Carlsson
e2c6baf629
Don't use getLLVMFieldNo for bitfields when constructing the ivar layout maps for GC.
...
llvm-svn: 76978
2009-07-24 17:23:54 +00:00
Anders Carlsson
e1d5ca583f
Check in a half finished new constant struct builder (Obviously not used yet).
...
llvm-svn: 76969
2009-07-24 15:20:52 +00:00
Daniel Dunbar
c46a079957
Fix declaration of obc_enumerationMutation function, for GNU runtime.
...
llvm-svn: 76959
2009-07-24 07:40:24 +00:00
Ted Kremenek
963cc31583
Add doxygen comments and simplify expression.
...
llvm-svn: 76955
2009-07-24 06:55:42 +00:00
Ted Kremenek
3075428d16
Introduce a new variant type 'TryResult' to represent the result of
...
TryEvaluateBool instead of using a raw 'int'. This avoids any
confusion of how 'int' converts to bool, and makes the resultant code
easier to read.
Condense a bunch of 'addSuccessor()' calls in 'if ... else' to use the
ternary operator instead.
llvm-svn: 76947
2009-07-24 04:47:11 +00:00
Zhongxing Xu
30ac7607be
Add getDecl() to CallGraph and CallGraphNode.
...
llvm-svn: 76940
2009-07-24 03:41:11 +00:00
Zhongxing Xu
6c82313375
Constify methods.
...
llvm-svn: 76939
2009-07-24 03:38:27 +00:00
John McCall
d9baf6aed8
Test commit: make a little stub routine for semantic checking of main().
...
llvm-svn: 76934
2009-07-24 03:03:21 +00:00
Ted Kremenek
cd31df0f3f
Enable the '-warn-security-syntactic' checker option by default.
...
llvm-svn: 76933
2009-07-24 02:52:07 +00:00
Mike Stump
8e79f99b16
Implement new warning for functions declared 'noreturn' when they fall off the end.
...
llvm-svn: 76932
2009-07-24 02:49:01 +00:00
Anders Carlsson
6e853bf2b7
Get rid of the size parameter to AppendField. No functionality change.
...
llvm-svn: 76931
2009-07-24 02:45:50 +00:00
Ted Kremenek
745088c49e
Mark destructor of Checker virtual.
...
llvm-svn: 76924
2009-07-24 00:40:31 +00:00
Douglas Gregor
c04e2d9bd6
We now do complete semantic checking for unions
...
llvm-svn: 76918
2009-07-24 00:05:42 +00:00
Douglas Gregor
020e4a9bbb
Update C++ status to reflect progress on out-of-line definitions of class template members
...
llvm-svn: 76917
2009-07-23 23:58:15 +00:00
Douglas Gregor
79f83eda84
This patch fixes the implementations of the __has_trivial_destructor
...
and __has_trivial_constructor builtin pseudo-functions and
additionally implements __has_trivial_copy and __has_trivial_assign,
from John McCall!
llvm-svn: 76916
2009-07-23 23:49:00 +00:00
Daniel Dunbar
91ade14197
Output UTF-16 string literals independent of host byte order.
...
- Steve, can you take a look at this? It seems like this code should live
elsewhere, and there is a FIXME about having Sema validates the UTF-8 to
UTF-16 conversion.
llvm-svn: 76915
2009-07-23 23:41:22 +00:00
Fariborz Jahanian
ca2f085a4e
Diagnose when base classes and members to be intialized
...
with constructors don't have a matching constructor.
llvm-svn: 76913
2009-07-23 23:32:59 +00:00
Mike Stump
773582dbb8
Refactor and push the evaluation as late as possible.
...
llvm-svn: 76911
2009-07-23 23:25:26 +00:00
Daniel Dunbar
64509b2765
Factor out map lookup for CFString constants.
...
llvm-svn: 76908
2009-07-23 22:52:48 +00:00
Anders Carlsson
085395426c
Don't just store the field/bit field info one field, do it for all fields in the union.
...
llvm-svn: 76907
2009-07-23 22:52:34 +00:00
Mike Stump
9620889f67
Some cleanups suggested by Daniel.
...
llvm-svn: 76906
2009-07-23 22:40:11 +00:00
Ted Kremenek
6610c0326b
Implement: <rdar://problem/6335715> rule request: gets() buffer overflow
...
llvm-svn: 76905
2009-07-23 22:29:41 +00:00
Anders Carlsson
e2accf4404
Fix another thinko.
...
llvm-svn: 76903
2009-07-23 21:52:03 +00:00
Ted Kremenek
70e5526a61
Add comments.
...
llvm-svn: 76901
2009-07-23 21:44:18 +00:00
Ted Kremenek
9c49762776
Refine checking and diagnostics for use of floating point variable as a counter.
...
This implements <rdar://problem/6336718> and checks for CERT secure coding
advisory FLP30-C.
llvm-svn: 76900
2009-07-23 21:34:35 +00:00
Anders Carlsson
516e5e7835
Correct a thinko in bitfield layout code. Fixes PR4611.
...
llvm-svn: 76898
2009-07-23 21:16:33 +00:00
Daniel Dunbar
2a5b83c7e6
Simplify, NFC.
...
llvm-svn: 76897
2009-07-23 20:38:28 +00:00
Daniel Dunbar
07b749230c
Switch the driver back to always using clang-cc by default (for C++, and
...
regardless of the architecture).
- This is a good default for development & testing; for example without this
any tests using 'clang' in the test suite will fail on PowerPC, since the
driver will avoid using clang.
- We don't want to actually ship something built this way, but that should be
handled via some sort of configuration file.
llvm-svn: 76886
2009-07-23 17:48:59 +00:00
Daniel Dunbar
635d481de0
Simplify.
...
llvm-svn: 76885
2009-07-23 17:33:49 +00:00
Anders Carlsson
d78fc89fcb
We don't need to keep track of the packed alignment, just whether the struct is packed or not. Fixes PR4610.
...
llvm-svn: 76884
2009-07-23 17:24:40 +00:00
Anders Carlsson
8af896c10a
Move the LLVM field number for bit fields into the BitFieldInfo structure, since it's meaning is completely different than for non-bit fields.
...
llvm-svn: 76882
2009-07-23 17:01:21 +00:00
Douglas Gregor
27bdf00fd7
Clean up the ActOnTag action, so that there is only a single entry
...
point that covers templates and non-templates. This should eliminate
the flood of warnings I introduced yesterday.
Removed the ActOnClassTemplate action, which is no longer used.
llvm-svn: 76881
2009-07-23 16:36:45 +00:00
Douglas Gregor
2aff97c9e6
Unbreak the CMake build
...
llvm-svn: 76878
2009-07-23 15:15:06 +00:00
Zhongxing Xu
ee5d708e55
Add two nodes to the call graph:
...
- Root is the main function or 0.
- ExternalCallingNode has edges to all external functions.
llvm-svn: 76876
2009-07-23 13:39:38 +00:00
Zhongxing Xu
a598e5c9d5
Add template specializations to view the call graph in dot format.
...
- change the DenseMap used in callgraph to std::map, since DenseMap cannot
be used with mapped_iterator and friends.
llvm-svn: 76874
2009-07-23 09:04:23 +00:00
Zhongxing Xu
fdd52922c2
constify methods.
...
llvm-svn: 76873
2009-07-23 08:32:25 +00:00
Zhongxing Xu
ef5cfd43b3
Add getter methods.
...
llvm-svn: 76871
2009-07-23 07:37:14 +00:00
Daniel Dunbar
3cdf80589f
Add newline at EOF.
...
llvm-svn: 76870
2009-07-23 07:07:43 +00:00
Daniel Dunbar
7c02cf609d
Shield clang from LLVM API changes, until the dust settles.
...
llvm-svn: 76862
2009-07-23 05:30:36 +00:00
Daniel Dunbar
34169976d0
Fix test case, which has a control-reaches-end-of-non-void warning that was
...
being masked by previous bug.
llvm-svn: 76858
2009-07-23 05:06:51 +00:00
Daniel Dunbar
a2f7c95dca
Use llvm::BitVector instead of managing memory by hand.
...
- As it happens, this also fixes a use-of-uninitialized memory that was causing
non-deterministic test failures.
llvm-svn: 76857
2009-07-23 05:01:54 +00:00
Anders Carlsson
f55922b8b8
Set field info for unions.
...
llvm-svn: 76856
2009-07-23 04:59:05 +00:00
Anders Carlsson
718a89a501
Use arrays as union padding. Also, since the resulting struct will always contain a single element and either a single i8 element or an array of i8s, there's no reason to use a packed struct.
...
llvm-svn: 76854
2009-07-23 04:50:01 +00:00
Daniel Dunbar
8e31e77fd8
Revert r76831, there are many Analyzer test failures on multiple platforms.
...
--- Reverse-merging r76831 into '.':
U include/clang/Analysis/PathSensitive/GRExprEngine.h
U lib/Analysis/GRExprEngine.cpp
llvm-svn: 76851
2009-07-23 04:41:06 +00:00
Anders Carlsson
f814ee6003
Handle zero width bit fields in unions correctly (by ignoring them).
...
llvm-svn: 76847
2009-07-23 04:00:39 +00:00
Anders Carlsson
697f65943d
Implement union layout support.
...
llvm-svn: 76846
2009-07-23 03:43:54 +00:00
Anders Carlsson
307846fe67
Check in CGRecordLayoutBuilder which is a reimplementation of the record layout code. (Yay, no more packed structs unless absolutely necessary). We currently don't use the layouts being built but that will change when the new code is mature enough :)
...
llvm-svn: 76845
2009-07-23 03:17:50 +00:00
Daniel Dunbar
a244814e6f
These IRgen improvements have been done.
...
Technically we could still do a bit more to avoid deferred generation of statics
which we know are used, but I seriously doubt this is important.
llvm-svn: 76844
2009-07-23 03:03:07 +00:00
Ted Kremenek
c5b4c0ec64
Add initial implementation of checking for uses of floating point as a loop counter.
...
llvm-svn: 76833
2009-07-23 01:07:19 +00:00
Ted Kremenek
4cd5577cdf
Add instance predicate method to match static method.
...
llvm-svn: 76832
2009-07-23 01:06:10 +00:00
Ted Kremenek
5939402e2c
Add 'previsit' Checker pass for ObjCMessageExprs.
...
llvm-svn: 76831
2009-07-23 01:05:31 +00:00
Steve Naroff
8e6aee5821
Remove a bunch of FIXME's related to ObjC type checking.
...
- Move Sema::ObjCQualifiedIdTypesAreCompatible(), Sema::QualifiedIdConformsQualifiedId(), and a couple helper functions to ASTContext.
- Change ASTContext::canAssignObjCInterfaces() to use ASTContext:: ObjCQualifiedIdTypesAreCompatible().
- Tweak several test cases to accommodate the new/improved type checking.
llvm-svn: 76830
2009-07-23 01:01:38 +00:00
Fariborz Jahanian
0228bc1a41
Add constructor used to initialize base/member in
...
CXXBaseOrMemberInitializer AST node. Needed by
its clients to do the initialization.
llvm-svn: 76826
2009-07-23 00:42:24 +00:00
Mike Stump
671cc00ce1
Fix case, apparently some people still build on case sensitive
...
filesystems.
llvm-svn: 76824
2009-07-23 00:20:25 +00:00
Mike Stump
33979f75a0
Add warning for falling off the end of a function that should return a
...
value. This is on by default, and controlled by -Wreturn-type (-Wmost
-Wall). I believe there should be very few false positives, though
the most interesting case would be:
int() { bar(); }
when bar does:
bar() { while (1) ; }
Here, we assume functions return, unless they are marked with the
noreturn attribute. I can envision a fixit note for functions that
never return normally that don't have a noreturn attribute to add a
noreturn attribute.
If anyone spots other false positives, let me know!
llvm-svn: 76821
2009-07-22 23:56:57 +00:00
Douglas Gregor
e93e46c690
Implement support for out-of-line definitions of the class members of class
...
templates, e.g.,
template<typename T>
struct Outer {
struct Inner;
};
template<typename T>
struct Outer<T>::Inner {
// ...
};
Implementing this feature required some extensions to ActOnTag, which
now takes a set of template parameter lists, and is the precursor to
removing the ActOnClassTemplate function from the parser Action
interface. The reason for this approach is simple: the parser cannot
tell the difference between a class template definition and the
definition of a member of a class template; both have template
parameter lists, and semantic analysis determines what that template
parameter list means.
There is still some cleanup to do with ActOnTag and
ActOnClassTemplate. This commit provides the basic functionality we
need, however.
llvm-svn: 76820
2009-07-22 23:48:44 +00:00
Eli Friedman
f32f0a7146
Fix test breakage.
...
llvm-svn: 76816
2009-07-22 23:24:42 +00:00
Argyrios Kyrtzidis
3a24c4aa00
Change Preprocessor to keep a copy of LangOptions instead of reference, like ASTContext.
...
Now when creating a Preprocessor we can pass it a temporary LangOptions object instead of having to remember to keep it around.
llvm-svn: 76815
2009-07-22 23:13:42 +00:00
Mike Stump
8dd1b6bd10
Improve CFG support for C++ throw expressions.
...
llvm-svn: 76814
2009-07-22 22:56:04 +00:00
Mike Stump
24cbfc370b
Prep for new warning.
...
llvm-svn: 76813
2009-07-22 22:55:09 +00:00
Ted Kremenek
bfd28fd596
Refactor 'PostStmt' and 'PreStmt' to subclass a common parent 'StmtPoint'.
...
Educate GRExprEngine::VisitGraph() about 'PreStmt'.
Mark the constructor of 'PostStmt' to be explicit, preventing implicit
conversions and the selection of the wrong 'generateNode' method in
GRStmtNodeBuilder.
Constify a bunch of arguments, which falls out of the changes to ProgramPoint.
llvm-svn: 76809
2009-07-22 22:35:28 +00:00
Eli Friedman
6aea57560f
Slight code reorganization to allow instantiating post-inc/dec.
...
llvm-svn: 76807
2009-07-22 22:25:00 +00:00
Douglas Gregor
1a7ba62e3a
Calls to Sema::MatchTemplateParametersToScopeSpecifier should not depend on the order of evaluation of their arguments to be correct.
...
llvm-svn: 76804
2009-07-22 22:05:02 +00:00
Ted Kremenek
b8725e2099
Use SaveAndRestore in 'clang/Analysis/Support/SaveAndRestore.h'
...
llvm-svn: 76800
2009-07-22 21:52:10 +00:00
Ted Kremenek
5b9b066aeb
Add AssumeDual method.
...
llvm-svn: 76798
2009-07-22 21:51:00 +00:00
Ted Kremenek
915c351496
Migrate the path-sensitive checking of 'nonnull' arguments over to the new
...
'Checker' interface. An updated test case illustrates that after calling a
function with the 'nonnull' attribute we now register the fact that the passed
pointer must be non-null. This retention of information was not possible with
the previously used GRSimpleAPICheck interface.
llvm-svn: 76797
2009-07-22 21:46:56 +00:00
Eli Friedman
3af2a77717
Fix the parsing of default arguments for inline member function
...
definitions.
I'm not very familiar with this code, so please review.
llvm-svn: 76796
2009-07-22 21:45:50 +00:00
Ted Kremenek
b1c170e64b
Make 'SaveAndRestore' and friends reusable classes in libAnalysis.
...
llvm-svn: 76795
2009-07-22 21:45:16 +00:00
Ted Kremenek
49513ccaec
Add support for registering 'Checker' objects with GRExprEngine.
...
Add a 'previsit' stage (that dispatches to registered Checkers) when evaluating the effects of CallExprs.
llvm-svn: 76794
2009-07-22 21:43:51 +00:00
Ted Kremenek
63fc4352b6
Add new 'Checker' and 'CheckerVisitor' classes, which represent a more powerful
...
interface to plug in domain-specific checker logic than the current
GRSimpleAPICheck interface. The new 'Checker' interface can actually generate
new nodes, allowing it to modify the state and refine the analysis (which
GRSimpleAPIChecks could not).
llvm-svn: 76793
2009-07-22 21:42:34 +00:00
Ted Kremenek
2776079844
Add support for 'PreStmt' program points to GRCoreEngine and GRStmtNodeBuilder.
...
llvm-svn: 76792
2009-07-22 21:40:46 +00:00
Ted Kremenek
8a2cb9cede
Add 'PreStmt' program point. This will be used to represent checking for
...
preconditions (in GRExprEngine) before the statement itself is evaluated.
llvm-svn: 76791
2009-07-22 21:39:25 +00:00
Ted Kremenek
0af7e85bf7
Implement operator= for ExplodedNodeSet.
...
llvm-svn: 76790
2009-07-22 21:38:15 +00:00
Douglas Gregor
d6605dbbc0
Fix the problems with template argument deduction and array types for
...
real. It turns out that we need to actually move all of the qualifiers
up to the array type itself, then recanonicalize the deduced template
argument type.
llvm-svn: 76788
2009-07-22 21:30:48 +00:00
Mike Stump
aa19375206
Make -Wreturn-type be part of -Wmost and therefore -Wall.
...
llvm-svn: 76784
2009-07-22 21:00:27 +00:00
Douglas Gregor
b77af8f4aa
Fix some memory allocation/deallocation issues
...
llvm-svn: 76783
2009-07-22 20:55:49 +00:00
Eli Friedman
2729132ec3
Fix a nasty little use-after-free bug.
...
llvm-svn: 76779
2009-07-22 20:29:16 +00:00
Douglas Gregor
7ac44f4cfb
Canonicalize the types produced by template argument deduction.
...
llvm-svn: 76777
2009-07-22 20:25:36 +00:00
Fariborz Jahanian
f87fbc058d
Improved on performance of the algorithm for proper ordering of
...
ctor's initialization of bases and fields.
llvm-svn: 76776
2009-07-22 20:25:00 +00:00
Douglas Gregor
b3a1fdc363
Slighty more testing for template argument deduction with array arguments
...
llvm-svn: 76774
2009-07-22 20:07:21 +00:00
Douglas Gregor
6045482792
Improve template argument deduction for array types, so that a parameter
...
const T
can be matched with, e.g.,
volatile int [5]
llvm-svn: 76773
2009-07-22 20:02:25 +00:00
Mike Stump
af6ab88979
Prep for new warning.
...
llvm-svn: 76772
2009-07-22 20:02:03 +00:00
Mike Stump
212005c1b4
Use isa instead of dyn_cast for conditionals.
...
llvm-svn: 76771
2009-07-22 18:58:19 +00:00
Devang Patel
06cceef545
Use DICompositeType->replaceAllUsesWith().
...
This requires llvm rev. 76769 or higher.
llvm-svn: 76770
2009-07-22 18:57:00 +00:00
Douglas Gregor
8a27391190
"This patch implements the restrictions on union members detailed in
...
[class.union]p1", from John McCall!
llvm-svn: 76766
2009-07-22 18:25:24 +00:00
Ted Kremenek
f1282074c3
Move bug reporter "visitors" to their own file and make them part of the public
...
BugReporter API. No real functionality change.
llvm-svn: 76760
2009-07-22 17:55:28 +00:00
Fariborz Jahanian
5c14ec30cd
Allocate BaseOrMemberInitializers and CXXBaseSpecifier nodes
...
via ASTContext.
llvm-svn: 76758
2009-07-22 17:41:53 +00:00
Douglas Gregor
b09f3d82cc
Implement parsing and semantic analysis for out-of-line definitions of static
...
data members of class templates. We don't instantiate the definitions yet,
however.
llvm-svn: 76756
2009-07-22 17:18:37 +00:00
Steve Naroff
3de6b70730
Fix a couple recent ABI regressions noticed during code review (fallout from the ObjC type system rewrite).
...
It's unfortunate that the mangling includes the low-level structs. Nevertheless, we need this for binary compatibility with GCC.
llvm-svn: 76755
2009-07-22 17:14:51 +00:00
Eli Friedman
5173349565
Switch some functions from using x86 builtins to using vector
...
operations.
llvm-svn: 76753
2009-07-22 17:08:01 +00:00
Mike Stump
7a5eaf6dd4
Add some documentation, to make it so the next person doens't select
...
the wrong function. :-)
llvm-svn: 76752
2009-07-22 16:55:20 +00:00
Steve Naroff
51d4f79ffa
Fix <rdar://problem/6770276> Support Class<Proto> syntax.
...
llvm-svn: 76741
2009-07-22 16:07:01 +00:00
Douglas Gregor
a3a4dd5d03
Test template instantiation for member functions of class templates defined
...
out of line.
llvm-svn: 76740
2009-07-22 15:45:39 +00:00
Eli Friedman
5ac69057c0
Make vectorized floating-point comparisons work without crashing.
...
llvm-svn: 76726
2009-07-22 06:07:16 +00:00
Ted Kremenek
952a004298
Restructure ProgramPoint to have the 'Kind' value be its own instance
...
variable. This gives us much more flexibility with defining more
ProgramPoints, which is the direction we are heading. The removal of
various bit-mangling of pointers also cleans up the logic.
llvm-svn: 76721
2009-07-22 04:38:22 +00:00
Ted Kremenek
920ad71dab
Temporarily disable most use of region casts in RegionStoreManager,
...
instead preferring to use the a region's actual type when creating
symbols and using the QualType passed to Retrieve for implicit
casting. This preprocessor logic is temporary; eventually we will
either remove region casts or keep them.
Temporarily toggle (via preprocessor directives) that SymbolicRegions
with heap storage are not undefined, but instead should be
symbolicated. If we want to model that a SymbolicRegion is
uninitialized, we can explicitly model that by binding UndefinedVal to
that region. It turns out that we want to treat most heap objects as
being defined, not the other way around.
llvm-svn: 76720
2009-07-22 04:35:42 +00:00
Ted Kremenek
b2d0409d50
Fix a crasher in StoreManager::InvalidateRegion() caused by using the
...
'cast type' of a region to invalidate its binding. This only occurs
when using RegionStoreManager, as it records the cast type. I'm
currently considering removing the notion of a cast type (see
comments in code).
llvm-svn: 76719
2009-07-22 04:23:20 +00:00
Mon P Wang
acedf7768f
Preserve address space information through member accesses, e.g.,
...
__attribute__((address_space(1))) struct {int arr[ 3 ]; } *p1;
... = p1->arr[2]; // load from address space 1
llvm-svn: 76717
2009-07-22 03:08:17 +00:00
Mike Stump
18366cbe97
Remove an unneeded header.
...
llvm-svn: 76716
2009-07-22 01:39:14 +00:00
Mike Stump
753d120975
Prep for new warning.
...
llvm-svn: 76709
2009-07-22 00:43:08 +00:00
Fariborz Jahanian
891436d54c
Minor mod. per Doug's comment.
...
llvm-svn: 76708
2009-07-22 00:42:46 +00:00
Douglas Gregor
168190d822
Complain if we're entering the context of a dependent nested-name-specifier but
...
cannot match that nested-name-specifier to a class template or class template
partial specialization.
llvm-svn: 76704
2009-07-22 00:28:09 +00:00
Douglas Gregor
d8d297c0ac
Basic parsing and semantic analysis for out-of-line definitions of the
...
member functions of class templates, e.g.,
template<typename T>
struct X {
void f(T);
};
template<typename T> X<T>::f(T) { /* ... */ }
llvm-svn: 76692
2009-07-21 23:53:31 +00:00
Mike Stump
93a7ed1fc7
Revert this, we can now avoid error cascades better.
...
llvm-svn: 76691
2009-07-21 23:52:50 +00:00
Mike Stump
5c1acd1f33
Revert this, was a bug in my new warning code, not the test case.
...
llvm-svn: 76690
2009-07-21 23:50:15 +00:00
Mike Stump
0ab3c3deac
Revert this, we have a better way to do this.
...
llvm-svn: 76687
2009-07-21 23:47:12 +00:00
Mike Stump
d8679446a3
Revert this, we have a better way to handle this.
...
llvm-svn: 76685
2009-07-21 23:45:39 +00:00
Mike Stump
d7b9282e48
Revert recent change, I now have a better way to solve this (thanks Chris).
...
llvm-svn: 76681
2009-07-21 23:41:23 +00:00
Ted Kremenek
8be513822c
Fix long-lurking bug in ObjCSummaryCache revealed by Torok's recent memory
...
poisoning changes to DenseMap. We were using an iterator after it had been
invalidated by an insertion into the DenseMap.
llvm-svn: 76677
2009-07-21 23:27:57 +00:00
Mike Stump
bdbe099dd2
Prep for new warning.
...
llvm-svn: 76670
2009-07-21 22:54:02 +00:00
Fariborz Jahanian
aee31ac316
Patch to accomodate Doug's comment on default
...
destruction of base/members for each destructor AST.
llvm-svn: 76663
2009-07-21 22:36:06 +00:00
Ted Kremenek
c1986570ed
Remove stale comment and fix RUN line.
...
llvm-svn: 76656
2009-07-21 21:48:25 +00:00
Ted Kremenek
f0951f6d41
Add test case for PR 4596, which is already fixed due to Steve Naroff's overhaul of the Objective-C type system, but isn't in a checker build yet.
...
llvm-svn: 76648
2009-07-21 21:21:04 +00:00
Ted Kremenek
6dec002981
Patch by Stefan Bühler: Escape text in macro expansion when emitting HTML in the HTMLRewriter.
...
This fixes PR 4602.
llvm-svn: 76647
2009-07-21 21:16:46 +00:00
Ted Kremenek
4fd8f73c93
Update stale comment.
...
llvm-svn: 76644
2009-07-21 21:09:31 +00:00
Mike Stump
e303c9e468
Prep for new warning.
...
llvm-svn: 76643
2009-07-21 21:06:08 +00:00
Ted Kremenek
1e35dfac17
Reorder files.
...
llvm-svn: 76642
2009-07-21 21:03:50 +00:00
Ted Kremenek
ac7c7240f0
Fix PR 4594 by refactoring almost all casting logic from GRExprEngine::VisitCast
...
to SValuator::EvalCast. In the process, the StoreManagers now use this new cast
machinery, and the hack in GRExprEngine::EvalBind to handle implicit casts
involving OSAtomicCompareAndSwap and friends has been removed (and replaced with
logic closer to the logic specific to those functions).
llvm-svn: 76641
2009-07-21 21:03:30 +00:00
Mike Stump
df3f1447e4
Prep for new warning.
...
llvm-svn: 76640
2009-07-21 21:03:09 +00:00
Mike Stump
5e7869f63e
Prep for new warning.
...
llvm-svn: 76638
2009-07-21 20:52:43 +00:00
Mike Stump
087a3f7e0d
Prep for new warning.
...
llvm-svn: 76637
2009-07-21 20:50:41 +00:00
Daniel Dunbar
08e41d65a2
driver: Print --version on stdout, to match gcc.
...
- Patch by Jean-Daniel Dupas
llvm-svn: 76632
2009-07-21 20:06:58 +00:00
Eli Friedman
952c15dd52
Misc fixes for -Wreorder:
...
1. Make it work correctly with anonymous unions.
2. Don't compute it if the warning isn't enabled.
3. Optimize the algorithm slightly to make it linear time in the
case where we don't produce any warnings.
llvm-svn: 76630
2009-07-21 19:28:10 +00:00
Mike Stump
f4464156cf
Prep for new warning.
...
llvm-svn: 76628
2009-07-21 19:03:43 +00:00
Mike Stump
447351f1ff
Prep for new warning.
...
llvm-svn: 76627
2009-07-21 19:02:55 +00:00
Mike Stump
c4e34f2d8b
Prep for new warning.
...
llvm-svn: 76626
2009-07-21 19:01:48 +00:00
Mike Stump
d6fce57ba7
Prep for new warning.
...
llvm-svn: 76625
2009-07-21 19:01:31 +00:00
Mike Stump
414c3b435a
Prep for new warning.
...
llvm-svn: 76624
2009-07-21 19:01:01 +00:00
Mike Stump
a319fe36c3
Prep for new warning.
...
llvm-svn: 76623
2009-07-21 19:00:12 +00:00
Douglas Gregor
ddbf4e0c2c
Make Sema::ActOnCXXEnterDeclaratorScope robust against failures to compute
...
the declaration context, as occurs with out-of-line class template member
definitions.
llvm-svn: 76622
2009-07-21 18:59:28 +00:00
Mike Stump
3fe60b2118
Prep for new warning.
...
llvm-svn: 76621
2009-07-21 18:59:16 +00:00
Mike Stump
d74687fac6
Prep for new warning.
...
llvm-svn: 76620
2009-07-21 18:58:50 +00:00
Mike Stump
13876e914b
Prep for new warning.
...
llvm-svn: 76619
2009-07-21 18:58:15 +00:00
Mike Stump
4cac3e34e5
Prep for new warning.
...
llvm-svn: 76617
2009-07-21 18:57:14 +00:00
Mike Stump
5fbc72bfd5
Prep for new warning.
...
llvm-svn: 76616
2009-07-21 18:56:34 +00:00
Mike Stump
6a2bf11c55
Prep for new warning.
...
llvm-svn: 76614
2009-07-21 18:56:04 +00:00
Mike Stump
0aaf1308fc
Prep for new warning.
...
llvm-svn: 76613
2009-07-21 18:54:29 +00:00
Mike Stump
6a18fb2dad
Prep for new warning.
...
llvm-svn: 76611
2009-07-21 18:52:41 +00:00
Mike Stump
9832fcb598
Prep for new warning.
...
llvm-svn: 76610
2009-07-21 18:51:31 +00:00
Mike Stump
c2ec778641
Prep for new warning.
...
llvm-svn: 76609
2009-07-21 18:48:43 +00:00
Mike Stump
79a9f20c4d
Prep for new warning.
...
llvm-svn: 76608
2009-07-21 18:46:15 +00:00
Mike Stump
41ecf6cc3d
Prep for new warning.
...
llvm-svn: 76607
2009-07-21 18:45:53 +00:00
Mike Stump
d1ee66e412
Prep for new warning.
...
llvm-svn: 76606
2009-07-21 18:45:22 +00:00
Mike Stump
77cfd7a9ca
Prep for new warnings about control flow falling off the ends of
...
functions that return a value. I was going to buffer the whole lot
up, but it should be easier to review if I check them in
incrementally. Most of the forth coming changes either add a return
value, or make it impossible to return, or alter the return type.
llvm-svn: 76605
2009-07-21 18:44:24 +00:00
Owen Anderson
a265a3876c
Update for LLVM API change.
...
llvm-svn: 76599
2009-07-21 18:06:41 +00:00
Argyrios Kyrtzidis
33c70c9388
Consider nested-names as part of the declarator when resolving an ambiguous statement.
...
llvm-svn: 76583
2009-07-21 17:05:03 +00:00
Fariborz Jahanian
b154ecafa6
Diagnose when a destructor uses a unrelated class type as its name.
...
llvm-svn: 76577
2009-07-21 15:28:50 +00:00
Douglas Gregor
82fe3e3398
Add the location of the tag keyword into TagDecl. From Enea
...
Zaffanella, with tweaks from Abramo Bagnara.
llvm-svn: 76576
2009-07-21 14:46:17 +00:00
Duncan Sands
49c29ee43f
Disambiguate an if statement.
...
llvm-svn: 76547
2009-07-21 07:56:29 +00:00
Argyrios Kyrtzidis
8274ad5281
Remove the ASTContext parameter from Entity::getPrintableName().
...
llvm-svn: 76546
2009-07-21 07:52:21 +00:00
Argyrios Kyrtzidis
11982922be
Add an assert for safety check.
...
llvm-svn: 76539
2009-07-21 06:48:06 +00:00
Argyrios Kyrtzidis
1a176f0b96
Fix a crash that occurs in this C++ case:
...
struct foo {
static bool value;
};
bool (foo::value); // crash because of parens
llvm-svn: 76538
2009-07-21 06:43:26 +00:00
Owen Anderson
f319a7d6e7
Update for LLVM API change.
...
llvm-svn: 76534
2009-07-21 02:57:15 +00:00
Argyrios Kyrtzidis
3b4e2a7621
Keep only canonical Decls in Entities.
...
llvm-svn: 76532
2009-07-21 02:10:32 +00:00
Mike Stump
3557ea840b
Wire up CFG improvements for __builtin_choose_expr.
...
llvm-svn: 76531
2009-07-21 01:46:17 +00:00
Mike Stump
8d50b6aeff
Wire up CFG improvements for do { } while () when the condition is known.
...
llvm-svn: 76530
2009-07-21 01:27:50 +00:00
Mike Stump
014b3eabd1
Wire up for statement CFG improvements for conditionals that are known.
...
llvm-svn: 76529
2009-07-21 01:12:51 +00:00
Mike Stump
23a443bea7
Wire up CFG improvements for while when the condition is known.
...
llvm-svn: 76522
2009-07-21 00:38:52 +00:00
Argyrios Kyrtzidis
d0a31d2c5a
Remove a file from the test directory that was added by mistake.
...
llvm-svn: 76518
2009-07-21 00:17:57 +00:00
Ted Kremenek
fe12f88924
RegionStore:
...
-refactor logic for retrieving bindings from VarDecls into
RegionStoreManager::RetrieveVar()
- improve RegionStoreManager::CastRetrievedVal() and SimpleSValuate::EvalCastNL
to better handle casts of values of the same canonical type as well as
casts of LocAsInteger values.
llvm-svn: 76516
2009-07-21 00:12:07 +00:00
Argyrios Kyrtzidis
05ac8276cf
Change the semantics for Entity.
...
Entity can now refer to declarations that are not visible outside the translation unit.
It is a wrapper of a pointer union, it's either a Decl* for declarations that don't
"cross" translation units, or an EntityImpl* which is associated with the specific "visible" Decl.
Included is a test case for handling fields across translation units.
llvm-svn: 76515
2009-07-21 00:07:06 +00:00
Ryan Flynn
ed73cac647
define __STDC_VERSION__ processor token for c94
...
llvm-svn: 76514
2009-07-21 00:07:02 +00:00
Argyrios Kyrtzidis
851b208a20
Use temporary output to avoid running index-test with the same commands multiple times.
...
llvm-svn: 76513
2009-07-21 00:06:46 +00:00
Argyrios Kyrtzidis
a8cf0beeef
Implement the virtual getNextRedeclaration() for ObjCMethodDecl.
...
If it's in an ObjCContainerDecl, its "redeclaration" is the method definition in the corresponding ObjCImplDecl.
If it's in an ObjCImplDecl, its "redeclaration" is the method in the interface.
llvm-svn: 76512
2009-07-21 00:06:36 +00:00
Argyrios Kyrtzidis
60e9b7cf58
Add an assertion for the return value of Decl::getNextRedeclaration().
...
llvm-svn: 76511
2009-07-21 00:06:27 +00:00
Argyrios Kyrtzidis
1559d67b7a
Remove the ObjCCategoryImpls vector from Sema class.
...
Use ObjCInterfaceDecl::getCategoryClassMethod() and ObjCInterfaceDecl::getCategoryInstanceMethod() for the same functionality.
llvm-svn: 76510
2009-07-21 00:06:20 +00:00
Argyrios Kyrtzidis
43cee935ae
Remove Sema::LookupObjCImplementation and replace it with just calling ObjCInterfaceDecl::getImplementation().
...
llvm-svn: 76509
2009-07-21 00:06:04 +00:00
Argyrios Kyrtzidis
6d9fab7619
- Introduce ASTContext::getObjCImplementation() and ASTContext::setObjCImplementation() which use a DenseMap to associate
...
an interface/category with its implementation (if one exists).
- Introduce ObjCInterfaceDecl::get/setImplementation() and ObjCCategoryDecl::get/setImplementation() that use the above methods.
- Add a compiler error for when a category is reimplemented.
llvm-svn: 76508
2009-07-21 00:05:53 +00:00
Argyrios Kyrtzidis
b78139f74d
Handle references from ObjCIvarRefExprs.
...
llvm-svn: 76507
2009-07-21 00:05:38 +00:00
Argyrios Kyrtzidis
153d418def
Add '\n' to the end of error message.
...
llvm-svn: 76506
2009-07-21 00:05:10 +00:00
Mike Stump
0d76d075e4
Add yet more analysis for CFGs involving conditionals that are actually constant.
...
llvm-svn: 76500
2009-07-20 23:24:15 +00:00
Fariborz Jahanian
83381cc9a6
Move EmitCtorPrologue to CGCXX. Add an assert and FIXMEs.
...
llvm-svn: 76498
2009-07-20 23:18:55 +00:00
Ted Kremenek
834e2f69da
Enhanced IsReinterpreted() (RegionStore.cpp) to reason about higher-order
...
pointers.
Enhanced RegionStoreManager::Retrieve() to handle automatic casts when the
loaded value is different from the requested value. This should be refined over
time, but essentially we should always symbolicate locations as locations, and
convert them to non-locations on demand.
These changes now cause 'misc-ps.m' to pass again.
llvm-svn: 76497
2009-07-20 22:58:02 +00:00
Fariborz Jahanian
c0656de03d
Improve message for bad destructor decl. Per Doug's comment.
...
llvm-svn: 76494
2009-07-20 22:41:12 +00:00
Fariborz Jahanian
127059c7ec
Early ir-gen for constructor prologue. This is on going.
...
llvm-svn: 76493
2009-07-20 22:35:22 +00:00
Douglas Gregor
d12df6b160
Reuse VarDecl::Init to store the default argument of a ParmVarDecl,
...
reducing the size of ParmVarDecl by one pointer. Also means that we'll
properly (de-)serialize default arguments in C++ PCH files.
llvm-svn: 76487
2009-07-20 22:03:28 +00:00
Ted Kremenek
2f730c8aed
This test now passes with RegionStore.
...
llvm-svn: 76484
2009-07-20 21:44:10 +00:00
Ted Kremenek
77f7fc5e85
Enhance GRExprEngine::EvalBind to handle some implicit casts from nonlocs to
...
locs and vis versa.
llvm-svn: 76483
2009-07-20 21:43:20 +00:00
Ted Kremenek
aadd463e0e
Enhance SimpleSValuator to handle nonloc::LocAsInteger -> location casts.
...
llvm-svn: 76481
2009-07-20 21:39:27 +00:00
Mike Stump
17051250ad
Remove an apparently unused forward class decl.
...
llvm-svn: 76476
2009-07-20 21:23:55 +00:00
Mike Stump
94e12450aa
Remove an apparently unused header.
...
llvm-svn: 76473
2009-07-20 21:17:53 +00:00
Ted Kremenek
bf04f98c1f
Add XFAILED test.
...
llvm-svn: 76469
2009-07-20 21:00:55 +00:00
Ted Kremenek
a1f9c7fb3b
Add FIXME.
...
llvm-svn: 76466
2009-07-20 20:38:59 +00:00
Douglas Gregor
959cc7aaaa
When a field is variable-sized or is an array with a negative size,
...
don't replace the type of the field with 'int', from Enea Zaffanella!
llvm-svn: 76454
2009-07-20 18:55:14 +00:00
Ted Kremenek
619eece347
Update DataflowSolver to handle the case where a successor/predecessor block
...
could be NULL. This allows the solver to handle optimized CFGs where branches
can be determined during CFG-construction to be infeasible.
llvm-svn: 76452
2009-07-20 18:52:34 +00:00
Douglas Gregor
47d2859b3e
Improve GCC compatibility by allowing static tentative definitions of
...
incomplete type (with a warning), from Enea Zaffanella!
llvm-svn: 76451
2009-07-20 18:46:59 +00:00
Ted Kremenek
af9f362840
Enhance GRBranchNodeBuilderImpl (part of GRCoreEngine) to understand the case
...
where the true or false CFGBlock* for a branch could be NULL. This will handle
the case where we can determine during CFG construction that a branch is
infeasible.
llvm-svn: 76450
2009-07-20 18:44:36 +00:00
Steve Naroff
accc488785
5 cleanups to ObjCObjectPointerType work:
...
- Remove Sema::CheckPointeeTypesForAssignment(), a temporary API I added to ease migration to ObjCObjectPointerType. Convert Sema::CheckAssignmentConstraints() to no longer depend on the temporary API.
- Sema::ConvertDeclSpecToType(): Replace a couple FIXME's with an important comment/example.
- Sema::GetTypeForDeclarator(): Get the protocol's from the interface, NOT the declspec (to support the following C typedef idiom: "typedef C<P> T; T *obj").
- Sema::ObjCQualifiedIdTypesAreCompatible(): Removed some dead code.
- ASTContext::getObjCEncodingForTypeImpl(): Some minor cleanups.
llvm-svn: 76443
2009-07-20 17:56:53 +00:00
Fariborz Jahanian
4041dfc360
Issue a more descriptive diagnostics when mis-declaring
...
a destructor.
llvm-svn: 76436
2009-07-20 17:43:15 +00:00
Zhongxing Xu
34e0370502
The children statements might be NULL. Check for this case in
...
isContainedInStatement().
llvm-svn: 76408
2009-07-20 08:28:49 +00:00
Ted Kremenek
7d3a334298
Implement FIXME in pretty-printing for StringRegions.
...
llvm-svn: 76381
2009-07-19 20:38:24 +00:00
Ted Kremenek
291e8f770e
Improve debug pretty-printing for ObjCIVarRegions.
...
llvm-svn: 76380
2009-07-19 20:36:24 +00:00
Chris Lattner
9662cd3227
enhance the goto checker to reject jumps across __block variable definitions.
...
llvm-svn: 76376
2009-07-19 20:17:11 +00:00
Daniel Dunbar
ea3060a9e5
Catch another trivial case where we can avoid emitting a separate return blcok.
...
llvm-svn: 76365
2009-07-19 08:24:34 +00:00
Daniel Dunbar
c3ab4c6c98
Detect when the current generation point is unreachable after emitting
...
expressions.
- This generally catches the important case of noreturn functions.
- With the last two changes, we are down to 152 unreachable blocks emitted on
403.gcc, vs the 1805 we started with.
llvm-svn: 76364
2009-07-19 08:23:12 +00:00
Daniel Dunbar
669521c97c
Fix thinko.
...
llvm-svn: 76362
2009-07-19 07:03:11 +00:00