Commit Graph

11859 Commits

Author SHA1 Message Date
Douglas Gregor bfbde53ce1 Encode the target triple in the PCH file, and check that target triple when using the PCH file
llvm-svn: 68824
2009-04-10 21:16:55 +00:00
Ted Kremenek ef52cc6b95 Add arbitrary "tags" to ProgramPoints. While this fattens up ProgramPoint even
more, it gives us a tremendous amount of flexibility for extending the analyzer
to handle arbitrary program points.

llvm-svn: 68823
2009-04-10 21:06:25 +00:00
Daniel Dunbar b5023e90f4 Honor MACOSX_DEPLOYMENT_TARGET environment variable.
llvm-svn: 68822
2009-04-10 21:00:07 +00:00
Douglas Gregor 55abb2389d Implement serialization/deserialization of LangOptions in the PCH
file. When de-serializing LangOptions, we check that the
currently-provided language options are consistent with the options
used to compile the PCH file. If they are not, we emit a diagnostic
and ignore the PCH file.

llvm-svn: 68820
2009-04-10 20:39:37 +00:00
Fariborz Jahanian 40458ec7ef Reject compiles for x86_64 target for MacOS versions which
do not support it.

llvm-svn: 68819
2009-04-10 20:33:45 +00:00
Daniel Dunbar d272cca527 Internal variables could mistakenly have "hidden" visibility when
their emission was deferred.
 - <rdar://problem/6775234> variables with internal linkage should not
   be exposed with -fvisibility=hidden.

llvm-svn: 68818
2009-04-10 20:26:50 +00:00
Daniel Dunbar de46660cda Test case for -miphoneos-version-min, also part of Shantonu's patch!
llvm-svn: 68817
2009-04-10 20:13:51 +00:00
Daniel Dunbar c8b7af89ce Driver: Forward -miphoneos-version-min to clang.
llvm-svn: 68816
2009-04-10 20:11:50 +00:00
Daniel Dunbar 497ff13243 Support -miphoneos-version-min in clang-cc.
- Patch by Shantonu Sen (with a minor tweak to split out
   getDarwin{OSX,IPhoneOS}Defines)!

 - <rdar://problem/6776277> Need clang-cc/ccc-analyzer support for
   -miphoneos-version-min

llvm-svn: 68815
2009-04-10 19:52:24 +00:00
Daniel Dunbar e3f4197524 Support %S in Python TestRunner
llvm-svn: 68814
2009-04-10 19:49:21 +00:00
Mike Stump 6764593098 Fixup codegen for nested blocks that use copy/dispose in the inner
blocks, so that the outer blocks use it as well.  Radar 6762279

llvm-svn: 68811
2009-04-10 18:52:28 +00:00
Fariborz Jahanian 464423dce4 Patch to generate meta-data for prtocol used
in @protocol expression.

llvm-svn: 68806
2009-04-10 18:47:34 +00:00
Daniel Dunbar 8b723e299c Driver: CCC_ADD_ARGS could end up using dangling pointers.
llvm-svn: 68805
2009-04-10 18:32:59 +00:00
Ted Kremenek a53274e5ba Use getDeclName() instead of getIdentifier() (safe against null pointers)
llvm-svn: 68804
2009-04-10 18:25:37 +00:00
Chris Lattner 2916a482fb add a new PP_MACRO_NAME hack so that I can test object-like macros.
llvm-svn: 68803
2009-04-10 18:22:18 +00:00
Ted Kremenek ffe4ad6795 Move a few more NonLoc static functions to ValueManager.
llvm-svn: 68800
2009-04-10 18:11:44 +00:00
Ted Kremenek f1f47a688d Default initialize 'code' instance variable to NULL.
llvm-svn: 68799
2009-04-10 18:11:14 +00:00
Chris Lattner 2199f5b4e5 emit tokens, constify the Preprocessor passed down into PCH writer.
llvm-svn: 68798
2009-04-10 18:08:30 +00:00
Chris Lattner baa52f47c1 emit function-like and object-like macros to the PCH file.
Note that we don't do anything useful with identifier infos yet
and don't emit the tokens that the macros are defined to.

