Commit Graph

7090 Commits

Author SHA1 Message Date
Eli Friedman 5e774b1333 Fix the parser error hanlding for __builtin_offsetof to actually print
out an error for a malformed __builtin_offsetof.

llvm-svn: 74388
2009-06-27 20:38:33 +00:00
Fariborz Jahanian 3fe6b61b23 Renamed MarcDestructorReferenced -> MarkDestructorReferenced
llvm-svn: 74386
2009-06-27 15:05:11 +00:00
Eli Friedman d95e1cda9e Fix screwup with my previous patch which broke tests. (The patch is
making sure we return true when annotating a function template with 
explicit template arguments, but not when we don't annotate anything.)

llvm-svn: 74383
2009-06-27 08:17:02 +00:00
Eli Friedman 9fe1bb40ae Fix a crash with constructs like x<false>() in C++. No testcase because
it doesn't actually work yet; we just error out a bit more gracefully.

llvm-svn: 74381
2009-06-27 06:24:06 +00:00
Eli Friedman 173e0b7a96 Fix a bogus error overloading an operator where the only class
parameter has a dependent type.

llvm-svn: 74380
2009-06-27 05:59:59 +00:00
Anders Carlsson f0a7f3b089 Implement support for the format_arg attribute. Fixes PR4442.
llvm-svn: 74369
2009-06-27 04:05:33 +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 bae2737202 Fix test.
llvm-svn: 74358
2009-06-26 23:44:14 +00:00
Douglas Gregor fc516c93c1 Set the rest of the flags we need to perform template argument
deduction using a base class of the argument type. No actual
functionality change; this is just a hook.

llvm-svn: 74356
2009-06-26 23:27:24 +00:00
Douglas Gregor cf0b47d179 During template argument deduction from a function call, allow
deduction from pointer and pointer-to-member types to work even in the
presence of a qualification conversion (C++ [temp.deduct.type]p3
bullet 2). 

llvm-svn: 74354
2009-06-26 23:10:12 +00:00
Anders Carlsson 94ff77a356 More auto work.
llvm-svn: 74339
2009-06-26 22:18:59 +00:00
Douglas Gregor febe45a727 A little template argument deduction test uncovered an "oops". As part
of template instantiation, we were dropping cv-qualifiers on the
instantiated type in a few places. This change reshuffles the
type-instantiation code a little bit so that there's a single place
where we add qualifiers to the instantiated type, so that we won't end
up with this same bug in the future.

llvm-svn: 74331
2009-06-26 21:40:05 +00:00
Nate Begeman ea12f6ebb5 OpenCL 1.0 Support: fix a bug with lvalue swizzles
llvm-svn: 74324
2009-06-26 21:12:50 +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
Devang Patel 2872df839d typo
llvm-svn: 74305
2009-06-26 18:33:42 +00:00
Devang Patel 0d425350b2 Revrt PR4228 fix for now.
llvm-svn: 74304
2009-06-26 18:32:22 +00:00
Daniel Dunbar c7d0e6525d Simplify, and fix a possible crash (never happens however, because we don't ever
take this path with non-builtin floating point types).

llvm-svn: 74303
2009-06-26 18:32:06 +00:00
Douglas Gregor cceb97559e Improve template argument deduction for reference parameters when
deducing template arguments from a function call. Plus, add a bunch of
tests.

llvm-svn: 74301
2009-06-26 18:27:22 +00:00
Nate Begeman 2ffd384441 OpenCL 1.0 Support:
Add support for scalar to vector and partially initialized vector constant initializers. 

llvm-svn: 74299
2009-06-26 18:22:18 +00:00
Fariborz Jahanian ebe772e2f2 Minor change per Doug's comments.
- Fariborz

llvm-svn: 74287
2009-06-26 16:08:57 +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
Anders Carlsson 288dcd1158 Fix failing test.
llvm-svn: 74268
2009-06-26 05:14:36 +00:00
Chris Lattner d86a13e02e Improve error recovery in C++: when we hit 'implicit int' cases in C++,
these are usually because the parser was thoroughly confused.  In addition
to typing the value being declared as an int and hoping for the best, we
mark the value as invalid so we don't get chains of errors when it is
used downstream.  In C, implicit int actually is valid, so typing the thing
as int is good and marking it invalid is bad. :)

