Commit Graph

27502 Commits

Author SHA1 Message Date
Rafael Espindola 7bcde197d7 Fix PR8796.
The problem was that we were asserting the we never added an empty class
to the same offset twice. This is not true for unions, where two members, empty
or not, can have the some offset.

llvm-svn: 122633
2010-12-29 23:02:58 +00:00
Roman Divacky dacbfe49ec set features for k8-sse3
llvm-svn: 122629
2010-12-29 13:28:29 +00:00
Abramo Bagnara fbd2c6a022 Added scalar casts test.
llvm-svn: 122599
2010-12-28 17:19:27 +00:00
Abramo Bagnara de85bd4f82 Canonicalize types before possible cast.
llvm-svn: 122592
2010-12-28 09:13:41 +00:00
Francois Pichet b7577657cd More __uuidof validation:
1. Do not validate for uuid attribute if the type is template dependent.
2. Search every class declaration and definition for the uuid attribute.

llvm-svn: 122578
2010-12-27 01:32:00 +00:00
David Chisnall 168b80f2c0 Add support for GNU runtime property set / get structure functions. Minor refactoring of Mac runtime (returns the same function for both, as the Mac runtimes currently only provide a single entry point for setting and getting struct properties, although this will presumably be fixed at some point).
llvm-svn: 122569
2010-12-26 22:13:16 +00:00
David Chisnall 6f0a7d224b Fix for PR8695.
llvm-svn: 122564
2010-12-26 20:12:30 +00:00
Chris Lattner ad3467ee89 The -fshort-wchar option causes wchar_t to become unsigned, in addition to being
16-bits in size.  Implement this by splitting WChar into two enums, like we have
for char.  This fixes a miscompmilation of XULRunner, PR8856.

llvm-svn: 122558
2010-12-25 23:25:43 +00:00
Michael J. Spencer bc7fcc2191 Remove all uses of PathV1::GetRootDirectory.
llvm-svn: 122552
2010-12-25 20:09:27 +00:00
Ted Kremenek 5614c46fcf Add basic support for pointer arithmetic in
SimpleSValBuilder.  This clears up some
false positives emitted by ArrayBoundCheckerV2
due to the lack of support for pointer arithmetic.

llvm-svn: 122546
2010-12-24 08:39:33 +00:00
Argyrios Kyrtzidis 9d6af5328e Remove the EntoSA directories.
llvm-svn: 122543
2010-12-24 06:19:58 +00:00
Chris Lattner 9c47b4ac28 don't use #pragma mark, it isn't portable.
llvm-svn: 122540
2010-12-24 04:45:23 +00:00
Michael J. Spencer 38e92f6734 ifndef _MSC_VER out #pragma mark on MSVC. It still tries to parse the text even
though it doesn't know what it is, and complains about invalid tokens ;/.

llvm-svn: 122538
2010-12-24 04:07:39 +00:00
Argyrios Kyrtzidis 338f9aaab2 Handle locations coming from macro instantiations properly in SourceManager::isBeforeInTranslationUnit().
Fixes rdar://8790245 and http://llvm.org/PR8821.

llvm-svn: 122536
2010-12-24 02:53:53 +00:00
John McCall 53fa71476d Refactor how we collect attributes during parsing, and add slots for attributes
on array and function declarators.  This is pretty far from complete, and I'll
revisit it later if someone doesn't beat me to it.

llvm-svn: 122535
2010-12-24 02:08:15 +00:00
Douglas Gregor b4d271ef46 Fix a thinko in a helper routine for template argument deduction that
caused an assertion when dealing with non-type template parameter
packs. Add some tests for deduction and instantiation of non-type
template parameter packs.

llvm-svn: 122534
2010-12-24 00:35:52 +00:00
Douglas Gregor 0da4a99ad3 Non-type template parameter packs cannot have default arguments.
llvm-svn: 122533
2010-12-24 00:20:52 +00:00
Douglas Gregor eb5a39deb2 When instantiating a non-type template parameter pack, be sure to
extract the appropriate argument from the argument pack (based on the
current substitution index, of course). Simple instantiation of pack
expansions involving non-type template parameter packs now works.

llvm-svn: 122532
2010-12-24 00:15:10 +00:00
Douglas Gregor da3cc0d3bf Add an AST representation for non-type template parameter
packs, e.g.,

  template<typename T, unsigned ...Dims> struct multi_array;

along with semantic analysis support for finding unexpanded non-type
template parameter packs in types, expressions, and so on.