llvm-svn: 68797
2009-04-10 18:00:12 +00:00
Douglas Gregor df47d734c2 Add PCH sources to CMake build files
llvm-svn: 68794
2009-04-10 17:28:42 +00:00
Douglas Gregor 1e9bf3bad4 Various minor fixes to PCH reading and writing, with general
cleanup. Aside from a minor tweak to the PCH file format, no
functionality change. 

llvm-svn: 68793
2009-04-10 17:25:41 +00:00
Chris Lattner 0910e3b92e improve punctuation
llvm-svn: 68791
2009-04-10 17:16:57 +00:00
Chris Lattner eeffaef7b9 Arrange for the preprocessor to be passed down into the PCH writer.
llvm-svn: 68790
2009-04-10 17:15:23 +00:00
Chris Lattner 5f122a644a add PCH stuff to project
llvm-svn: 68789
2009-04-10 17:09:28 +00:00
Chris Lattner feeb8f1316 use doug's new %S thing to make this work when run from different locations.
llvm-svn: 68788
2009-04-10 16:51:32 +00:00
Ted Kremenek 7318290ab9 Fix typo.
llvm-svn: 68782
2009-04-10 14:30:24 +00:00
Ted Kremenek cda32a1e0c Update analyzer build.
llvm-svn: 68781
2009-04-10 14:29:25 +00:00
Zhongxing Xu 1aced0c9d2 Add prototype for CodeTextRegion.
A CodeTextRegion wraps two kinds of data: FunctionDecl* or SymbolRef. 
The latter comes from the symbolic function pointer that are generated from
function calls or input data.

llvm-svn: 68777
2009-04-10 08:45:10 +00:00
Zhongxing Xu a720c8b1c9 update analyzer doc.
llvm-svn: 68773
2009-04-10 06:52:49 +00:00
Zhongxing Xu dadf250598 Finally nuke loc::SymbolVal.
llvm-svn: 68771
2009-04-10 06:06:13 +00:00
Chris Lattner bb72f77416 typos
llvm-svn: 68770
2009-04-10 05:54:56 +00:00
Anders Carlsson b36338aa00 Use correct alignment and size for references in records as well.
llvm-svn: 68769
2009-04-10 05:31:15 +00:00
Ted Kremenek 86ee059a3a Wording changes.
llvm-svn: 68766
2009-04-10 05:04:22 +00:00
Ted Kremenek a9deb97190 Add blurb about attribute "analyzer_noreturn"
llvm-svn: 68765
2009-04-10 05:03:33 +00:00
Anders Carlsson 6ef4ea499f Rename variables to avoid conflict.
llvm-svn: 68764
2009-04-10 04:59:59 +00:00
Anders Carlsson 43168129d0 Add Expr::EvaluateAsLValue which will (believe it or not) try to evaluate an Expr as an LValue.
llvm-svn: 68763
2009-04-10 04:54:13 +00:00
Anders Carlsson 0e6d2b3a70 Fix thinko noticed by Chris.
llvm-svn: 68762
2009-04-10 04:52:36 +00:00
Anders Carlsson 9b5038ed64 Use the same alignment for reference declarations as for pointer declarations.
llvm-svn: 68761
2009-04-10 04:47:03 +00:00
Chris Lattner 7671c45108 fix indentation
llvm-svn: 68760
2009-04-10 04:42:25 +00:00
Ted Kremenek b3b2395520 Split failing test case from misc-ps.m to misc-ps-ranges.m (which tests
functionality specific to RangeConstraintManager).

llvm-svn: 68759
2009-04-10 04:02:38 +00:00
Douglas Gregor a7f71a91c5 PCH serialization/deserialization of the source manager. With this
improvement, source locations read from the PCH file will properly
resolve to the source files that were used to build the PCH file
itself.

Once we have the preprocessor state stored in the PCH file, source
locations that refer to macro instantiations that occur in the PCH
file should have the appropriate instantiation information.

llvm-svn: 68758
2009-04-10 03:52:48 +00:00
Ted Kremenek 5054663daa Fix: <rdar://problem/6776949> Branch condition evaluates to an uninitialized value (argc is guaranteed to be >= 1)
The analyzer now adds the precondition that the first argument of 'main' is > 0.