llvm-svn: 74266
2009-06-26 04:45:06 +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
Anders Carlsson 5f212cbb73 Fix another assert related to using decls.
llvm-svn: 74262
2009-06-26 03:54:13 +00:00
Chris Lattner e2355f70fa rearrange more code, this avoids a token lookahead for foo<
llvm-svn: 74261
2009-06-26 03:52:38 +00:00
Chris Lattner 0eed3a6813 move some code around, no functionality change.
llvm-svn: 74260
2009-06-26 03:47:46 +00:00
Chris Lattner 704edfb095 simplify some code.
llvm-svn: 74259
2009-06-26 03:45:46 +00:00
Anders Carlsson 8d0f6b7c87 When creating LookupResults, see through UsingDecls. Fixes PR4450.
llvm-svn: 74258
2009-06-26 03:37:05 +00:00
Anders Carlsson 5140b3c4a6 Fix PR4448.
llvm-svn: 74257
2009-06-26 03:02:18 +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 bb597cdfc2 Remove '#include <sstream>' from libAnalysis.
llvm-svn: 74245
2009-06-26 00:43:22 +00:00
Ted Kremenek af1ac826f6 Update method signature.
llvm-svn: 74244
2009-06-26 00:41:43 +00:00
Ted Kremenek 18e1caa6bf Unbreak build.
llvm-svn: 74238
2009-06-26 00:25: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 4ac764d72e Remove orphaned header file.
llvm-svn: 74231
2009-06-26 00:08:20 +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 f2911667d8 Write/Read new Language Options
llvm-svn: 74221
2009-06-25 23:01:11 +00:00
Nate Begeman 9d90579b6d PCH support for OpenCL language options
llvm-svn: 74220
2009-06-25 22:57:40 +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
Argyrios Kyrtzidis 55c34113e4 Handle PCHReader::IgnorePCH, it gets returned for when the file does not exist.
llvm-svn: 74196
2009-06-25 18:22:30 +00:00
Argyrios Kyrtzidis 16eecc4245 Set the end range location of a FunctionDecl to the right paren.
llvm-svn: 74195
2009-06-25 18:22:24 +00:00
Argyrios Kyrtzidis 0e5ecbda69 Fix column checking for SourceManager::getLocation().
llvm-svn: 74194
2009-06-25 18:22:16 +00:00
Ted Kremenek 9ffbd9fb64 Remove declaration for unused and unimplemented static method.
llvm-svn: 74182
2009-06-25 17:25:49 +00:00
Anders Carlsson 7972b14007 Extra asserts never hurt anybody, right?
llvm-svn: 74177
2009-06-25 16:06:43 +00:00
Anders Carlsson 7d209570b6 Decltype needs to have a dependent type if the expr passed to it is type dependent. Fixes PR4444.
llvm-svn: 74175
2009-06-25 15:00:34 +00:00
Duncan Sands 323fc2a229 Explicit braces to avoid ambiguous ‘else’.
llvm-svn: 74171
2009-06-25 09:03:06 +00:00
Zhongxing Xu c53b444d36 remove RegionKills GDM. Now UnknownVal is bound to regions explicitly.
llvm-svn: 74168
2009-06-25 05:52:16 +00:00
Zhongxing Xu 2d16073b50 Move element region retrieving logic into a separate function.
llvm-svn: 74166
2009-06-25 05:29:39 +00:00
Douglas Gregor 9b5f9cd2f7 Make sure install Clang headers when building clang-cc
llvm-svn: 74163
2009-06-25 05:07:31 +00:00
Douglas Gregor d4daf75100 Add missing dependencies to the CMake build system
llvm-svn: 74162
2009-06-25 05:03:29 +00:00
Zhongxing Xu e67ea5c784 Move all logic for retrieving ElementRegion binding into a separate method.
Revert to setting default value approach for handling struct initialization.

