Commit Graph

54335 Commits

Author SHA1 Message Date
Anders Carlsson 978f08d9b4 Pass the location of the start of the selector to ActOnClassMessage/ActOnInstanceMessage.
llvm-svn: 64560
2009-02-14 18:21:46 +00:00
Mike Stump eff0cc98cf Fix 80col violations.
llvm-svn: 64559
2009-02-14 18:02:21 +00:00
Ted Kremenek 7efe43db99 Patch by Ben Laurie:
ConstraintManager:
- constify getSymVal()

BasicConstraintManager:
- Pull out logic that would be common to ConstraintManagers of a similar nature
  and put them in a parent class called 'SimpleConstraintManager'.

RangeConstraintManager:
- Added a new prototype ConstraintManager to track ranges of variables! This
  ConstraintManager keeps tracks of ranges of concrete integers that a symbolic
  integer may have.

AnalysisConsumer:
- Add driver option to use RangeConstraintManager with GRExprEngine-based
  analyses.

llvm-svn: 64558
2009-02-14 17:08:39 +00:00
Anton Korobeynikov 7e96595f11 Define __ELF__ on FreeBSD. Patch by Roman Divacky!
llvm-svn: 64557
2009-02-14 16:42:50 +00:00
Cedric Venet d3c80de95f Fix the build on win32.
llvm-svn: 64556
2009-02-14 16:15:20 +00:00
Cedric Venet b8aa2ea72a Add mode_t to the config.h generated by cmake on win32. Used by clang.
llvm-svn: 64555
2009-02-14 16:13:26 +00:00
Cedric Venet d1e179d992 Unbreak the build on win32.
Cleanup some warning.

Remark: when struct/class are declared differently than they are defined, this make problem for VC++ since it seems to mangle class differently that struct. These error are very hard to understand and find. So please, try to keep your definition/declaration in sync.

Only tested with VS2008. hope it does not break anything. feel free to revert.

llvm-svn: 64554
2009-02-14 16:06:42 +00:00
Argyrios Kyrtzidis d831cac2a7 Define __ELF__ for linux systems.
llvm-svn: 64553
2009-02-14 15:02:45 +00:00
Duncan Sands 73247d2edc Generalize some alias analysis logic from atomic
intrinsics to any IntrWriteArgMem intrinsics.

llvm-svn: 64551
2009-02-14 10:56:35 +00:00
Mikhail Glushenkov 0575bfdeaa 80-column violation.
llvm-svn: 64550
2009-02-14 08:41:25 +00:00
Chris Lattner aff301478a new tests, it would be nice to not warn on the second one.
llvm-svn: 64549
2009-02-14 08:27:44 +00:00
Chris Lattner 7320f9c9ad simplify some code.
llvm-svn: 64548
2009-02-14 08:22:25 +00:00
Chris Lattner 62bf958247 just ignore hte format_arg attribute for now, it doesn't have any semantic implications.
llvm-svn: 64547
2009-02-14 08:12:47 +00:00
Chris Lattner 677a35804f add parser and type checking support for attribute((objc_exception)).
We don't have "zero cost" exceptions for ObjC yet, so there is no codegen
support required.

llvm-svn: 64546
2009-02-14 08:09:34 +00:00
Chris Lattner 9844408ad6 rename test
llvm-svn: 64545
2009-02-14 08:08:05 +00:00
Chris Lattner 237f27573f Several related changes:
1) implement parser and sema support for reading and verifying attribute(warnunusedresult).
2) rename hasLocalSideEffect to isUnusedResultAWarning, inverting the sense
   of its result.
3) extend isUnusedResultAWarning to directly return the loc and range 
   info that should be reported to the user.  Make it substantially more
   precise in some cases than what was previously reported.
4) teach isUnusedResultAWarning about CallExpr to decls that are 
   pure/const/warnunusedresult, fixing a fixme.
5) change warn_attribute_wrong_decl_type to not pass in english strings, instead,
   pass in integers and use %select.

llvm-svn: 64543
2009-02-14 07:37:35 +00:00
Chris Lattner 3a23073918 reduce nesting.
llvm-svn: 64542
2009-02-14 07:22:29 +00:00
Ted Kremenek d25fb7a613 GRExprEngine: Handle empty statement expressions.
llvm-svn: 64541
2009-02-14 05:55:08 +00:00
Duncan Sands 1ba13931b6 The trampoline intrinsic can be marked IntrWriteArgMem,
now that this no longer implies nocapture.

llvm-svn: 64540
2009-02-14 05:33:26 +00:00
Duncan Sands 809d9167da IntrWriteArgMem implies nocapture, but this wasn't
taken advantage of anywhere.  Change the definition
of IntrWriteArgMem to no longer imply nocapture, and
explicitly add nocapture attributes everywhere (well,
not quite everywhere, because some of these intrinsics
did capture their arguments!).  Also, make clear that
the lack of other side-effects does not exclude doing
volatile loads or stores - the atomic intrinsics do
these, yet they are all marked IntrWriteArgMem (this
change is safe because nothing exploited it).

