Commit Graph

4737 Commits

Author SHA1 Message Date
Bill Wendling d63bbadbef Add stack protector support to clang. This generates the 'ssp' and 'sspreq'
function attributes. There are predefined macros that are defined when stack
protectors are used: __SSP__=1 with -fstack-protector and __SSP_ALL__=2 with
-fstack-protector-all.

llvm-svn: 74405
2009-06-28 07:36:13 +00:00
Douglas Gregor 15448f8d23 Improve support for overloaded operator templates.
llvm-svn: 74390
2009-06-27 21:05:07 +00:00
Anders Carlsson 74d7f0dd65 Make it possible for using decls to point to operators. Fixes PR4441.
llvm-svn: 74362
2009-06-27 00:27:47 +00:00
Ted Kremenek 8e5f6951eb Remove the last 'GetXXX' methods from GRStateManager.
llvm-svn: 74361
2009-06-27 00:24:54 +00:00
Fariborz Jahanian 24a175b37c Patch to mark destructors when they are used.
llvm-svn: 74359
2009-06-26 23:49:16 +00:00
Anders Carlsson 94ff77a356 More auto work.
llvm-svn: 74339
2009-06-26 22:18:59 +00:00
Douglas Gregor 705c900d23 Template argument deduction is no longer responsible for checking
non-dependent parameter types. Instead, class template partial
specializations perform a final check of all of the instantiated
arguments. This model is cleaner, and works better for function
templates where the "final check" occurs during overload resolution.

Also, cope with cv-qualifiers when the parameter type was originally a
reference type, so that the deduced argument can be more qualified
than the transformed argument.

llvm-svn: 74323
2009-06-26 20:57:09 +00:00
Anders Carlsson 6bd992d1c3 Can't have arrays of auto.
llvm-svn: 74314
2009-06-26 19:33:28 +00:00
Anders Carlsson 364035d1a8 An auto variable can't appear in its own initializer.
llvm-svn: 74312
2009-06-26 19:16:07 +00:00
Anders Carlsson 082acded44 Implement enough of the 'auto' keyword so we can claim to support N2546.
llvm-svn: 74307
2009-06-26 18:41:36 +00:00
Nate Begeman f275870014 OpenCL 1.0 support: attributes
llvm-svn: 74280
2009-06-26 06:32:41 +00:00
Anders Carlsson 6915bf6158 Add NamedDecl::getUnderlyingDecl that can see through UsingDecl and ObjCCompatibleAliasDecl.
llvm-svn: 74279
2009-06-26 06:29:23 +00:00
Anders Carlsson f057cb2310 See through UsingDecls in more places.
llvm-svn: 74269
2009-06-26 05:26:50 +00:00
Zhongxing Xu 3d0fc146f9 Fix build break.
llvm-svn: 74267
2009-06-26 05:13:13 +00:00
Chris Lattner 5558e9fc55 fix PR4452, a crash on invalid. The error recovery is still terrible in this case
but at least we don't crash :)

llvm-svn: 74264
2009-06-26 04:27:47 +00:00
Nate Begeman c69b740df4 OpenCL 1.0 support: explicit casts to ext-vector types
llvm-svn: 74247
2009-06-26 00:50:28 +00:00
Ted Kremenek 27433af0ee Add missing header file.
llvm-svn: 74233
2009-06-26 00:15:05 +00:00
Douglas Gregor 4adbc6d947 Implicit instantiation for function template specializations.
For a FunctionDecl that has been instantiated due to template argument
deduction, we now store the primary template from which it was
instantiated and the deduced template arguments. From this
information, we can instantiate the body of the function template.

llvm-svn: 74232
2009-06-26 00:10:03 +00:00
Ted Kremenek 1642bdaaa5 Introduce a new concept to the static analyzer: SValuator.
GRTransferFuncs had the conflated role of both constructing SVals (symbolic
expressions) as well as handling checker-specific logic. Now SValuator has the
role of constructing SVals from expressions and GRTransferFuncs just handles
checker-specific logic. The motivation is by separating these two concepts we
will be able to much more easily create richer constraint-generating logic
without coupling it to the main checker transfer function logic.