llvm-svn: 74160
2009-06-25 04:50:44 +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 35a63c680f Remove unneeded #includes.
llvm-svn: 74131
2009-06-24 22:26:16 +00:00
Ted Kremenek 2c6a7b2776 Remove GRStateManager::GetSValAsScalarOrLoc()/GetSVal().
llvm-svn: 74128
2009-06-24 22:15:30 +00:00
Fariborz Jahanian 49796cc77a Backed out my last patch which caused a clang-test breakage. Will
look at it later.

llvm-svn: 74126
2009-06-24 22:09:44 +00:00
Anders Carlsson ad6bd35b46 C++ decltype support (N2343)
llvm-svn: 74118
2009-06-24 21:24:56 +00:00
Anders Carlsson 0d00e80b8e Type::getDesugaredType needs to handle decltype types.
llvm-svn: 74115
2009-06-24 20:59:53 +00:00
Fariborz Jahanian be19db0063 Added a missing else part to my previous patche(s).
llvm-svn: 74108
2009-06-24 19:24:38 +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
Owen Anderson 4d9e93c420 Update for LLVM API changes.
llvm-svn: 74085
2009-06-24 17:37:55 +00:00
Chris Lattner 46be2e1557 fix the type of wchar_t for windows, PR4417
llvm-svn: 74083
2009-06-24 17:12:15 +00:00
Fariborz Jahanian 6e9e4f3436 Fix a clang crash caused by incorrect user code.
llvm-svn: 74080
2009-06-24 17:00:18 +00:00
Douglas Gregor 23061ded56 Implement matching of function templates, so that one can declare overloaded function templates. C++ [temp.over.link] paragraphs 4-8.
llvm-svn: 74079
2009-06-24 16:50:40 +00:00
Zhongxing Xu 33420090ae use a concrete type instead of a trait type to make code more readable.
llvm-svn: 74047
2009-06-24 01:12:41 +00:00
Zhongxing Xu 9ef415edf2 RegionStore: revert to the default value approach for array initialization.
llvm-svn: 74043
2009-06-24 00:56:31 +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
Douglas Gregor c1da0f0b9b When declaring a function template, create a FunctionTemplateDecl node
and associate it with the FunctionDecl.

llvm-svn: 74028
2009-06-24 00:23:40 +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
Fariborz Jahanian a83edb0cc1 Some changes to accomodate Doug's comment for
implicit copy constructor definition determination.

llvm-svn: 74025
2009-06-23 23:42:10 +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
Daniel Dunbar 349db7bbcd Fix warning when building w/o asserts.
llvm-svn: 74020
2009-06-23 23:09:58 +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 9cab2967c4 Update CMakeLists.txt
llvm-svn: 74011
2009-06-23 22:01:29 +00:00
Fariborz Jahanian 248c719a68 Patch fixes an obscure bug when 'used' attribute is applied to
variables in ObjC's Next runtime mode. Next runtime also implicitly applies
'used' attribute on some of its meta-data. This results in two 
'llvm.used' arrays to be generated, and one of them is renamed to
'llvm.used1'.

llvm-svn: 74008
2009-06-23 21:47:46 +00:00
Douglas Gregor 4a75be24c9 Eliminate DeclPtrTy() arguments to ActOnDeclarator that are just a very, very weird way to pass "false". No functionality change
llvm-svn: 74007
2009-06-23 21:43:56 +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
Douglas Gregor 6127ca4561 Make sure that argument-dependent lookup looks into the global scope
when it should.