llvm-svn: 68757
2009-04-10 00:59:50 +00:00
Chris Lattner 6bc4aaa2eb Make messages consistent.
llvm-svn: 68756
2009-04-10 00:37:08 +00:00
Chris Lattner 5286e774ee reject codegen of __thread variables as unimplemented, rdar://6775265
llvm-svn: 68755
2009-04-10 00:35:59 +00:00
Ted Kremenek 40f4ee74fd Implement attribute "analyzer_noreturn" (<rdar://problem/6777003>). This allows
clients of the analyzer to designate custom assertion routines as "noreturn"
functions from the analyzer's perspective but not the compiler's.

llvm-svn: 68746
2009-04-10 00:01:14 +00:00
Douglas Gregor ef84c4b434 Implementation of pre-compiled headers (PCH) based on lazy
de-serialization of abstract syntax trees.

PCH support serializes the contents of the abstract syntax tree (AST)
to a bitstream. When the PCH file is read, declarations are serialized
as-needed. For example, a declaration of a variable "x" will be
deserialized only when its VarDecl can be found by a client, e.g.,
based on name lookup for "x" or traversing the entire contents of the
owner of "x".

This commit provides the framework for serialization and (lazy)
deserialization, along with support for variable and typedef
declarations (along with several kinds of types). More
declarations/types, along with important auxiliary structures (source
manager, preprocessor, etc.), will follow.

llvm-svn: 68732
2009-04-09 22:27:44 +00:00
Ted Kremenek f2489ea043 - Move ownership of MemRegionManager into ValueManager.
- Pull SVal::GetConjuredSymbol() and friends into ValueManager. This greatly
simplifies the calling interface to clients.

llvm-svn: 68731
2009-04-09 22:22:44 +00:00
Anders Carlsson 39b2e130f0 Add @encode support for complex types.
llvm-svn: 68729
2009-04-09 21:55:45 +00:00
Douglas Gregor bcced4ec31 Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).

llvm-svn: 68726
2009-04-09 21:40:53 +00:00
Eli Friedman 32e6e8ed3b Add some FIXMEs for missing checks.
llvm-svn: 68725
2009-04-09 21:26:42 +00:00
Chris Lattner c86ffc3583 document the x86 address space extension for GS.
llvm-svn: 68724
2009-04-09 19:58:15 +00:00
Ted Kremenek 11e13fae69 Fix grammar. Bold face feature points.
llvm-svn: 68720
2009-04-09 18:22:40 +00:00
Ted Kremenek 4adfee4ff7 More cleanup.
llvm-svn: 68719
2009-04-09 18:20:08 +00:00
Ted Kremenek 8918025272 More cleanups.
llvm-svn: 68718
2009-04-09 18:17:39 +00:00
Ted Kremenek df0d9070b8 Add link from internals manual to PTH documentation.
llvm-svn: 68717
2009-04-09 18:08:18 +00:00
Ted Kremenek 6b27a811c6 Minor cleanups. Added a blurb about the advantages of fast PTH file generation.
llvm-svn: 68716
2009-04-09 18:03:21 +00:00
Douglas Gregor 9615ec20a2 Simple DeclContext's internal representation by always storing a
StoredDeclsMap, instead of using the it's-an-array-or-its-a-map
trick. I'll verify that performance isn't impacted later; for now, I
need the common representation.

llvm-svn: 68715
2009-04-09 17:29:08 +00:00
Ted Kremenek f8cb51c20e Remove SVal::MakeZero and replace it with ValueManager::makeZeroVal.
llvm-svn: 68711
2009-04-09 16:46:55 +00:00
Daniel Dunbar b041085c17 Add more builtin definitions, including strcmp.
- PR3964.

llvm-svn: 68710
2009-04-09 16:42:50 +00:00
Ted Kremenek aa4cfc2604 analyzer: Introduce a new class, ValueManager, that serves as an aggregate
"manager of symbolic values", wrapping BasicValueFactory, SymbolManager, and
MemRegionManager. While these individual managers nicely separate functionality
in the analyzer, constructing symbolic values can sometimes be cumbersome
because it requires using multiple managers at once. The goal of this class is
to create some factory methods to create SVals that require the use of these
different managers, thus (hopefully) simplifying the analyzer API for clients.