We now have one implementation of SValuator: SimpleSValuator.

SimpleSValuator is essentially the SVal-related logic that was in GRSimpleVals
(which is removed in this patch). This includes the logic for EvalBinOp,
EvalCast, etc. Because SValuator has a narrower role than the old
GRTransferFuncs, the interfaces are much simpler, and so is the implementation
of SimpleSValuator compared to GRSimpleVals. I also did a line-by-line review of
SVal-related logic in GRSimpleVals and cleaned it up while moving it over to
SimpleSValuator.

As a consequence of removing GRSimpleVals, there is no longer a
'-checker-simple' option. The '-checker-cfref' did everything that option did
but also ran the retain/release checker. Of course a user may not always wish to
run the retain/release checker, nor do we wish core analysis logic buried in the
checker-specific logic. The next step is to refactor the logic in CFRefCount.cpp
to separate out these pieces into the core analysis engine.

llvm-svn: 74229
2009-06-26 00:05:51 +00:00
Nate Begeman 8b68d6fb83 OpenCL 1.0 Support: support "bool, true, false" tokens when compiling for OpenCL
llvm-svn: 74224
2009-06-25 23:25:15 +00:00
Nate Begeman 9d90579b6d PCH support for OpenCL language options
llvm-svn: 74220
2009-06-25 22:57:40 +00:00
Nate Begeman 95f48a5d87 OpenCL 1.0 patch 2/N: Language options & file extension
llvm-svn: 74217
2009-06-25 22:43:10 +00:00
Douglas Gregor ad3f2fcf43 Improved semantic analysis and AST respresentation for function
templates.

For example, this now type-checks (but does not instantiate the body
of deref<int>):

  template<typename T> T& deref(T* t) { return *t; }

  void test(int *ip) {
    int &ir = deref(ip);
  }

Specific changes/additions:
  * Template argument deduction from a call to a function template.
  * Instantiation of a function template specializations (just the
  declarations) from the template arguments deduced from a call.
  * FunctionTemplateDecls are stored directly in declaration contexts
  and found via name lookup (all forms), rather than finding the
  FunctionDecl and then realizing it is a template. This is
  responsible for most of the churn, since some of the core
  declaration matching and lookup code assumes that all functions are
  FunctionDecls.

llvm-svn: 74213
2009-06-25 22:08:12 +00:00
Fariborz Jahanian 41f792735f Patch to diagnose and Mark use of implicit default assignment operator.
llvm-svn: 74205
2009-06-25 21:45:19 +00:00
Nate Begeman 0359e12208 OpenCL 1.0 Support, patch 1/N: upper case swizzle operator and hex element index.
llvm-svn: 74202
2009-06-25 21:06:09 +00:00
Argyrios Kyrtzidis 7c59162edd Introduce the ResolveLocationInAST function which takes an ASTContext and a SourceLocation and it resolves it into a <Decl*, Stmt*> pair.
Decl* is the declaration associated with this source location and Stmt* is the statement/expression that the location points to.
If the location does not point to a statement node, Stmt* is null.

ResolveLocationInAST (along with converting a file:line:column triplet to a SourceLocation) will be useful for an IDE client and for clang's test suite.

llvm-svn: 74197
2009-06-25 18:22:41 +00:00
Ted Kremenek 799bb6e178 Remove uses of std::ostream from libAnalysis.
llvm-svn: 74136
2009-06-24 23:06:47 +00:00
Ted Kremenek 2c6a7b2776 Remove GRStateManager::GetSValAsScalarOrLoc()/GetSVal().
llvm-svn: 74128
2009-06-24 22:15:30 +00:00
Anders Carlsson 81df7b89de Add a DecltypeType type.
llvm-svn: 74099
2009-06-24 19:06:50 +00:00
Anders Carlsson 74948d0701 Parse the C++0x decltype specifier.
llvm-svn: 74086
2009-06-24 17:47:40 +00:00
Douglas Gregor 17a7c1297a Make sure that the template parameter lists get from the parser down to ActOnFunctionDeclarator for function template definitions
llvm-svn: 74040
2009-06-24 00:54:41 +00:00
Anders Carlsson d2e8adfc75 Support for [class.local]p4.
llvm-svn: 74030
2009-06-24 00:28:53 +00:00
Anders Carlsson 946b86d91a [class.local] p1 and p3. Also, add back the xcodeproj file.
llvm-svn: 74027
2009-06-24 00:10:43 +00:00
Douglas Gregor b52fabb2a8 Start propagating template parameter lists to the right places to
handle function templates. There's no actual code for function
templates yet, but at least we complain about typedef templates.