llvm-svn: 73992
2009-06-23 20:14:09 +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
Douglas Gregor e14d93c49e Fix some TableGen-related dependencies for the Clang CMake build
llvm-svn: 73976
2009-06-23 18:15:28 +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
Ted Kremenek d363f44c69 Update CMake file.
llvm-svn: 73958
2009-06-23 16:54:53 +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 0442e962d9 If the init list is fewer than the struct fields, bind the rest fields to 0
explicitly. Make 0 value with the field type.

llvm-svn: 73949
2009-06-23 05:43:16 +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
Chris Lattner c183595534 Fix our check for "random whitespace between a \ and newline" to work
with dos style newlines.  I have a trivial test for this:

// RUN: clang-cc %s -verify
#define test(x, y) \
   x ## y

but I don't know how to get svn to not change newlines and testrunner
doesn't work with dos style newlines either, so "not worth it". :)

rdar://6994000

llvm-svn: 73945
2009-06-23 05:15:06 +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
Zhongxing Xu 74fa0bc3de add a fixme.
llvm-svn: 73939
2009-06-23 02:08:56 +00:00
Chris Lattner 4c8da96ea9 fix PR4423.
llvm-svn: 73938
2009-06-23 01:38:41 +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
Chris Lattner e2170edfbb switch Warnings.cpp to use the diagnostics machinery to print diagnostics, not *fprintf*!
Among other things, this makes the warning about unknown warning options mappable.
For example:

$ clang t.c -Werror -Wfoo
error: unknown warning option '-Wfoo' [-Wunknown-warning-option]

For another thing, they are properly color coded now too :)

llvm-svn: 73936
2009-06-23 01:20:39 +00:00
Ted Kremenek fb87e30815 MemRegions:
- Embed a reference to MemRegionManager objects in MemSpaceRegion objects
- Use this embedded reference for MemRegion objects to access ASTContext objects without external help
- Use this access to ASTContext to simplify 'isBoundable' (no ASTContext& argument required)

llvm-svn: 73935
2009-06-23 00:46:41 +00:00
Chris Lattner 2fe5b26414 __APPLE_CC__ should only be set when building for darwin targets.
llvm-svn: 73934
2009-06-23 00:43:21 +00:00
Argyrios Kyrtzidis dfc5dca1e5 Don't use operator overload '<' for SourceLocation, it has not semantic meaning.
llvm-svn: 73932
2009-06-23 00:42:15 +00:00
Argyrios Kyrtzidis 0152c6cbca In SourceManager::createFileID missed setting ContentCache's FirstFID in another place.
llvm-svn: 73931
2009-06-23 00:42:06 +00:00
Argyrios Kyrtzidis 53aeec3b14 Add a comment.
llvm-svn: 73930
2009-06-23 00:42:00 +00:00
Ted Kremenek 8bae300ade MemRegionManager: Migrate logic for getAllocaRegion() over to using trait-based MemRegion creation.
llvm-svn: 73927
2009-06-23 00:15:41 +00:00
Ted Kremenek 2266640a7a MemRegionManager: Migrate getObjCObjectRegion() and getTypedViewRegion() to use
the new trait-based construction of MemRegion objects.

llvm-svn: 73926
2009-06-23 00:04:09 +00:00
Fariborz Jahanian 477d242a2e patch to mark use of implicit copy constructors.
llvm-svn: 73922
2009-06-22 23:34:40 +00:00
Ted Kremenek 214cdfea84 Migrate factory methods for FieldRegion and ObjCIVarRegion creation to use the
new generalized region-construction code.

llvm-svn: 73921
2009-06-22 23:34:21 +00:00
Douglas Gregor 71a5718f2d Robustify a bunch of C++-related declaration actions.
llvm-svn: 73918
2009-06-22 23:20:33 +00:00
Ted Kremenek e5e8b0b09b Refactor some of the logic in MemRegionManager for constructing regions using
member template functions and traits. The idea is to allow MemRegionManager to
construct subclasses of MemRegion that aren't declared in MemRegion.h (e.g.,
checker-specific regions).