Template instantiation involving non-type template parameter packs
probably doesn't work yet. That'll come soon.

llvm-svn: 122527
2010-12-23 23:51:58 +00:00
Douglas Gregor 0d0a965b62 Improve the diagnostic and recovery for missing colons after 'case'
and 'default' statements, including a Fix-It to add the colon:

test/Parser/switch-recovery.cpp:13:12: error: expected ':' after 'case'
    case 17 // expected-error{{expected ':' after 'case'}}
           ^
           :
test/Parser/switch-recovery.cpp:16:12: error: expected ':' after 'default'
    default // expected-error{{expected ':' after 'default'}}
           ^
           :

llvm-svn: 122522
2010-12-23 22:56:40 +00:00
Douglas Gregor 27b4c16fef Implement parsing of function parameter packs and non-type template
parameter packs (C++0x [dcl.fct]p13), including disambiguation between
unnamed function parameter packs and varargs (C++0x [dcl.fct]p14) for
cases like 

  void f(T...)

where T may or may not contain unexpanded parameter packs.

llvm-svn: 122520
2010-12-23 22:44:42 +00:00
Ted Kremenek 1d56c9eed7 Add -fobjc-default-synthesized-properties flag
to allow us to explicitly control whether or
not Objective-C properties are default synthesized.
Currently this feature only works when using
the -fobjc-non-fragile-abi2 flag (so there is
no functionality change), but we can now turn
off this feature without turning off all the features
coupled with -fobjc-non-fragile-abi2.

llvm-svn: 122519
2010-12-23 21:35:43 +00:00
Ted Kremenek d99bd55a5e Chris Lattner has strong opinions about directory
layout.  :)

Rename the 'EntoSA' directories to 'StaticAnalyzer'.

Internally we will still use the 'ento' namespace
for the analyzer engine (unless there are further
sabre rattlings...).

llvm-svn: 122514
2010-12-23 19:38:26 +00:00
John McCall 112407a90e Kill RecordType::getAddressSpace() and its fixme; that's just not how
address spaces work.

llvm-svn: 122511
2010-12-23 17:56:54 +00:00
Douglas Gregor dd7ec463be Reimplement the comparison of a class template partial
specialization's template arguments against the primary template's
template arguments using the obvious, correct method of checking the
injected-class-name type (C++ [temp.class.spec]p9b3). The previous
incarnation of this comparison attempted to use its own formulation of
the injected-class-name, which is redudant and, with the introduction
of variadic templates, became wrong (again).

llvm-svn: 122508
2010-12-23 17:13:55 +00:00
Douglas Gregor 8092e80095 When forming the injected-class-name of a variadic template, the
template argument corresponding to a template parameter pack is an
argument pack of a pack expansion of that template parameter
pack. Implements C++0x [temp.dep.type]p2 (at least, as much of it as
we can).

llvm-svn: 122498
2010-12-23 16:00:30 +00:00
Zhongxing Xu 845b52b7df When cast derived to base, only process MemRegionVal.
llvm-svn: 122494
2010-12-23 12:08:42 +00:00
Ted Kremenek ef33f0996c Rename headers: 'clang/GR' 'clang/EntoSA' and
update Makefile.

llvm-svn: 122493
2010-12-23 07:22:02 +00:00
Ted Kremenek 98857c9860 Rename static analyzer namespace 'GR' to 'ento'.
llvm-svn: 122492
2010-12-23 07:20:52 +00:00
Ted Kremenek bd5fcdf803 It's amazing what you find when you actually
set the RUN line correctly in a test file!

Mark a bunch of tests for ArrayBoundCheckerV2
as FIXME's, as our current lack of pointer
arithmetic handling causes these to be all
false positives/negatives.

llvm-svn: 122471
2010-12-23 02:42:49 +00:00
Ted Kremenek fe22d93906 Further tweak nonloc::ConcreteInt pretty printing
to correctly print out negative values for
signed integers.

llvm-svn: 122470
2010-12-23 02:42:46 +00:00
Ted Kremenek e73571b9cc Add WIP prototype of a new buffer overflow
checker based on using raw (symbolic) byte offsets
from a base region.

llvm-svn: 122469
2010-12-23 02:42:43 +00:00
Ted Kremenek 0dfe4b7a46 Change MemRegion extent type to be the same type used
for array indices.