llvm-svn: 68709
2009-04-09 16:13:17 +00:00
Ted Kremenek 8cdc351ed3 Update analyzer build.
llvm-svn: 68707
2009-04-09 14:06:37 +00:00
Zhongxing Xu 7e9c193398 stop using loc::SymbolVal and clean up code with new API.
llvm-svn: 68703
2009-04-09 07:39:46 +00:00
Zhongxing Xu 48abb5d91f clean up code with new API.
llvm-svn: 68701
2009-04-09 07:04:45 +00:00
Zhongxing Xu 783cd82487 clean up code with new API.
llvm-svn: 68700
2009-04-09 07:01:16 +00:00
Zhongxing Xu 726876b385 clean up code with new API.
llvm-svn: 68699
2009-04-09 06:56:25 +00:00
Zhongxing Xu 2945210d71 clean up code with new API.
llvm-svn: 68698
2009-04-09 06:53:24 +00:00
Zhongxing Xu c48eb32872 stop using loc::SymbolVal.
llvm-svn: 68697
2009-04-09 06:49:52 +00:00
Zhongxing Xu 22f72485ed stop using loc::SymbolVal.
llvm-svn: 68696
2009-04-09 06:43:44 +00:00
Zhongxing Xu 0c87a4e79b stop using loc::SymbolVal.
llvm-svn: 68695
2009-04-09 06:41:51 +00:00
Zhongxing Xu 4a8f0cf874 clean up code with new API.
llvm-svn: 68694
2009-04-09 06:35:30 +00:00
Zhongxing Xu b74817f387 clean up code with new API.
llvm-svn: 68693
2009-04-09 06:32:20 +00:00
Zhongxing Xu 9410d7ee97 Add a new method because sometimes the type of the conjured symbol is not the
type of the expression where we create the symbol.

llvm-svn: 68692
2009-04-09 06:30:17 +00:00
Zhongxing Xu 40934cfa9b make a conjured symbol as the original code.
llvm-svn: 68691
2009-04-09 06:18:05 +00:00
Zhongxing Xu d3b33ba406 clean up code with new API.
llvm-svn: 68687
2009-04-09 06:03:54 +00:00
Ted Kremenek 2f3b0dbff4 Fix a null pointer dereference error due to state caching in a loop involving
sending a message to a nil receiver.

llvm-svn: 68686
2009-04-09 06:02:06 +00:00
Zhongxing Xu cb5d3ced70 Create a symbolic region instead of a loc::SymbolVal. This is a continued step
to eliminate the use of loc::SymbolVal.

llvm-svn: 68685
2009-04-09 05:57:11 +00:00
Ted Kremenek f9f9420303 GRExprEngine: Don't try to reason about the size of 'void' for the return type
of messages sent to nil.

llvm-svn: 68683
2009-04-09 05:45:56 +00:00
Ted Kremenek 042befd6d6 Another ParentMap bug: only the right side of a comma expression is consumed.
llvm-svn: 68680
2009-04-09 05:34:31 +00:00
Ted Kremenek c3f7c85129 Fix another regression introduced by changes to the analyzer's reasoning about
nil receivers in message expressions.

llvm-svn: 68672
2009-04-09 04:06:51 +00:00
Daniel Dunbar f67829ac6a Make -include, -imacros paths absolute in Frontend.
- Otherwise paths will be resolved relative to the main input file,
   which is incorrect.

 - I don't know how to make a reasonable test case for this with our
   testing infrastructure.

 - PR3395

llvm-svn: 68665
2009-04-09 00:51:16 +00:00
Ted Kremenek d937ed386e Refactor/cleanup reasoning of nil receivers in message expressions.
llvm-svn: 68661
2009-04-09 00:00:02 +00:00
Daniel Dunbar d067f7fbef Driver: Split out CPP specific options for clang so that we don't end
up adding them twice when running with -no-integrated-cpp or
-save-temps.
 - <rdar://problem/6766636> -save-temps falls over with prefix headers