llvm-svn: 73917
2009-06-22 23:13:13 +00:00
Douglas Gregor 77b50e1126 Implement implicit instantiation of the member functions of a class template
specialization. At present, all implicit instantiations occur at the
end of the translation unit.

llvm-svn: 73915
2009-06-22 23:06:13 +00:00
Douglas Gregor 0b6a6242ed Rework the way we track which declarations are "used" during
compilation, and (hopefully) introduce RAII objects for changing the
"potentially evaluated" state at all of the necessary places within
Sema and Parser. Other changes:

  - Set the unevaluated/potentially-evaluated context appropriately
    during template instantiation.
  - We now recognize three different states while parsing or
    instantiating expressions: unevaluated, potentially evaluated, and
    potentially potentially evaluated (for C++'s typeid).
  - When we're in a potentially potentially-evaluated context, queue
    up MarkDeclarationReferenced calls in a stack. For C++ typeid
    expressions that are potentially evaluated, we will play back
    these MarkDeclarationReferenced calls when we exit the
    corresponding potentially potentially-evaluated context.
  - Non-type template arguments are now parsed as constant
    expressions, so they are not potentially-evaluated.

llvm-svn: 73899
2009-06-22 20:57:11 +00:00
Fariborz Jahanian 18eb69af79 Changes made per Doug's comments.
llvm-svn: 73897
2009-06-22 20:37:23 +00:00
Fariborz Jahanian 3a36343b88 Remove ImplicitMustBeDefined, use universal 'Used' flag
instead. Do the implicit default ctor checking in MarkDeclarationReferenced.

llvm-svn: 73888
2009-06-22 17:30:33 +00:00
Argyrios Kyrtzidis 49abd4d95b Addressing Doug's suggestions:
-Added comment for FunctionDecl::EndRangeLoc
-Removed a redundant check from FunctionDecl::setBody

llvm-svn: 73886
2009-06-22 17:13:31 +00:00
Zhongxing Xu 8077d7eb15 Allow CodeTextRegion to be cast to 'void *'.
llvm-svn: 73880
2009-06-22 08:36:10 +00:00
Fariborz Jahanian 99b57fb987 Renamed Protocol as TheProtocol so people can use clang header for
building obj-c++ clients. "Protocol" is a class name in Cocoa.h

llvm-svn: 73854
2009-06-21 18:26:03 +00:00
Zhongxing Xu 540c009fbe Return UnknownVal for pointer arithmetic on struct fields.
llvm-svn: 73851
2009-06-21 13:24:24 +00:00
Fariborz Jahanian 1c9d5d956c Made improvements in c++'s object model patch on Doug's review.
llvm-svn: 73833
2009-06-20 20:23:38 +00:00
Argyrios Kyrtzidis 69c2e0635a Slight modification to column checking inside SourceManager::getLocation().
llvm-svn: 73826
2009-06-20 08:40:15 +00:00
Argyrios Kyrtzidis 3a08ec1662 Add the license part to the new source files.
llvm-svn: 73825
2009-06-20 08:27:14 +00:00
Argyrios Kyrtzidis 88f663c04d Introduce SourceManager::getLocation() to get a source location out of a "file:line:column" triplet.
llvm-svn: 73823
2009-06-20 08:09:57 +00:00
Argyrios Kyrtzidis 1ead0b42db Serialize FunctionDecl's EndRangeLoc out to the PCH file.
llvm-svn: 73822
2009-06-20 08:09:34 +00:00
Argyrios Kyrtzidis a3aeb5a8f1 Introduce Decl::getSourceRange() which, like Stmt::getSourceRange(), represents the range that the declaration covers.
Add initial support for NamespaceDecl, VarDecl, and FunctionDecl:
-NamespaceDecl range is from name to '}'
-VarDecl is from name to possible init expression
-FunctionDecl is from name to last parameter name or to end of its function body.

llvm-svn: 73821
2009-06-20 08:09:14 +00:00
Argyrios Kyrtzidis ce3797527e Introduce the ASTUnit class.
ASTUnit is a helper class to allow easy loading of an ASTContext from a PCH file. No users for now.

llvm-svn: 73819
2009-06-20 08:08:23 +00:00
Douglas Gregor fec52635f0 Parsing and AST support for using declarations, from John Thompson!
llvm-svn: 73812
2009-06-20 00:51:54 +00:00
Fariborz Jahanian e8918d52d1 Added writing and reading of the ConstQualAdded flag of
BlockDeclRefExpr to PCH.

llvm-svn: 73800
2009-06-20 00:02:26 +00:00
Douglas Gregor c9c02ed8f4 Keep track of when declarations are "used" according to C and
C++. This logic is required to trigger implicit instantiation of
function templates and member functions of class templates, which will
be implemented separately.

This commit includes support for -Wunused-parameter, printing warnings
for named parameters that are not used within a function/Objective-C
method/block. Fixes <rdar://problem/6505209>.

llvm-svn: 73797
2009-06-19 23:52:42 +00:00
Fariborz Jahanian 3fd7310d70 Use QualType to represent block's implicit return type as
to not lose its 'const/volatile' qualifier.

llvm-svn: 73795
2009-06-19 23:37:08 +00:00
Fariborz Jahanian 423a81f259 Patch for implementation of C++'s object model. This is
work in progress.

llvm-svn: 73782
2009-06-19 19:55:27 +00:00
Ted Kremenek c55f0cdaa0 Remove more GetSVal/GetLValue methods in GRExprEngine/GRState, instead
preferring to use their replacements in GRState. This further unifies the code
paths for such logic and leads to some code reduction.

llvm-svn: 73771
2009-06-19 17:10:32 +00:00
Argyrios Kyrtzidis e55f6ff3de Fix bug in the new PCHReader constructor. PP and Context should be initialized to 0.
llvm-svn: 73762
2009-06-19 07:55:35 +00:00
Zhongxing Xu 54fb536b5c A further step of r73690: associate the cast-to type with the created symbol,
because the type of the symbol is used to create the default range. We need the
sign to be consistent.

llvm-svn: 73756
2009-06-19 06:00:32 +00:00
Zhongxing Xu cc45762253 If the SymbolicRegion was cast to another type, use that type to create the
ElementRegion.

llvm-svn: 73754
2009-06-19 04:51:14 +00:00
Argyrios Kyrtzidis 366985d5eb Make changes to PCHReader to allow reading a PCH file without having a pre-initialized Preprocessor.
-Introduce 'PCHReaderListener' which is an abstract interface for getting various information from the PCHReader.
-If PCHReader is constructed without a Preprocessor, it can still load the file and invoke the callbacks of PCHReaderListener.
-If PCHReader is constructed with an initialized Preprocessor, PCHValidator is used as a PCHReaderListener to validate the contents of the PCH file against the given Preprocessor.

llvm-svn: 73741
2009-06-19 00:03:23 +00:00
Ted Kremenek 095f1a9848 Move clients over from using GRStateManager::BindXXX and friends to
GRState->bindXXX and friends (and constify some arguments along the way).

llvm-svn: 73740
2009-06-18 23:58:37 +00:00
Ted Kremenek 4c6a367182 Remove GRStateManager& field from SimpleConstraintManager.
llvm-svn: 73735
2009-06-18 23:20:05 +00:00
Ted Kremenek f9906843b7 libAnalysis:
- Remove the 'isFeasible' flag from all uses of 'Assume'.
- Remove the 'Assume' methods from GRStateManager.  Now the only way to
  create a new GRState with an assumption is to use the new 'assume' methods
  in GRState.

llvm-svn: 73731
2009-06-18 22:57:13 +00:00
Douglas Gregor 1e09bf83c0 Some cleanups suggested by Chris
llvm-svn: 73713
2009-06-18 18:45:36 +00:00