Commit Graph

5177 Commits

Author SHA1 Message Date
Daniel Dunbar 3b358a3d83 Make debug info work when using -save-temps.
- This is pretty ugly, but the most obvious solution. Chime in if you
   have a nicer one.

 - The problem is that with -save-temps, clang-cc has no idea what the
   name of the original input file is. However, the user expects to be
   able to set breakpoints based on the input file name.

 - We support this by providing a new option -main-file-name (similar
   to -dumpbase used by gcc) which allows the driver to pass in the
   original file name.

 - <rdar://problem/6753383> building with clang using --save-temps
   gets the compile unit name from the .i file...

llvm-svn: 68595
2009-04-08 05:11:16 +00:00
Anders Carlsson 80f97ab08f Add a destination type argument to EmitConstantExpr. This will be used for when the destination has a reference type. (No functionality change yet)
llvm-svn: 68593
2009-04-08 04:48:15 +00:00
Daniel Dunbar 8f28d01126 Implementation definition of interfaces with __objc_exception attribute.
- Complete <rdar://problem/6635883> Support __objc_exception__
   attribute

llvm-svn: 68591
2009-04-08 04:21:03 +00:00
Sanjiv Gupta 562d68e8db Pointer width on targets like PIC16 is 16-bit, while the valid index size to GEP is only 32 or 64. So promote index to 32 in such cases.
llvm-svn: 68590
2009-04-08 04:16:39 +00:00
Chris Lattner 8bc98d9bed remove fixme!
llvm-svn: 68589
2009-04-08 03:47:39 +00:00
Chris Lattner 9591bbc4f6 improve compatibility with VC+, patch by John Thompson!
llvm-svn: 68586
2009-04-08 03:33:43 +00:00
Ted Kremenek 605fee8445 New static analyzer check by Nikita Zhuk!
"The attached patch generates warnings of cases where an ObjC message is sent to
a nil object and the size of return type of that message is larger than the size
of void pointer. This may result in undefined return values as described in PR
2718.  The patch also includes test cases."

llvm-svn: 68585
2009-04-08 03:07:17 +00:00
Daniel Dunbar ab7b2f5623 Set __PIC__ (more) correctly.
- Add -pic-level clang-cc option to specify the value for the define,
   updated driver to pass this.

 - Added __pic__

 - Added OBJC_ZEROCOST_EXCEPTIONS define while I was here (to match gcc).

llvm-svn: 68584
2009-04-08 03:03:23 +00:00
Anders Carlsson a60cbcdfe6 Don't assume that a block always has a FunctionProtoType. Fixes rdar://6768379.
llvm-svn: 68583
2009-04-08 02:55:55 +00:00
Mike Stump 9d54bd77c0 Add basic support for arm static analysis checking. Radar 6699395
llvm-svn: 68582
2009-04-08 02:07:04 +00:00
Daniel Dunbar d4510f2223 Driver: Fix forwarding of -fpascal-strings.
llvm-svn: 68570
2009-04-07 23:51:44 +00:00
Steve Naroff 65a0089eb7 Fix <rdar://problem/6764172> [sema] crash on invalid.
llvm-svn: 68568
2009-04-07 22:56:58 +00:00
Daniel Dunbar ea10ab668f Visibility attributes should only be set on definition.
llvm-svn: 68561
2009-04-07 22:36:33 +00:00
Daniel Dunbar c44b4ccca8 Driver: Fix forwarding of -{std,ansi,trigraphs} when there are
multiple instances of an option.

Also, removed direct -ansi support from clang-cc.

llvm-svn: 68558
2009-04-07 22:13:21 +00:00
Anders Carlsson 5f50c651e9 Shuffle some call code around. No functionality change.
llvm-svn: 68557
2009-04-07 22:10:22 +00:00
Daniel Dunbar 3a148f2625 Driver: Forward remaining -f options to clang manually.
- Groups are really just intended to hold inherent structure of the
   options, not be abused for individual tool argument translation.

llvm-svn: 68554
2009-04-07 21:51:40 +00:00
Daniel Dunbar 9dc82a2632 Driver: Only forward last instance of -mmacosx-version-min= and
-isysroot to clang.
 - Don't forward arbitrary -i* options to clang, just the ones we know
   about.

llvm-svn: 68553
2009-04-07 21:42:00 +00:00
Fariborz Jahanian 9ecb84bb21 Now that we have __weak defined as attribute in all modes,
we must not issue gc-specific errors in non-gc mode.