llvm-svn: 68660
2009-04-08 23:54:23 +00:00
Steve Naroff b47acdb2e5 Fix <rdar://problem/6770998> make cast of super illegal (again:-)
llvm-svn: 68659
2009-04-08 23:52:26 +00:00
Anders Carlsson 479e6fc7a7 Use the new EmitCallArgs function. No indented functionality change.
llvm-svn: 68652
2009-04-08 23:13:16 +00:00
Daniel Dunbar 6eaebd0934 Force triple for these tests.
llvm-svn: 68651
2009-04-08 23:02:51 +00:00
Chris Lattner aa55f949ac add driver support for -Wno-trigraphs
llvm-svn: 68650
2009-04-08 22:38:30 +00:00
Chris Lattner 2632dda471 add support for -Wtrigraphs and -Wno-trigraphs.
llvm-svn: 68649
2009-04-08 22:37:15 +00:00
Fariborz Jahanian 9c9f742ee2 Added a FIXME.
llvm-svn: 68646
2009-04-08 21:54:52 +00:00
Chris Lattner d2e61fbc64 add driver headers to xcode proj
llvm-svn: 68642
2009-04-08 20:57:57 +00:00
Chris Lattner db436ae9e4 implement -imacros support in driver.
llvm-svn: 68641
2009-04-08 20:57:44 +00:00
Chris Lattner e01d82b81f finish the implementation of -imacros. The driver still needs to be hooked up.
llvm-svn: 68640
2009-04-08 20:53:24 +00:00
Anders Carlsson 60ce3fe140 Add code for emitting call arguments (not used yet).
llvm-svn: 68639
2009-04-08 20:47:54 +00:00
Anders Carlsson 03a409feda We weren't generating correct code for calls to variadic member functions.
llvm-svn: 68635
2009-04-08 20:31:57 +00:00
Daniel Dunbar 17b36271e7 Fix buffer overrun when laying out synthesized ivars.
llvm-svn: 68634
2009-04-08 20:18:15 +00:00
Chris Lattner 94f4248086 According to the GCC man page, all -imacros are included before any -include's.
llvm-svn: 68633
2009-04-08 20:15:42 +00:00
Chris Lattner 21f47dd8ac properly escape filenames when generating implicit #includes, this handles
things like " in paths etc.  Found by inspection.

llvm-svn: 68632
2009-04-08 20:10:57 +00:00
Fariborz Jahanian fc58ca4af6 Fixed a problem using property syntax on a 'super'
used as receiver.

llvm-svn: 68631
2009-04-08 19:50:10 +00:00
Devang Patel 2ac33a08d5 Use presumed location to get line number info.
llvm-svn: 68630
2009-04-08 19:47:04 +00:00
Ted Kremenek 5451c60f5a Enhance analyzer reasoning about sending messages to nil. A nil receiver returns 0 for scalars of size <= sizeof(void*).
llvm-svn: 68629
2009-04-08 18:51:08 +00:00
Ted Kremenek d43aaad1b1 Fix bug in ParentMap::isConsumedExpr. A BinaryOperator always "consumes" the
value of its subexpressions unless it is a comma (in which case it doesn't
consume the left subexpression).

llvm-svn: 68628
2009-04-08 18:49:36 +00:00
Chris Lattner 58a1eb0ba0 reject the #__include_macros directive unless it comes from the
predefines buffer.

llvm-svn: 68627
2009-04-08 18:46:40 +00:00
Chris Lattner 14a7f39733 Add initial support for -imacros. Right now it has the same semantics as
-include, but that will be fixed soon.

llvm-svn: 68625
2009-04-08 18:24:34 +00:00
Daniel Dunbar 17ddaa677e More fixes to builtin preprocessor defines.
- Add -static-define option driver can use when __STATIC__ should be
   defined (instead of __DYNAMIC__).

 - Don't set __OPTIMIZE_SIZE__ on Os, __OPTIMIZE_SIZE__ is tied to Oz.

 - Set __NO_INLINE__ following GCC 4.2.

 - Set __GNU_GNU_INLINE__ or __GNU_STDC_INLINE__ following GCC 4.2.

 - Set __EXCEPTIONS for Objective-C NonFragile ABI.

 - Set __STRICT_ANSI__ for standard conforming modes.

 - I added a clang style test case in utils for this, but its not
   particularly portable and I don't think it belongs in the test
   suite.

llvm-svn: 68621
2009-04-08 18:03:55 +00:00
Steve Naroff ea4c780da1 Sema::CheckConditionalOperands(): Soften pointer/integer mismatch from error->warning.
Fixes <rdar://problem/6762239> [sema] gcc incompatibility; error on incompatible operand types in ?:.

llvm-svn: 68617
2009-04-08 17:05:15 +00:00
Daniel Dunbar d92123fd2a Make sure value is initialized when built w/o asserts.
llvm-svn: 68615
2009-04-08 16:23:09 +00:00
Douglas Gregor b53c0c29c0 -Wmissing-prototypes shouldn't complain about main() missing a prototype.
Fixes <rdar://problem/6759522>