llvm-svn: 64539
2009-02-14 05:16:25 +00:00
Anders Carlsson 0ed56a1b9f Don't ignore the const attribute - we even have CG support for that. Do ignore the malloc attribute however.
llvm-svn: 64538
2009-02-14 04:12:57 +00:00
Anders Carlsson 11352f9d63 Fix more xmmintrin.h typos
llvm-svn: 64537
2009-02-14 04:01:38 +00:00
Chris Lattner b12f4f8731 ignore the const attribute for now.
llvm-svn: 64536
2009-02-14 03:51:44 +00:00
Dan Gohman 29705333e5 The x86-64 red zone is now being used.
llvm-svn: 64535
2009-02-14 03:30:05 +00:00
Ted Kremenek 4e9d4b5d48 Added GRStateManager::scanReachableSymbols(), a method which scans the reachable
symbols from an SVal.

- Fixed a bug in EnvironmentManager::RemoveDeadBindings() where it did not mark
  live all the symbols reachable from a live block-level expression.

- Fixed a bug in the retain/release checker where it did not stop tracking
  symbols that 'escaped' via compound literals being assigned to something the
  BasicStoreManager didn't reason about.

llvm-svn: 64534
2009-02-14 03:16:10 +00:00
Daniel Dunbar 3d88672f64 x86_64 ABI: Need to use canonical types when comparing against
ASTContext types.

llvm-svn: 64533
2009-02-14 02:45:45 +00:00
Dan Gohman 671f2c085f Extend the IndVarSimplify support for promoting induction variables:
- Test for signed and unsigned wrapping conditions, instead of just
   testing for non-negative induction ranges. 
 - Handle loops with GT comparisons, in addition to LT comparisons.
 - Support more cases of induction variables that don't start at 0.

llvm-svn: 64532
2009-02-14 02:31:09 +00:00
Dan Gohman 47ff6aad23 Clarify debug output.
llvm-svn: 64531
2009-02-14 02:26:50 +00:00
Dan Gohman 4bfa1d4c63 Simplify some code. hasComputableLoopEvolution is overkill in this case.
No functionality change.

llvm-svn: 64530
2009-02-14 02:25:19 +00:00
Daniel Dunbar 019ef0bbfe x86_64 ABI: Pass simple types directly when possible. This is
important for both keeping the generated LLVM simple and for ensuring
that integer types are passed/promoted correctly.

llvm-svn: 64529
2009-02-14 02:09:24 +00:00
Ted Kremenek 13363538ca Use GRTransferFuncs::EvalBind when processing variable initializations.
llvm-svn: 64527
2009-02-14 01:54:57 +00:00
Douglas Gregor 538c3d8459 Make it possible for builtins to expression FILE* arguments, so that
we can define builtins such as fprintf, vfprintf, and
__builtin___fprintf_chk. Give a nice error message when we need to
implicitly declare a function like fprintf.

llvm-svn: 64526
2009-02-14 01:52:53 +00:00
Ted Kremenek e68c0fcfb2 Static analyzer:
- Added a new 'node builder' class called GRStmtNodeBuilderRef (name may
  change). This is essentially a smart reference to a GRStmtNodeBuilder object
  that keeps track of the current context (predecessor node, GRExprEngine
  object, etc.) The idea is to gradually simplify the interface between
  GRExprEngine and GRTransferFuncs using this new builder (i.e., passing 1
  argument instead of 5). It also handles some of the "auto-transition" for node
  creation, simplifying some of the logic in GRExprEngine itself.

- Used GRStmtBuilderRef to replace GRTransferFuncs::EvalStore with
  GRTransferFuncs::EvalBind. The new EvalBind method will be used at any
  arbitrary places where a binding between a location and value takes place.
  Moreover, GRTransferFuncs no longer has the responsibility to request
  StoreManager to do the binding; this is now in GRExprEngine::EvalBind. All
  GRTransferFuncs::EvalBind does is checker-specific logic (which can be a
  no-op).