llvm-svn: 68551
2009-04-07 21:25:06 +00:00
Daniel Dunbar d18049ab1d Driver: Manually translate a number of -f with no- variants options to
clang.
 - We will eventually want some more driver infrastructre for this
   probably.

 - For now, the clang-cc interface stays relatively the same, but we
   don't accept multiple instances anymore, or the [no-] variants
   directly.

llvm-svn: 68550
2009-04-07 21:16:11 +00:00
Daniel Dunbar 30bf11e181 Driver: Add default for ArgList::hasFlag and simplify implementation.
llvm-svn: 68549
2009-04-07 21:08:57 +00:00
Douglas Gregor ceec5cbaed Allow us to ask for the access specifier of a translation unit
llvm-svn: 68548
2009-04-07 20:58:25 +00:00
Fariborz Jahanian 57eb2e021e Propagte -fvisibility to objc2's class symbols.
llvm-svn: 68543
2009-04-07 20:26:30 +00:00
Eli Friedman 574c745370 Diagnose uses of function specifiers on declarations which don't declare
functions.  Fixes PR3941.

llvm-svn: 68541
2009-04-07 19:37:57 +00:00
Daniel Dunbar 513d500fda Driver: Explicitly warn that -pg isn't supported (even though we
aren't failing the compilation).

llvm-svn: 68540
2009-04-07 19:18:24 +00:00
Daniel Dunbar a3cfbe33da Driver: Add 'q' flag for options which shouldn't be reported as unused.
- <rdar://problem/6756295> warning about '-dynamic' argument unused
   during compilation seems incorrect

llvm-svn: 68535
2009-04-07 19:04:18 +00:00
Ted Kremenek 882cf06652 CFG: when there is not continue or break target, mark the CFG as bad.
llvm-svn: 68533
2009-04-07 18:53:24 +00:00
Anders Carlsson d8db853243 Remove some dead code.
llvm-svn: 68532
2009-04-07 18:53:02 +00:00
Fariborz Jahanian 69ba935743 Fixes method name lookup when method appears in
the base implementations (and not in
current implementation).

llvm-svn: 68527
2009-04-07 18:28:06 +00:00
Daniel Dunbar b2a7c062aa Driver: Fix a parsing bug where some options were matched
incorrectly. I'm blanking on the smartest way to write this search,
but we should just do the right thing when we move to TableGen.
 - <rdar://problem/6761194> [driver] -Wextra-tokens isn't parsed
   correctly

llvm-svn: 68525
2009-04-07 18:21:47 +00:00
Douglas Gregor b1fe2c9001 Move the internal DeclContext data structures into a separate header.
Simplify the addition of a case statement to a switch.

Fix -print-stats for attribute-qualified types.

llvm-svn: 68522
2009-04-07 17:20:56 +00:00
Chris Lattner 2a5c0a3688 Fariborz points out that weak is now defined to the attribute even
in C mode.

llvm-svn: 68520
2009-04-07 16:50:40 +00:00
Steve Naroff ebc790d4d8 Tweak Sema::ActOnInstanceMessage() to look for a class method when dealing with qualified id's. This change is motivated by our desire to not support the "Class<foo>" idiom. Note that the change makes perfect sense (since all ObjC classes are also id/instances).
This allow us to document a simple migration path...change "Class <foo>" to "id <foo>".

This effects: 
- <rdar://problem/6761939> TASK: File source change radars for "qualified Class" errors
- <rdar://problem/6761864> Protocol qualified Class is unsupported

llvm-svn: 68517
2009-04-07 15:07:57 +00:00
Steve Naroff 54e5945297 Change the type of ObjC @ string constants (from NSConstantString->NSString).
This fixes <rdar://problem/6757102> clang type for @"xxx" is "NSConstantString *" (GCC type is "NSString *").

llvm-svn: 68514
2009-04-07 14:18:33 +00:00
Daniel Dunbar d7beeea228 Handle use side of __objc_exception__ attribute; when using an
exception with this attribute we don't need to emit a weak definition
for the exception type information.

llvm-svn: 68513
2009-04-07 06:43:45 +00:00
Daniel Dunbar 15894b791b Various fixes to symbols used for Obj-C x86_64 metadata.
- Changed method names to match gcc (categories names still aren't
   mangled in).

 - Expose correct name for class and metadata symbols (although
   -fvisibility=hidden isn't yet correct).

 - Remove several things from llvm.used that didn't need to be there
   (I suspect this can still be trimmed).

 - Don't use asm-prefix extension for _objc_empty_{cache,vtable} (not
   needed).

 - Hide EH type class info with -fvisibility=hidden

 - Change setGlobal[Option]Visibility to not change the visibility of
   functions with internal linkage.