llvm-svn: 68611
2009-04-08 15:21:36 +00:00
Daniel Dunbar ad0f62b203 Darwin ld: Unconditionally add -lstdc++ if we are pretending to be
g++.

llvm-svn: 68601
2009-04-08 06:06:21 +00:00
Chris Lattner 937b68b201 use escapes.
llvm-svn: 68600
2009-04-08 06:00:32 +00:00
Chris Lattner 1659301bed some minor edits
llvm-svn: 68599
2009-04-08 05:50:25 +00:00
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
Ted Kremenek d969f5fb6f Initial draft of PTH internals.
llvm-svn: 68594
2009-04-08 05:07:30 +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 4720840d7e fix typo, noticed by Gabor
llvm-svn: 68587
2009-04-08 03:36:03 +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
Anders Carlsson e871d05e26 Fix broken test case. I have no idea why this ever worked.
llvm-svn: 68526
2009-04-07 18:21:53 +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
Chris Lattner 84d573f256 add a warning for this crazy case, as suggested by Eli.
llvm-svn: 68524
2009-04-07 18:18:09 +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
Daniel Dunbar 88056a97f2 Use %s in test, not hard coded name.
llvm-svn: 68521
2009-04-07 17:09:43 +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
Douglas Gregor 40a8e0fbce XFAIL a failing test
llvm-svn: 68519
2009-04-07 16:32:03 +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
Ted Kremenek c4631b2809 Update checker build.
llvm-svn: 68516
2009-04-07 14:26:58 +00:00
Steve Naroff d338d08f49 Fix typo in newly added test case.
llvm-svn: 68515
2009-04-07 14:22:40 +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
Chris Lattner 91c941ecfd *everyone* knows that __weak is not defined on linux :)
llvm-svn: 68512
2009-04-07 06:05:28 +00:00
Chris Lattner 0f98a286a3 implement rdar://6762183. I'm not sure if it is more insane that
GCC ignores macro definitions after \n's or that real code depends
on this.

llvm-svn: 68511
2009-04-07 06:02:44 +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 25db1f3ff1 Add test case.
llvm-svn: 68505
2009-04-07 05:33:18 +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
Daniel Dunbar 5718a2b4a1 Fix test (triple wasn't passed correctly, the driver doesn't accept
-mtriple).

llvm-svn: 68484
2009-04-07 02:31:44 +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
Daniel Dunbar f247b30abb Remove a FIXME, the driver handles -O4.
llvm-svn: 68481
2009-04-07 00:38:22 +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
Ted Kremenek c4c9ed0f9b Rewrite control-flow diagnostic generation "extensive" algorithm using "edge
contexts".  This allows us to use a stack of contexts to keep track of what control-flow pieces to include when exiting blocks like 'if', 'for', etc.

llvm-svn: 68473
2009-04-06 23:06:54 +00:00
Ted Kremenek 92820d2d3d PathDiagnosticLocation now also wraps Decls.
llvm-svn: 68470
2009-04-06 22:33:35 +00:00
Steve Naroff 837dc03222 Make casting 'super' a deprecated warning (instead of a hard error).
This will simplify clang adoption, and is probably better "etiquette" (since gcc has always accepted this idiom without warning). Once we are over the adoption hurdle, we can turn this into an error.

llvm-svn: 68468
2009-04-06 22:07:54 +00:00
Anders Carlsson 57640939c2 Fix typo.
llvm-svn: 68466
2009-04-06 21:55:22 +00:00
Douglas Gregor 7a5bc76b81 Fixed the Fix-It hints for comparison against a string literal. Thanks, Chris!
llvm-svn: 68454
2009-04-06 18:45:53 +00:00
Fariborz Jahanian bc3c77b881 Fixed visibility issues related to objc2's synthesized
ivars.