llvm-svn: 74021
2009-06-23 23:11:28 +00:00
Argyrios Kyrtzidis 33661d9f16 Introduce SourceManager::ísBeforeInTranslationUnit() which can compare 2 source locations and determine which one comes before the other, relative to the translation unit.
llvm-svn: 74014
2009-06-23 22:01:48 +00:00
Argyrios Kyrtzidis 25ee5db366 Move the command line source location parsing from clang-cc.cpp into "include/Frontend/CommandLineSourceLoc.h".
llvm-svn: 74012
2009-06-23 22:01:39 +00:00
Ted Kremenek 4cf427a8ae Fix build.
llvm-svn: 74009
2009-06-23 21:50:16 +00:00
Ted Kremenek 8cf2021012 Remove GRStateManager::getRegion/getSelfRegion().
llvm-svn: 74006
2009-06-23 21:37:46 +00:00
Ted Kremenek 7df5691d2d Remove GRStateManager::BindLoc() and GRStateManager::Unbind().
llvm-svn: 73996
2009-06-23 20:38:51 +00:00
Ted Kremenek 59ee3f5079 Remove GRStateManager::BindDecl() and GRStateManager::BindDeclWithInit().
llvm-svn: 73995
2009-06-23 20:27:53 +00:00
Ted Kremenek 2d99f97c17 - Add MemRegion::getMemorySpace()
- Change implementation of MemRegion::hasStackStorage()/hasHeapStorage() to use
  'getMemorySpace()'.  This avoids a double traversal up the region hierarchy
  and is simpler.
- Add MemRegion::hasHeapOrStackStorage() as a slightly more efficient
  alternative to 'hasStackStorage() || hasHeapStorage()'.

llvm-svn: 73977
2009-06-23 18:17:08 +00:00
Ted Kremenek 404b132dc0 Move 'hasStackStorage()' and 'hasHeapStorage()' from MemRegionManager to MemRegion.
llvm-svn: 73973
2009-06-23 18:05:21 +00:00
Ted Kremenek ae01dc73af API cleanup: move more methods from GRStateManager to GRState.
llvm-svn: 73968
2009-06-23 17:55:07 +00:00
Zhongxing Xu 7718ae4701 Move all factory methods from SVal to ValueManager. API cleanup!
llvm-svn: 73954
2009-06-23 09:02:15 +00:00
Zhongxing Xu 0808f70912 Split ValueManager method definitions into its own source file.
No functionality change.

llvm-svn: 73952
2009-06-23 06:22:22 +00:00
Zhongxing Xu d09b5205ef ValueManager::makeNonLoc -> ValueManager::makeIntVal
Clean up code with ValueManager.

llvm-svn: 73951
2009-06-23 06:13:19 +00:00
Zhongxing Xu b7cf95957d Instead of setting the default value of the array region, bind the rest of the
array elements to 0 explicitly. Create 0 values with the element type.

llvm-svn: 73946
2009-06-23 05:23:38 +00:00
Zhongxing Xu cbfc7d6c2e MemRegionManager: Migrate logic for getCodeTextRegion() over to using
trait-based MemRegion creation.

llvm-svn: 73941
2009-06-23 03:50:30 +00:00
Zhongxing Xu 1a195b264f Remove duplicated methods.
llvm-svn: 73940
2009-06-23 02:51:21 +00:00
Anders Carlsson 5947ddfb55 Check in a new template argument list builder that should work better for variadic templates.
llvm-svn: 73937
2009-06-23 01:26:57 +00:00