llvm-svn: 68510
2009-04-07 05:48:37 +00:00
Ted Kremenek 4d947facad Remove hack from LiveVariables analysis where variables whose address are taken
are considered 'live'. This hack isn't needed anymore because we have a
separation in the path-sensitive analyzer between variable names and bindings;
the analyzer can continue to reason about the storage of a variable after its
name is no longer directly referenced.  Now the live variables analysis literally means "is this name live".

Along this line, update the dead stores checker to explicitly look for variables
whose values have escaped.

llvm-svn: 68504
2009-04-07 05:25:24 +00:00
Chris Lattner 33d840cc8f define __va_copy unconditionally, but va_copy only in c99 or non-ansi mode.
Fixes rdar://6759546, some code that actually used __va_copy because they
thought it was "more portable".

llvm-svn: 68503
2009-04-07 05:12:42 +00:00
Ted Kremenek aed74642cb Remove GetLeakNode. This isn't the right approach.
llvm-svn: 68502
2009-04-07 05:07:44 +00:00
Ted Kremenek 8928d74e19 Remove period.
llvm-svn: 68497
2009-04-07 04:54:31 +00:00
Ted Kremenek e2f5a9f8e3 Eagerly compute the leak location when a leak occurs at the end of a path.
llvm-svn: 68496
2009-04-07 04:54:20 +00:00
Ted Kremenek 3cb8a84924 Removed some commented code.
llvm-svn: 68495
2009-04-07 04:53:35 +00:00
Chris Lattner c2d140156c The __weak and __strong defines are common to all darwin targets
and are even set in C mode.  As such, move them to Targets.cpp.

__OBJC_GC__ is also darwin specific, but seems reasonable to always
define it when in objc-gc mode.

This fixes rdar://6761450

llvm-svn: 68494
2009-04-07 04:48:21 +00:00
Ted Kremenek 89be6526c3 Remove hack support for @try...@finally in source-level CFGs. The current hack
had too many false positives in the analyzer.

llvm-svn: 68492
2009-04-07 04:26:02 +00:00
Daniel Dunbar c790b09b81 Driver: More verbosity reduction.
- Ignore some more -W options and -[fm] options which we can somewhat
   safely ignore.

 - Recognize that -W is an alias for -Wextra

W: -Wdeclaration-after-statement -Werror-implicit-function-declaration -Wfour-char-constants -Winit-self -Wmissing-format-attribute -Wno-#warnings -Wno-comment -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Wstrict-prototypes -Wunused-parameter

f: -fconstant-cfstrings -fdollars-in-identifiers -finline -finline-functions -fno-inline -fno-keep-inline-functions -fno-strict-aliasing -fobjc-atdefs -fobjc-call-cxx-cdtors -fobjc-new-property -fstack-protector

m: -mconstant-cfstrings -mfix-and-continue
llvm-svn: 68487
2009-04-07 02:59:27 +00:00
Ted Kremenek 86d52c4c02 PathDiagnostic generation: experiment with avoiding generation of control-flow
pieces between block entrance and block end unless necessary.

llvm-svn: 68483
2009-04-07 01:34:17 +00:00
Daniel Dunbar 4fab57ddea Implement __sync_{add,sub,and,or,xor}_and_fetch and
__sync_bool_compare_and_swap.
 - <rdar://problem/6762223> [sema/irgen] support
   __sync_bool_compare_and_swap and __sync_add_and_fetch

llvm-svn: 68482
2009-04-07 00:55:51 +00:00
Anders Carlsson 350da60733 Use the new getFunctionInfo that takes a BlockPointerType parameter, and get rid of getBlockFunctionType from CGBlocks.cpp
llvm-svn: 68478
2009-04-07 00:20:24 +00:00
Ted Kremenek 6fd0921bdb retain/release checker: When hunting for the leak location, don't walk the
ExplodedGraph backwards. That may inadvertently result in reverse control-flow
edges in the PathDiagostic.

llvm-svn: 68477
2009-04-07 00:12:43 +00:00
Ted Kremenek d7c1aaa6c5 Don't overguard to adding a control-flow piece when "alwaysAdd" is true.
llvm-svn: 68476
2009-04-07 00:11:40 +00:00
Fariborz Jahanian 54d569c51d Warn instead of error on duplicate protocol definitions.
Be kind to so many projects which are doing this (and be
like gcc).

llvm-svn: 68474
2009-04-06 23:43:32 +00:00