llvm-svn: 68453
2009-04-06 18:30:00 +00:00
Anders Carlsson 6f811f149b Add a getFunctionInfo that takes a BlockPointerType.
llvm-svn: 68452
2009-04-06 18:05:26 +00:00
Anders Carlsson 2266e244b5 Simplify C++ member function calls.
llvm-svn: 68451
2009-04-06 17:45:20 +00:00
Anders Carlsson 65cb90efc1 Define __OPTIMIZE__ and __OPTIMIZE_SIZE__ if the -O[12] and -Os flags are passed to the compiler.
llvm-svn: 68450
2009-04-06 17:37:10 +00:00
Chris Lattner 8887072bce enable -std=c9x and -std=iso9899:199x, patch by Ed Schouten!
llvm-svn: 68449
2009-04-06 17:17:55 +00:00
Anders Carlsson 25fad47ebe Add clang-cc to the xcodeproj file.
llvm-svn: 68448
2009-04-06 17:11:27 +00:00
Chris Lattner a8d2dbd181 Daniel convinced me that accepting "const va_list" arguments to va_arg is
a really really bad idea.  Now that we emit an error about the unpromoted
type, users should be able to understand what is going on.

llvm-svn: 68447
2009-04-06 17:07:34 +00:00
Fariborz Jahanian 15e3a5c4b8 writable property in a category of class's superclass
makes the property writable in the current class.
 

llvm-svn: 68446
2009-04-06 16:59:10 +00:00
Chris Lattner dcceee734c Fix a couple of cases where Constant* pointers can dangle in
ObjCNonFragileABITypesHelper by converting them to dynamic
getters.  This fixes a crash on rdar://6757213.  The others
should be converted over as well.

llvm-svn: 68445
2009-04-06 16:53:45 +00:00
Chris Lattner 56382aa890 in va_arg diagnostics, print out the unpromoted type. This makes the
diagnostic use the va_list typedef more often, see the difference in the 
changed testcase.

llvm-svn: 68441
2009-04-05 15:49:53 +00:00
Ted Kremenek d3ebd551b9 Fix output of ranges in analyzer plist files.
llvm-svn: 68437
2009-04-05 02:08:28 +00:00
Zhongxing Xu 01a5beb8cd Apply a patch which adds 'OriginalParmVar' to the DeclContextPrinter by Jon
Simons.

llvm-svn: 68436
2009-04-05 02:04:38 +00:00
Chris Lattner 3f5cd77db2 Add a warning for questionable va_args usage.
llvm-svn: 68435
2009-04-05 00:59:53 +00:00
Chris Lattner 9e658eccab GCC compatibility: gcc allows applying va_args to const
va_lists for some reason.  This fixes rdar://6726818

llvm-svn: 68434
2009-04-05 00:52:59 +00:00
Chris Lattner ecdaf40c9e fix rdar://6757323, where an escaped newline in a // comment
was causing the char after the newline to get eaten.

llvm-svn: 68430
2009-04-05 00:26:41 +00:00
Anders Carlsson 468fa6366b Add some basic support for generating C++ member functions.
llvm-svn: 68425
2009-04-04 20:47:02 +00:00
Anton Korobeynikov 1dfc5f51c8 Extend possible handled regparm(N) value
llvm-svn: 68424
2009-04-04 10:27:50 +00:00
Daniel Dunbar a9bbcfa130 Driver: Handle -dumpversion, this is used by some configuration
scripts.

llvm-svn: 68418
2009-04-04 05:17:38 +00:00
Daniel Dunbar f89733cfb8 Driver: Handle properly calling dsymutil when source input is
preceeded by a linker input flag.
 - <rdar://problem/6757236> clang should make a dSYM when going
   straight from source to binary

 - This still matches gcc, but the right way to solve this would be to
   detect the situation we care about (we are compiling from source
   and linking in one step), instead of looking at the suffix of the
   input file. The Tool doesn't quite have enough information to do
   this yet, however.

 - Also, find the suffix correctly.

llvm-svn: 68417
2009-04-04 00:55:30 +00:00
Daniel Dunbar 90dd6f45cc Driver: Automatically suppress warnings for duplicate versions of
flags which were used for something.

llvm-svn: 68416
2009-04-04 00:52:26 +00:00
Anton Korobeynikov 18e831dcc9 Testcase for regparm codegen
llvm-svn: 68415
2009-04-04 00:49:38 +00:00
Anton Korobeynikov c847824e8e Basic support for regparm codegen
llvm-svn: 68414
2009-04-04 00:49:24 +00:00
Anton Korobeynikov 6953ef2de3 Provide sema proper values of maximal number of arguments passed in registers.
llvm-svn: 68413
2009-04-03 23:38:25 +00:00