llvm-svn: 64525
2009-02-14 01:43:44 +00:00
Anders Carlsson 30c22d86e8 Fix an error in _mm_loaddup_pd that Eli noticed.
llvm-svn: 64522
2009-02-14 01:06:58 +00:00
Anders Carlsson 823c02eaab Add the nodebug attribute to intrinsics
llvm-svn: 64519
2009-02-14 01:00:11 +00:00
Douglas Gregor 2de3e31cf8 Add test case to insure that implicit builtin declarations for C library functions aren't created in C++
llvm-svn: 64513
2009-02-14 00:37:42 +00:00
Douglas Gregor ac5d4c5f8e Extend builtin "attribute" syntax to include a notation for
printf-like functions, both builtin functions and those in the
C library. The function-call checker now queries this attribute do
determine if we have a printf-like function, rather than scanning
through the list of "known functions IDs". However, there are 5
functions they are not yet "builtins", so the function-call checker
handles them specifically still:

  - fprintf and vfprintf: the builtins mechanism cannot (yet)
    express FILE* arguments, so these can't be encoded.
  - NSLog: the builtins mechanism cannot (yet) express NSString*
    arguments, so this (and NSLogv) can't be encoded.
  - asprintf and vasprintf: these aren't part of the C99 standard
    library, so we really shouldn't be defining them as builtins in
    the general case (and we don't seem to have the machinery to make
    them builtins only on certain targets and depending on whether
    extensions are enabled).

llvm-svn: 64512
2009-02-14 00:32:47 +00:00
Dale Johannesen 6e1b2e36a5 Testcase for llvm-gcc 64510.
llvm-svn: 64511
2009-02-14 00:19:28 +00:00
Ted Kremenek 10251c91a8 Update checker build.
llvm-svn: 64507
2009-02-13 23:41:12 +00:00
Chris Lattner cd7bc144f6 fix rdar://6586493, a bug in codegen of the GNU
missing-?:-true-value extension.

llvm-svn: 64505
2009-02-13 23:35:32 +00:00
Douglas Gregor b9063fc1b3 Implicitly declare certain C library functions (malloc, strcpy, memmove,
etc.) when we perform name lookup on them. This ensures that we
produce the correct signature for these functions, which has two
practical impacts:

  1) When we're supporting the "implicit function declaration" feature
  of C99, these functions will be implicitly declared with the right
  signature rather than as a function returning "int" with no
  prototype. See PR3541 for the reason why this is important (hint:
  GCC always predeclares these functions).
 
  2) If users attempt to redeclare one of these library functions with
  an incompatible signature, we produce a hard error.

This patch does a little bit of work to give reasonable error
messages. For example, when we hit case #1 we complain that we're
implicitly declaring this function with a specific signature, and then
we give a note that asks the user to include the appropriate header
(e.g., "please include <stdlib.h> or explicitly declare 'malloc'"). In
case #2, we show the type of the implicit builtin that was incorrectly
declared, so the user can see the problem. We could do better here:
for example, when displaying this latter error message we say
something like:

  'strcpy' was implicitly declared here with type 'char *(char *, char
  const *)'

but we should really print out a fake code line showing the
declaration, like this:

  'strcpy' was implicitly declared here as:

    char *strcpy(char *, char const *)

This would also be good for printing built-in candidates with C++
operator overloading.

The set of C library functions supported by this patch includes all
functions from the C99 specification's <stdlib.h> and <string.h> that
(a) are predefined by GCC and (b) have signatures that could cause
codegen issues if they are treated as functions with no prototype
returning and int. Future work could extend this set of functions to
other C library functions that we know about.

llvm-svn: 64504
2009-02-13 23:20:09 +00:00
Chris Lattner 190f64e9b8 add an assertion from Alexei Svitkine!
llvm-svn: 64503
2009-02-13 23:06:48 +00:00
Daniel Dunbar f9f039865f Set constant bit on static block vars as well. Patch by Anders Johnson!q
llvm-svn: 64502
2009-02-13 22:58:39 +00:00
Daniel Dunbar 165b527507 Fix typo in printing of __private_extern__.
llvm-svn: 64501
2009-02-13 22:49:34 +00:00
Daniel Dunbar 5db3ef6fbb Simplify predicate.
llvm-svn: 64500
2009-02-13 22:49:13 +00:00
Daniel Dunbar 311bf2916b Warn about attribute used ignored on "extern int a
__attribute__((used))".

llvm-svn: 64499
2009-02-13 22:48:56 +00:00
Daniel Dunbar 0818b26362 Add VarDecl::hasExternalStorage (no functionality change).
llvm-svn: 64498
2009-02-13 22:48:27 +00:00
Chris Lattner 39bb0182bd anders johnson points out that some software depends on the
definition of __intptr_t_defined when stdint.h defines intptr_t.

llvm-svn: 64497
2009-02-13 22:43:13 +00:00
Evan Cheng c2fde91703 Teach x86 target -soft-float.
llvm-svn: 64496
2009-02-13 22:36:38 +00:00
Chris Lattner 7e4c81c8c6 Give TargetInfo a new IntPtrType to hold the intptr_t type for
a target.

Make Preprocessor.cpp define a new __INTPTR_TYPE__ macro based on this.

On linux/32, set intptr_t to int, instead of long.  This fixes PR3563.

llvm-svn: 64495
2009-02-13 22:28:55 +00:00