llvm-svn: 122468
2010-12-23 02:42:36 +00:00
Ted Kremenek c9b76e4b6e Add 'getConditionType()' and 'getArrayIndexType()'
to SValBuilder.  These two query methods are useful
for constructing SVals.

llvm-svn: 122467
2010-12-23 02:42:34 +00:00
Ted Kremenek 08cbe57d00 Enhance pretty-printing for nonloc::ConcreteInt
to also include signedness and bitwidth of
the underlying integer.

llvm-svn: 122466
2010-12-23 02:42:31 +00:00
Douglas Gregor ca4d91d9f6 Implement the part of C++0x [temp.arg.explicit]p3 that pertains to
parameter packs. In particular, a parameter pack not otherwise deduced
is deduced to an empty parameter pack.

The C++0x wording here is a bit unfortunate; this should really only
apply to function templates, and it mentions "trailing" parameter
packs, which doesn't really make sense in the context of function
templates. Will file a core issue separately.

llvm-svn: 122463
2010-12-23 01:52:01 +00:00
Douglas Gregor d0ad2949fa Implement the rest of C++0x [temp.deduct.type]p9, which specifies that
the presence of a pack expansion anywhere except at the end of a
template-argument-list causes the entire template-argument-list to be
a non-deduced context.

llvm-svn: 122461
2010-12-23 01:24:45 +00:00
Jeffrey Yasskin b3321531a8 Change all self assignments X=X to (void)X, so that we can turn on a
new gcc warning that complains on self-assignments and
self-initializations.  Fix one bug found by the warning, in which one
clang::OverloadCandidate constructor failed to initialize its
FunctionTemplate member.

llvm-svn: 122459
2010-12-23 01:01:28 +00:00
Douglas Gregor 7a49ead680 Be paranoid about NULL size expressions in dependently-sized array types
llvm-svn: 122454
2010-12-22 23:15:38 +00:00
Douglas Gregor 7f8e7681ad Unify the consistency checking for deduced template arguments into a
single routine. Extend that routine to handle consistency
checking for template argument packs, so that we can compare the
deduced packs for template parameter packs across different pack
expansions.

llvm-svn: 122452
2010-12-22 23:09:49 +00:00
Daniel Dunbar d8f2dc8716 build: Use CLANG_NO_RUNTIME=1 specifically, not just any definition.
llvm-svn: 122449
2010-12-22 22:23:39 +00:00
Argyrios Kyrtzidis 4037302a8b Subsequent attempt to fix linux build.
llvm-svn: 122442
2010-12-22 21:41:01 +00:00
Douglas Gregor 0f3feb4e8d Implement template argument deduction for pack expansions whose
pattern is a template argument, which involves repeatedly deducing
template arguments using the pattern of the pack expansion, then
bundling the resulting deductions into an argument pack.

We can now handle a variety of simple list-handling metaprograms using
variadic templates. See, e.g., the new "count" metaprogram.

llvm-svn: 122439
2010-12-22 21:19:48 +00:00
Argyrios Kyrtzidis 986fc89034 Apparently I'm on a mission to break as many builds as possible.
llvm-svn: 122436
2010-12-22 21:10:38 +00:00
Argyrios Kyrtzidis 5629fece72 Forgot to move the files in CMakeLists.txt.
llvm-svn: 122433
2010-12-22 20:30:07 +00:00
Argyrios Kyrtzidis 6c696b7f98 Add GR/Checkers subdir for CMake build.
llvm-svn: 122432
2010-12-22 20:22:35 +00:00
Argyrios Kyrtzidis c60fc656c6 Move AnalysisConsumer.cpp and ExprEngine.cpp into the Checkers subdir temporarily
to avoid cyclic dependency between the libraries and fix the linux build.

llvm-svn: 122431
2010-12-22 20:15:43 +00:00
Fariborz Jahanian 0f0b302ffe Complain on missing property getter method only
if property-dot expression is decidedly
an rvalue. // rdar://8155806.

llvm-svn: 122430
2010-12-22 19:46:35 +00:00
Douglas Gregor d80ea20411 When performing template argument deduction where the argument is a
dependent template specialization type, the number of template
arguments need not match precisely. Rather than checking the number of
arguments eagerly (which does not consider argument packs), let the
deduction routine for template argument lists cope with too many/too
few arguments.

llvm-svn: 122425
2010-12-22 18:55:49 +00:00
Argyrios Kyrtzidis 1696f508e2 [analyzer] Refactoring: Drop the 'GR' prefix.
llvm-svn: 122424
2010-12-22 18:53:44 +00:00