Commit Graph

18384 Commits

Author SHA1 Message Date
Daniel Dunbar e0d81f2237 Factor out a LangStandard class and coalesce the information about the standards into LangStandards.def
- I'd appreciate another pair of eyeballs to double check this.

llvm-svn: 89919
2009-11-26 02:14:31 +00:00
Daniel Dunbar 5337f0c842 Fix thinko (-fno-builtin != -nobuiltininc).
llvm-svn: 89918
2009-11-26 02:14:16 +00:00
Daniel Dunbar 81fe60b787 Add clang -cc1 parsing for preprocessor options.
llvm-svn: 89917
2009-11-26 02:14:07 +00:00
Daniel Dunbar cbc693579c Add clang -cc1 parsing for header search options.
llvm-svn: 89916
2009-11-26 02:13:54 +00:00
Douglas Gregor ff790f15c4 Refactor our handling of expression evaluation contexts, so that Sema
maintains a stack of evaluation contexts rather than having the parser
do it. This change made it simpler to track in which contexts
temporaries were created, so that we could...

"Forget" about temporaries created within unevaluated contexts, so
that we don't build a CXXExprWithTemporaries and, therefore, destroy
the integral-constness of our expressions. Fixes PR5609.

llvm-svn: 89908
2009-11-26 00:44:06 +00:00
Ted Kremenek 1646cf6d05 Add missing case in switch statement.
llvm-svn: 89903
2009-11-25 23:58:21 +00:00
Ted Kremenek b63ad7a6c1 Refine MemRegions for blocks. Add a new region called
'BlockDataRegion' to distinguish between the code associated with a
block (which is represented by 'BlockTextRegion') and an instance of a
block, which includes both code and data.  'BlockDataRegion' has an
associated LocationContext, which can be used to eventually model the
lifetime of a block object once LocationContexts can represent scopes
(and iterations around a loop, etc.).

llvm-svn: 89900
2009-11-25 23:53:07 +00:00
Ted Kremenek 80f70b54aa Remove recently added FIXME. The appropriate FIXME is already in MemRegionManager::getVarRegion().
llvm-svn: 89897
2009-11-25 23:30:34 +00:00
Fariborz Jahanian 04b258cc9e Allow user re-definition of SEL as well as accessing its fields.
This fixes pr5611.

llvm-svn: 89895
2009-11-25 23:07:42 +00:00
John Thompson 5bc5cbe2a2 Fix attribute between function decl ')' and '{' or '=0'
llvm-svn: 89894
2009-11-25 22:58:06 +00:00
Ted Kremenek a3d6e62003 Add FIXME.
llvm-svn: 89892
2009-11-25 22:41:34 +00:00
Douglas Gregor f73b282bf0 Implement the rules in C++ [basic.link] and C99 6.2.2 for computing
the linkage of a declaration. Switch the lame (and completely wrong)
NamedDecl::hasLinkage() over to using the new NamedDecl::getLinkage(),
along with the "can this declaration be a template argument?" check
that started all of this.

Fixes -fsyntax-only for PR5597.

llvm-svn: 89891
2009-11-25 22:24:25 +00:00
Ted Kremenek e6929ffc21 Add post-visit Checker support in GRExprEngine for BlockExpr.
llvm-svn: 89890
2009-11-25 22:23:25 +00:00
Ted Kremenek 70a8788368 Add a new RetainReleaseChecker class (that subclasses CheckerVisitor) to extend the functionality of the retain/release checker using the new Checker interface. Pieces of CFRefCount will gradually be migrated to this new class over time.
llvm-svn: 89889
2009-11-25 22:17:44 +00:00
Ted Kremenek 945422794b Move RegisterChecks() to the end of the file. No functionality change.
llvm-svn: 89888
2009-11-25 22:08:49 +00:00
Ted Kremenek de820039b6 Call GRExprEngine::setTransferFunctions() after registering all Checkers. This allows GRTransferFuncs::RegisterChecks() to always be called after all checkers have been registered.
llvm-svn: 89887
2009-11-25 21:58:39 +00:00
Ted Kremenek 916061f613 Consolidate logic in ActionInlineCall by having it call ActionGRExprEngine instead of replicating most of its logic (and missing pieces).
llvm-svn: 89886
2009-11-25 21:55:23 +00:00
Fariborz Jahanian f82ec6dd2f Better diagnostic on deleted constructor when no
initializer name is available.

llvm-svn: 89885
2009-11-25 21:53:11 +00:00
Ted Kremenek d0fe8047dd Make RegisterInternalChecks() part of GRExprEngine's private implementation by making it a static function within GRExprEngine.cpp.
llvm-svn: 89884
2009-11-25 21:51:20 +00:00
Ted Kremenek efb5003f95 Register internal checks with GRExprEngine when it is constructed, not manually in AnalysisConsumer.cpp.
llvm-svn: 89883
2009-11-25 21:45:48 +00:00
Ted Kremenek acdc817ed9 When dispatching to Checker objects in GRExprEngine::CheckerVisit(),
only stop processing the checkers after all the nodes for a current
check have been processed.  This (I believe) handles the case where
PredSet (the input nodes) contains more than one node due to state
bifurcation.  Zhongxing: can you review this?

llvm-svn: 89882
2009-11-25 21:40:22 +00:00
Douglas Gregor 0bba2b6110 Tweak expected error to match what should happen, once using declarations work
llvm-svn: 89876
2009-11-25 19:28:08 +00:00
Douglas Gregor 3e5e960572 Tweak expected error message, although we still fail this test
llvm-svn: 89875
2009-11-25 19:25:39 +00:00
Douglas Gregor 5c80a27ba2 Implement support for default template arguments of function templates.
llvm-svn: 89874
2009-11-25 18:55:14 +00:00
Douglas Gregor ed5731f68a Diagnose ill-formed uses of default template arguments in
function templates (in C++98), friend function templates, and
out-of-line definitions of members of class templates.

Also handles merging of default template arguments from previous
declarations of function templates, for C++0x. However, we don't yet
make use of those default template arguments.

llvm-svn: 89872
2009-11-25 17:50:39 +00:00
Devang Patel 58bf6e1885 Use StringRef (again) in DebugInfo interface.
llvm-svn: 89867
2009-11-25 17:37:31 +00:00
Douglas Gregor 7fdcbaf291 Fix a thinko where we weren't always performing unary conversions on the switch condition, fixing PR5612
llvm-svn: 89864
2009-11-25 15:17:36 +00:00
Daniel Dunbar 44b36ee78c What the FIXMEs want, the FIXMEs shall have.
llvm-svn: 89861
2009-11-25 11:53:23 +00:00
Daniel Dunbar b8c2f7d950 Add an arg_iterator, for iterating over a subset of arguments in an ArgList.
llvm-svn: 89860
2009-11-25 11:33:30 +00:00
Daniel Dunbar b7f1babb73 Add a missing include <cstdio>
llvm-svn: 89859
2009-11-25 10:53:00 +00:00
Daniel Dunbar 750246255d Fix some uses of fprintf/stderr without a prototype.
llvm-svn: 89858
2009-11-25 10:27:48 +00:00
Daniel Dunbar ad2278d74c Add clang -cc1 parsing for frontend options.
llvm-svn: 89856
2009-11-25 10:14:52 +00:00
Daniel Dunbar 8e72cc4a6e Add ParseSourceLocation::FromString, and simplify.
llvm-svn: 89855
2009-11-25 10:14:44 +00:00
Daniel Dunbar 9efcf351bd Add clang -cc1 parsing for preprocessor output options (-E).
llvm-svn: 89854
2009-11-25 10:14:37 +00:00
Daniel Dunbar 5bdd299bfd Don't pass -fexceptions=0 (it is the default).
llvm-svn: 89853
2009-11-25 10:14:30 +00:00
Kovarththanan Rajaratnam fe824d354a This patch streamlines CheckerVisitor.def so that it follows the usual '#ifndef foo' pattern:
#ifndef foo
#define foo(parm1)
#endif

foo(parm1) parm1 ...

#undef foo

llvm-svn: 89851
2009-11-25 08:37:20 +00:00
Edward O'Callaghan c92791193d Fix for Path::isSpecialFile to Path::isRegularFile API in rev 89765.
llvm-svn: 89849
2009-11-25 06:33:27 +00:00
Douglas Gregor 3ff3af4ff9 When the condition of a switch() statement is semantically invalid,
still parse the body of the switch to try to avoid spurious
diagnostics. Fixes PR5606.

llvm-svn: 89847
2009-11-25 06:20:02 +00:00
Douglas Gregor 0681a35f5f Don't crash when we re-use a template specialization node for an explicit instantiation. lib/Support/CommandLine.cpp is our test case
llvm-svn: 89845
2009-11-25 06:01:46 +00:00
Douglas Gregor 110755548b Refactor ActOnFinishSwitchStmt to simplify it further
llvm-svn: 89843
2009-11-25 05:02:21 +00:00
Douglas Gregor 852d53e712 Refactor ActOnFinishSwitchStmt to simplify and reduce nesting
llvm-svn: 89842
2009-11-25 04:55:54 +00:00
Alexis Hunt 54a0254887 Parse C++ member check attributes - base_check, hiding, and override.
The attributes are currently ignored.

llvm-svn: 89837
2009-11-25 04:20:27 +00:00
Daniel Dunbar ddeb7e09cb Don't try to install .dir files.
llvm-svn: 89836
2009-11-25 03:46:30 +00:00
Anders Carlsson 82ba57c8f0 Add VTT parameter to base ctors/dtors with virtual bases. (They aren't used yet).
llvm-svn: 89835
2009-11-25 03:15:49 +00:00
Zhongxing Xu 3931461a33 UndefResults is not needed.
llvm-svn: 89834
2009-11-25 03:07:22 +00:00
Douglas Gregor 3d9e90ae3e Implement proper cleanup semantics for condition variables in for
statements, e.g., 

  for(; X x = X(); ) { ... }  

Daniel or Anders, please review!

llvm-svn: 89832
2009-11-25 01:51:31 +00:00
Ted Kremenek e6a2780c96 Add really basic support for blocks in the retain/release checker. For now, anytime we pass a tracked object to a block call we stop tracking it.
llvm-svn: 89831
2009-11-25 01:35:18 +00:00
Ted Kremenek 470bfa47db Allow building of CFGs for ASTs that contain BlockExprs.
llvm-svn: 89830
2009-11-25 01:34:30 +00:00
Ted Kremenek cfe223f637 Add transfer function support for BlockExpr.
llvm-svn: 89829
2009-11-25 01:33:13 +00:00
Ted Kremenek 10a50e7371 Split CodeTextRegion into FunctionTextRegion and BlockTextRegion. This a precursor to having basic static analysis support for blocks.
llvm-svn: 89828
2009-11-25 01:32:22 +00:00
Fariborz Jahanian 906d871e6c Some fancy footwork to move the decision on how
to build casted expression-list AST to Sema.

llvm-svn: 89827
2009-11-25 01:26:41 +00:00
Douglas Gregor 951f98c037 Qualify the name of the llvm::cast template. I am somewhat amazed that GCC parsed this
llvm-svn: 89822
2009-11-25 00:38:36 +00:00
Douglas Gregor 4f5d0907b8 Don't try to parse LinkAllParses.h for now
llvm-svn: 89820
2009-11-25 00:31:20 +00:00
Douglas Gregor e05b765b0d Tweak the code-generation-for-condition-variables test case to get to what we want to test
llvm-svn: 89818
2009-11-25 00:29:29 +00:00
Douglas Gregor 7bab5ff8e7 Eliminate CXXConditionDeclExpr with extreme prejudice.
All statements that involve conditions can now hold on to a separate
condition declaration (a VarDecl), and will use a DeclRefExpr
referring to that VarDecl for the condition expression. ForStmts now
have such a VarDecl (I'd missed those in previous commits).

Also, since this change reworks the Action interface for
if/while/switch/for, use FullExprArg for the full expressions in those
expressions, to ensure that we're emitting

Note that we are (still) not generating the right cleanups for
condition variables in for statements. That will be a follow-on
commit.

llvm-svn: 89817
2009-11-25 00:27:52 +00:00
Sebastian Redl d6f7850117 Have the parser tell sema whether a member declaration is a function definition. This allows sema to not emit spurious diagnostics in some invalid code.
llvm-svn: 89816
2009-11-24 23:38:44 +00:00
Ted Kremenek 239b930ae1 Convert test case to FileCheck to test the behavior of the nil-receiver checker when the code is targetted for either Tiger or Leopard.
llvm-svn: 89810
2009-11-24 22:56:53 +00:00
Ted Kremenek 1fc1f20efd For the nil-receiver checker, take into account the behavioral changes that got introduced in Mac OS X 10.5 and later, notably return values of double, float, etc., will not be garbage. Fixes <rdar://problem/6829160>.
llvm-svn: 89809
2009-11-24 22:48:18 +00:00
Ted Kremenek 005e8a06f2 Cleanups and fixes to the nil-receiver checker, some of it fallout the
initial transition of the nil-receiver checker to the Checker
interface as done in r89745.  Some important changes include:

1) We consolidate the BugType object used for nil receiver bug
reports, and don't include the type of the returned value in the
BugType (which would be wrong if a nil receiver bug was reported more
than once)

2) Added a new (temporary) flag to CheckerContext: DoneEvauating.
This is used by GRExprEngine when evaluating message expressions to
not continue evaluating the message expression if this flag is set.
This flag is currently set by the nil receiver checker.  This is an
intermediate solution to allow the nil-receiver checker to properly
work as a plug-in outside of GRExprEngine.  Basically, this flag
indicates that the entire message expression has been evaluated, not
just a precondition (which is what the nil-receiver checker does).
This flag *should not* be repurposed for general use, but just to pull
more things out of GRExprEngine that already in there as we devise a
better interface in the Checker class.

3) Cleaned up the logic in the nil-receiver checker, making the
control-flow a lot easier to read.

llvm-svn: 89804
2009-11-24 21:41:28 +00:00
Fariborz Jahanian 4fa66ce244 Refactor argument collection of constructor calls using
the common routine.

llvm-svn: 89802
2009-11-24 21:37:28 +00:00
Douglas Gregor 7f800f9d50 "Do" loops cannot have condition variables, so don't parse them.
llvm-svn: 89801
2009-11-24 21:34:32 +00:00
Douglas Gregor 680f861d74 Clean up the AST for while loops and fix several problems with
cleanups for while loops: 

1) Make sure that we destroy the condition variable of a while statement each time through the loop for, e.g.,

   while (shared_ptr<WorkInt> p = getWorkItem()) {
         // ...
         }

2) Make sure that we always enter a new cleanup scope for the body of the while loop, even when there is no compound expression, e.g.,

   while (blah)
     RAIIObject raii(blah+1);

llvm-svn: 89800
2009-11-24 21:15:44 +00:00
Anders Carlsson 3c9beab48a Handle references correctly when synthesizing copy constructors.
With this change, the clang-on-clang test result is now

Expected Passes    : 224
Unexpected Failures: 37

Which means that we can compile over 80% of clang with clang! :)

llvm-svn: 89799
2009-11-24 21:08:10 +00:00
John McCall 45b1a47a9c Fix some major problems dealing with dependently-qualified names in implicit
member-reference contexts.  Fixes some clang-on-clang asserts.

llvm-svn: 89796
2009-11-24 20:33:45 +00:00
Fariborz Jahanian 831451b417 Fix the test case failed in buildbot.
llvm-svn: 89791
2009-11-24 19:37:10 +00:00
Fariborz Jahanian 6f2d25e441 More cleanup of argument call collection.
llvm-svn: 89789
2009-11-24 19:27:49 +00:00
John McCall e66edc18ae Rip out TemplateIdRefExpr and make UnresolvedLookupExpr and
DependentScopeDeclRefExpr support storing templateids.  Unite the common   
code paths between ActOnDeclarationNameExpr and ActOnTemplateIdExpr.

This gets us to a point where we don't need to store function templates in
the AST using TemplateNames, which is critical to ripping out OverloadedFunction.

Also resolves a few FIXMEs.

llvm-svn: 89785
2009-11-24 19:00:30 +00:00
John McCall 95c66b9ddc DeclarationName::getIdentifier should take a const IdentifierInfo, since the
constructor does anyway.

llvm-svn: 89784
2009-11-24 18:44:29 +00:00
Anders Carlsson 3a202f601e Handle cases where we're constructing an array of objects and the constructor has default arguments.
llvm-svn: 89783
2009-11-24 18:43:52 +00:00
John McCall 847e2a10d6 Helper function for turning a TemplateName into a DeclarationName.
llvm-svn: 89782
2009-11-24 18:42:40 +00:00
Fariborz Jahanian 835026e9f1 Refactor collection of call arguments in common code.
Add support for variadic collection functions. More to do
here.

llvm-svn: 89781
2009-11-24 18:29:37 +00:00
Anders Carlsson 0b11a3ef71 GNUNullExpr is a valid sentinel even though it isn't of pointer type.
llvm-svn: 89778
2009-11-24 17:24:21 +00:00
Sebastian Redl 03b67ea1a2 Make sure redeclaration chains are properly linked, even through invalid decls. This fixes PR5415.
llvm-svn: 89777
2009-11-24 17:14:34 +00:00
Douglas Gregor dcf1962405 Explicitly store the condition variable within switch statements, and
make sure that this variable is destroyed when we exit the switch
statement.

llvm-svn: 89776
2009-11-24 17:07:59 +00:00
Anders Carlsson b9f96a3286 We always need to emit the base expression of a member expression, even when the member decl refers to an enum. Thanks to Eli for pointing this out!
llvm-svn: 89775
2009-11-24 16:57:33 +00:00
Anders Carlsson b7408b95ed Fix a crash when "instantiating" VarDecls that are neither type nor value dependent.
llvm-svn: 89774
2009-11-24 16:52:50 +00:00
Douglas Gregor 965f450d42 Introduce cleanup scopes for "if" statements in two places:
- Outside the "if", to ensure that we destroy the condition variable
    at the end of the "if" statement rather than at the end of the
    block containing the "if" statement.
  - Inside the "then" and "else" branches, so that we emit then- or
    else-local cleanups at the end of the corresponding block when the
    block is not a compound statement.

To make adding these new cleanup scopes easier (and since
switch/do/while will all need the same treatment), added the
CleanupScope RAII object to introduce a new cleanup scope and make
sure it gets cleaned up.

llvm-svn: 89773
2009-11-24 16:43:22 +00:00
Kovarththanan Rajaratnam 2279b1308e Sort CMakeLists.txt
llvm-svn: 89771
2009-11-24 16:32:20 +00:00
Douglas Gregor 48a409eb39 Rename CleanupScope -> DelayedCleanupBlock. No functionality change.
llvm-svn: 89769
2009-11-24 16:21:10 +00:00
Anders Carlsson 3c15b80e21 Update project file.
llvm-svn: 89768
2009-11-24 16:12:41 +00:00
Douglas Gregor 0156d1c8db Un-break instantiation of if statements with conditional variables
llvm-svn: 89767
2009-11-24 16:07:02 +00:00
Edward O'Callaghan db521ec23b Fix for PR5568.
llvm-svn: 89766
2009-11-24 15:23:21 +00:00
Kovarththanan Rajaratnam fdfca4aaef Remove trailing spaces
llvm-svn: 89764
2009-11-24 14:30:21 +00:00
Ken Dyck a34032d227 Add getByteSize() and getTypeSizeInBytes().
llvm-svn: 89760
2009-11-24 12:04:54 +00:00
Zhongxing Xu c2998766f0 We can remove this file now.
llvm-svn: 89751
2009-11-24 08:28:49 +00:00
Zhongxing Xu c6123a1a3c Refactor undefined result checker. This is the last one.
llvm-svn: 89750
2009-11-24 08:24:26 +00:00
Zhongxing Xu 9e200798c2 Refactor NilReceiverStructRet and NilReceiverLargerThanVoidPtrRet into
CallAndMessageChecker.

llvm-svn: 89745
2009-11-24 07:06:39 +00:00
Kovarththanan Rajaratnam 506b89325c Remove trailing spaces
llvm-svn: 89744
2009-11-24 06:30:23 +00:00
Anders Carlsson 59486a2ddb Get rid of the ugly CGCXX names and replace them with CGClass, CGExprCXX and CGTemporaries.
llvm-svn: 89742
2009-11-24 05:51:11 +00:00
Anders Carlsson bd97548f35 When mangling a ctor/dtor we need to take into consideration whether it's a member template.
llvm-svn: 89741
2009-11-24 05:36:32 +00:00
Anders Carlsson 65e6d131f0 Set the template specialization kind before instantiating the function definition so that the function will have the right linkage.
llvm-svn: 89740
2009-11-24 05:34:41 +00:00
Eli Friedman fb8a93fe1d Teach Evaluate to handle member expressions referring to enum constants and
static member constants. No significant visible difference at the moment
because it conservatively assumes the base has side effects. I'm planning to
use this for CodeGen.

llvm-svn: 89738
2009-11-24 05:28:59 +00:00
Anders Carlsson 0ade9715f2 Ignore constructor member templates in CodeGenModule::EmitTopLevelDecl.
llvm-svn: 89737
2009-11-24 05:16:24 +00:00
Anders Carlsson 6445773279 It is common for vtables to contain pointers to functions that have either incomplete return types or incomplete argument types.
Handle this by returning the llvm::OpaqueType for those cases, which CodeGenModule::GetOrCreateLLVMFunction knows about, and treats as being an "incomplete function".

llvm-svn: 89736
2009-11-24 05:08:52 +00:00
Zhongxing Xu 72269ec8cb rename UndefinedArgChecker to CallAndMessageChecker.
llvm-svn: 89735
2009-11-24 04:45:44 +00:00
Zhongxing Xu da32375115 Rename: UndefinedArgChecker.cpp => CallAndMessageChecker.cpp
llvm-svn: 89734
2009-11-24 04:08:01 +00:00
Ted Kremenek c0229557dd Enhance null dereference diagnostics by indicating what variable (if any) was dereferenced. Addresses <rdar://problem/7039161>.
llvm-svn: 89726
2009-11-24 01:33:10 +00:00
Daniel Dunbar 8d731964d0 Sketch the rest of the clang -cc1 option definitions, aka fun with C-x C-(.
llvm-svn: 89721
2009-11-24 00:54:16 +00:00
Douglas Gregor 633caca353 Explicitly track the condition variable within an "if" statement,
rather than burying it in a CXXConditionDeclExpr (that occassionally
hides behind implicit conversions). Similar changes for
switch, while, and do-while will follow, then the removal of
CXXConditionDeclExpr. This commit is the canary.

llvm-svn: 89717
2009-11-23 23:44:04 +00:00
Daniel Dunbar 8a9fa3af69 Add clang -cc1 parsing of diagnostic options.
llvm-svn: 89716
2009-11-23 23:41:17 +00:00
Ted Kremenek b0c0b08c71 After performing a bounds check in ArrayBoundChecker, record the fact that a bounds check succeeded by transitioning the ExplodedGraph.
llvm-svn: 89712
2009-11-23 23:23:26 +00:00
Ted Kremenek f57351570e Clean up the Checker API a little more, resolving some hidden bugs
along the way.  Important changes:

1) To generate a sink node, use GenerateSink(); GenerateNode() is for
generating regular transitions.  This makes the API clearer and also
allows us to use the 'bool' option to GenerateNode() for a different
purpose.

2) GenerateNode() now automatically adds the generated node to the
destination ExplodedNodeSet (autotransition) unless the client
specifies otherwise with a bool flag.  Several checkers did not call
'addTransition()' after calling 'GenerateNode()', causing the
simulation path to be prematurely culled when a non-fail stop bug was
encountered.

3) Add variants of GenerateNode()/GenerateSink() that take neither a
Stmt* or a GRState*; most callers of GenerateNode() just pass in the
same Stmt* as provided when the CheckerContext object is created; we
can just use that the majority of the time.  This cleanup also allows
us to potentially coelesce the APIs for evaluating branches and
end-of-paths (which currently directly use builders).

4) addTransition() no longer needs to be called except for a few
cases.  We now have a variant of addTransition() that takes a
GRState*; this allows one to propagate the updated state without
caring about generating a new node explicitly.  This nicely cleaned up
a bunch of cases that called autoTransition() with a bunch of
conditional logic surround the call (that common logic has now been
swallowed up by addTransition() itself).

llvm-svn: 89707
2009-11-23 22:22:01 +00:00
Anders Carlsson f2e4f72f03 Don't try to treat an enum constant as an lvalue.
llvm-svn: 89705
2009-11-23 21:56:41 +00:00
Anders Carlsson 2e7bc11f11 Convert the && and || operands to bool using standard conversions. Fixes PR5593.
llvm-svn: 89704
2009-11-23 21:47:44 +00:00
Fariborz Jahanian d25c219475 Fixe a crash in encoding of SEL type caused by recent changes.
llvm-svn: 89696
2009-11-23 20:40:50 +00:00
Anders Carlsson 7fa434c2b8 Handle converting member pointers to bool.
llvm-svn: 89692
2009-11-23 20:04:44 +00:00
Fariborz Jahanian 3f21c159dc Fix a recent regression probably caused by addition of altivec-style
type-casts in the parser.

llvm-svn: 89691
2009-11-23 19:51:43 +00:00
Ted Kremenek b43737387b Provide out-of-line definition for destructor of Checker.
llvm-svn: 89688
2009-11-23 18:53:03 +00:00
Ted Kremenek 02d6aca867 Tweak UndefBranchChecker to register the most nested "undefined" expression with bugreporter::registerTrackNullOrUndefValue instead of the condition itself.
llvm-svn: 89682
2009-11-23 18:12:03 +00:00
Fariborz Jahanian 0afc555196 Make 'SEL' pointer to a builtin type and not an
objective-c pointer type. This was a serious mishap and
luckily, Ted's test caught that (and patch fixes the test case).

llvm-svn: 89680
2009-11-23 18:04:25 +00:00
Ted Kremenek d4dca6fde6 Cleanup title/description of "undefined branch" BugType and add some test cases for this check.
llvm-svn: 89679
2009-11-23 17:58:48 +00:00
Anders Carlsson 8c793172c2 Handle base-to-derived casts. Will land test case shortly.
llvm-svn: 89678
2009-11-23 17:57:54 +00:00
John Thompson d976d3e552 Put back hard-coded paths for win32 until I figure out what happened to failed tests.
llvm-svn: 89677
2009-11-23 17:49:27 +00:00
Ted Kremenek 4d1907c493 Remove '-checker-simple' reference from scan-build. Patch by Kovarththanan Rajaratnam!
llvm-svn: 89673
2009-11-23 17:37:58 +00:00
Sebastian Redl 22e2e5c423 Intercept sizeof and alignof references before they get into ASTContext methods. This fixes a crash when writing sizeof(Incomplete&), and lets ASTContext's methods do the right thing for CodeGen, which fixes PR5590.
llvm-svn: 89668
2009-11-23 17:18:46 +00:00
Rafael Espindola 962e518da2 Reorder the header search a bit so that it matches gcc exactly:
*) the ../backward dir is the last in libstdc++ to be searched
*) If compiling c++, the c++ headers are searched first

llvm-svn: 89661
2009-11-23 16:31:19 +00:00
Sebastian Redl a6602e9e2a Let using directives refer to namespace aliases. Fixes PR5479.
llvm-svn: 89657
2009-11-23 15:34:23 +00:00
Douglas Gregor 378e1923b6 Require a class type to be complete before probing its conversion
functions for a switch condition's conversion to integral or
enumeration type. 

llvm-svn: 89656
2009-11-23 13:53:21 +00:00
Douglas Gregor d0c22e0d10 Implement conversion from a switch condition with class type to an
integral or enumeration type (vi user-defined conversions). Fixes PR5518.

llvm-svn: 89655
2009-11-23 13:46:08 +00:00
Douglas Gregor bd866c2985 Canonical template arguments that are template template parameters by
their template parameter depth and position, so that we can match
redeclarations appropriately. Fixes PR5527 and PR5528.

llvm-svn: 89654
2009-11-23 12:52:47 +00:00
Douglas Gregor 601f4f0b07 Improve type-checking of templates by distinguishing between members
of the current instantiation and members of an unknown specialization
when type-checking a qualified-if expression.

llvm-svn: 89653
2009-11-23 12:39:54 +00:00
Douglas Gregor 27381f3d93 Do not mark declarations as used when performing overload resolution. Fixes PR5541
llvm-svn: 89652
2009-11-23 12:27:39 +00:00
Douglas Gregor 65911498ef Tolerate extraneous "template<>" headers better, downgrading the
complaint to a warning and providing a helpful node in the case where
the "template<>" header is redundant because the corresponding
template-id refers to an explicit specialization. C++0x might still
change this behavior, and existing practice is all over the place on
the number of "template<>" headers actually needed.

llvm-svn: 89651
2009-11-23 12:11:45 +00:00
Douglas Gregor 1c3feb5b25 Fix CMake build
llvm-svn: 89650
2009-11-23 12:03:50 +00:00
Douglas Gregor ed6c744091 Centralize and complete the computation of value- and type-dependence for DeclRefExprs
llvm-svn: 89649
2009-11-23 11:41:28 +00:00
Zhongxing Xu 5f76620b53 UndefBranchChecker: more bug reporter helper information emit.
llvm-svn: 89643
2009-11-23 03:29:59 +00:00
Zhongxing Xu 56dd5f0f70 Initial refactor of UndefBranchChecker. We still use GRBranchNodeBuilder
in the checker directly. But I don't have a better approach for now.

llvm-svn: 89640
2009-11-23 03:20:54 +00:00
John McCall 6b51f28e82 Encapsulate "an array of TemplateArgumentLocs and two angle bracket locations" into
a new class.  Use it pervasively throughout Sema.

My fingers hurt.

llvm-svn: 89638
2009-11-23 01:53:49 +00:00
Daniel Dunbar baa74770c9 Change Clang-Code-Compile tests to only -emit-llvm instead of running
codegen/as.

llvm-svn: 89634
2009-11-23 00:07:14 +00:00
Daniel Dunbar 785406bd19 Teach CodeGenFunction::EmitDecl to ignore Using and UsingShadow decls.
llvm-svn: 89633
2009-11-23 00:07:06 +00:00
Daniel Dunbar e1cd0152a9 x86_64, PR5582: Layout bases for C++ records.
- Ideally we would have an single iteration interface for this, but this works
   for now.

llvm-svn: 89632
2009-11-22 23:01:23 +00:00
Daniel Dunbar 180f1fe4ce Recognize .hpp as a C++ header.
llvm-svn: 89630
2009-11-22 22:08:27 +00:00
Daniel Dunbar f5835ea2e7 Add clang -cc1 parsing of analyzer options.
llvm-svn: 89629
2009-11-22 22:08:20 +00:00
Daniel Dunbar 7b8fcadf68 CMake: Add support for running tests with valgrind.
llvm-svn: 89625
2009-11-22 21:55:22 +00:00
John McCall dc7b6079eb Fix LookupResult's sanity-check to handle shadow decls.
llvm-svn: 89624
2009-11-22 20:57:36 +00:00
Ted Kremenek 12b64959ce Change CheckDeadStores to use Expr::isNullPointerConstant, which will correctly determine whether an expression is a null pointer constant.
Patch by Kovarththanan Rajaratnam!

llvm-svn: 89621
2009-11-22 20:26:21 +00:00
Anders Carlsson 5838108317 Use EmitStoreOfScalar when copying the scalar to the space allocated by 'new'.
llvm-svn: 89613
2009-11-22 19:25:33 +00:00
Anders Carlsson ba958400a2 When laying out bitfields, make sure that the data size is always aligned to a byte. This fixes PR5580.
llvm-svn: 89611
2009-11-22 19:13:51 +00:00
Anders Carlsson 1299f36af1 Update a test to FileCheck.
llvm-svn: 89610
2009-11-22 18:56:40 +00:00
Ken Dyck 65da2db736 Use intptr_t from stdint.h (in freestanding mode) instead of redefining it here
with __INTPTR_TYPE__.

llvm-svn: 89609
2009-11-22 18:29:06 +00:00
David Chisnall 27033c9171 Test case for bug fixed in r89457.
llvm-svn: 89605
2009-11-22 17:42:02 +00:00
Anders Carlsson 072094407d Move bit-field layout out into a separate function. No functionality change.
llvm-svn: 89604
2009-11-22 17:37:31 +00:00
Edward O'Callaghan 0825f09306 Fix for PR5233.
llvm-svn: 89603
2009-11-22 16:21:47 +00:00
Ken Dyck f540ae5ab3 Define SIG_ATOMIC_MIN and SIG_ATOMIC_MAX in terms of __SIG_ATOMIC_WIDTH__.
llvm-svn: 89598
2009-11-22 15:47:12 +00:00
Ken Dyck adc8511bc8 Define __SIG_ATOMIC_WIDTH__ for use in stdint.h.
llvm-svn: 89597
2009-11-22 15:41:04 +00:00
Zhongxing Xu 014af28ce3 Undefined compound assignment result is checked in UndefinedAssignmentChecker. So this check is redundant.
llvm-svn: 89592
2009-11-22 13:36:20 +00:00
Zhongxing Xu 39638e133a Remove invalid comments. The result is undefined only when operands are undefined.
llvm-svn: 89591
2009-11-22 13:30:10 +00:00
Zhongxing Xu 7f83e97b00 Save and restore the HasGen flag in MallocChecker.
llvm-svn: 89590
2009-11-22 13:22:34 +00:00
Benjamin Kramer df58afae56 Don't include a dead header.
llvm-svn: 89587
2009-11-22 12:51:08 +00:00
Zhongxing Xu f0b7fc8890 Remove UndefinedAssignmentChecker's header.
llvm-svn: 89585
2009-11-22 12:29:52 +00:00
Alexis Hunt 12048d868b Use intptr_t rather than long so that this test will not fail on LLP64 systems,
where long is only 32-bits and so a reinterpret_cast would be ill-formed.

llvm-svn: 89583
2009-11-22 07:05:50 +00:00
John McCall a9ee325d71 If a C++ qualified id is followed by a postfix suffix, it is never the direct
operand of an addressof operator, and so we should not treat it as an abstract
member-pointer expression and therefore suppress the implicit member access.

This is really a well-formedness constraint on expressions:  a DeclRefExpr of
a FieldDecl or a non-static CXXMethodDecl (or template thereof, or unresolved
collection thereof) should not be allowed in an arbitrary location in the AST.
Arguably it shouldn't be allowed anywhere and we should have a different expr
node type for this.  But unfortunately we don't have a good way of enforcing
this kind of constraint right now.

llvm-svn: 89578
2009-11-22 02:49:43 +00:00
John McCall b53bbd42c8 Reorganize the intermediate BuildDeclarationNameExpr routines again.
llvm-svn: 89575
2009-11-22 01:44:31 +00:00
John McCall 283b901cf3 Consider a FunctionTemplate to be an overload all on its lonesome. Track
this information through lookup rather than rederiving it.

llvm-svn: 89570
2009-11-22 00:44:51 +00:00
Anders Carlsson e18e29eeb9 Support emitting aggregate class initializers. Fixes PR5581.
llvm-svn: 89569
2009-11-21 23:56:04 +00:00
Fariborz Jahanian 252ba5fb6f This patch implements objective-c's 'SEL' type as a built-in
type and fixes a long-standing code gen. crash reported in
at least two PRs and a radar. (radar 7405040 and pr5025). 
There are couple of remaining issues that I would like for
Ted. and Doug to look at:

Ted, please look at failure in Analysis/MissingDealloc.m.
I have temporarily added an expected-warning to make the
test pass. This tests has a declaration of 'SEL' type which
may not co-exist with the new changes.

Doug, please look at a FIXME in PCHWriter.cpp/PCHReader.cpp.
I think the changes which I have ifdef'ed out are correct. They
need be considered for in a few Indexer/PCH test cases.

llvm-svn: 89561
2009-11-21 19:53:08 +00:00
Ted Kremenek d354278b51 Make FixedAddressChecker and experimental check; it currently produces a ton of false positives when analyzing some projects (e.g., Wine).
llvm-svn: 89560
2009-11-21 17:55:24 +00:00
Alexis Hunt 9631fcc998 Fix 80-cols violation.
llvm-svn: 89558
2009-11-21 09:45:54 +00:00
John McCall 4b1f16e6f8 Overload resolution doesn't decide whether to do ADL or not anymore; stopping
threading that state.

llvm-svn: 89557
2009-11-21 09:38:42 +00:00
Daniel Dunbar 88ad4c5d02 Mangler: Sketch mangling for TemplateArgument::Declaration kind.
- Several important FIXMEs related to whether arguments are expressions or external names, and the mangling of extern "C" names (c.f., PR5522).

llvm-svn: 89556
2009-11-21 09:17:15 +00:00
Daniel Dunbar e949e6cced Mangler: Lift shouldMangleDeclName predicate out of CXXNameMangler::mangle.
- Sometimes we have to mangle things we wouldn't normally (e.g., because they appear in a template expression).

 - This also tidies up the predicate to be more obvious what is getting mangled.

llvm-svn: 89555
2009-11-21 09:14:52 +00:00
Daniel Dunbar 161ade4455 Mangler: Strengthen invariants, MangleContext::mangleName should only be called on var or function decls.
llvm-svn: 89554
2009-11-21 09:14:44 +00:00
Daniel Dunbar 8483d211bd Mangler: Inline a bunch of functions into their sole caller, not that I don't love typing for typings sake, but...
llvm-svn: 89553
2009-11-21 09:12:13 +00:00
Daniel Dunbar 671f45e701 DeclPrinter: Indent access specifiers.
llvm-svn: 89552
2009-11-21 09:12:06 +00:00
Daniel Dunbar 1110dc06a8 Remove dead variable.
llvm-svn: 89551
2009-11-21 09:11:59 +00:00
Daniel Dunbar fdae6f7cd3 Mangler: Split isStdNamespace for when the caller already has a NamespaceDecl.
llvm-svn: 89550
2009-11-21 09:11:45 +00:00
Daniel Dunbar 4118ec5571 IRgen: Eliminate CXXNameMangler::mangleCXX{C,D}tor.
llvm-svn: 89549
2009-11-21 09:06:31 +00:00
Daniel Dunbar e128dd18ab IRgen: Switch the C++ mangler interfaces to take the SmallVector to write into,
instead of requiring clients to make a raw_svector_ostream, which is just an
implementation detail.

llvm-svn: 89548
2009-11-21 09:06:22 +00:00
Daniel Dunbar ef5d75afeb Sink free mangle* methods into MangleContext.
llvm-svn: 89547
2009-11-21 09:06:10 +00:00
Daniel Dunbar 4f1054ef2e Add 1+2 consts.
llvm-svn: 89546
2009-11-21 09:05:59 +00:00
Daniel Dunbar d614e326db Delete trailing space.
llvm-svn: 89545
2009-11-21 09:05:47 +00:00
John McCall d14a86427f "Incremental" progress on using expressions, by which I mean totally ripping
into pretty much everything about overload resolution in order to wean
BuildDeclarationNameExpr off LookupResult::getAsSingleDecl().  Replace  
UnresolvedFunctionNameExpr with UnresolvedLookupExpr, which generalizes the
idea of a non-member lookup that we haven't totally resolved yet, whether by
overloading, argument-dependent lookup, or (eventually) the presence of   
a function template in the lookup results.  

Incidentally fixes a problem with argument-dependent lookup where we were 
still performing ADL even when the lookup results contained something from
a block scope.  

Incidentally improves a diagnostic when using an ObjC ivar from a class method.
This just fell out from rewriting BuildDeclarationNameExpr's interaction with
lookup, and I'm too apathetic to break it out.

The only remaining uses of OverloadedFunctionDecl that I know of are in
TemplateName and MemberExpr.

llvm-svn: 89544
2009-11-21 08:51:07 +00:00
Alexis Hunt 96d5c76498 Added rudimentary C++0x attribute support.
The following attributes are currently supported in C++0x attribute
lists (and in GNU ones as well):
 - align() - semantics believed to be conformant to n3000, except for
   redeclarations and what entities it may apply to
 - final - semantics believed to be conformant to CWG issue 817's proposed
   wording, except for redeclarations
 - noreturn - semantics believed to be conformant to n3000, except for
   redeclarations
 - carries_dependency - currently ignored (this is an optimization hint)

llvm-svn: 89543
2009-11-21 08:43:09 +00:00
Ted Kremenek 775d9c149d Add RegionStore test case that shows that floating point values are also implicitly tracked for undefined values. (test case for <rdar://problem/6811085>).
llvm-svn: 89538
2009-11-21 02:52:12 +00:00
Daniel Dunbar f4b39e9c95 Fix refacto, gcc's cc1 needs to see --output-pch=, which is not just an alias
for -output-pch=.

llvm-svn: 89534
2009-11-21 02:31:29 +00:00
Ted Kremenek f3febe4bdc Add another test case to show the precision of RegionStore over
BasicStore.  In this example, BasicStore would lose information about
the pointer in path after '*path++', causing the analyzer to falsely
flag a null dereference.  This addresses <rdar://problem/7191542>.

llvm-svn: 89533
2009-11-21 02:17:47 +00:00
Douglas Gregor 26aedb7460 Implement C++ [temp.param]p2 correctly, looking ahead when we see a
"typename" parameter to distinguish between non-type and type template
parameters. Fixes the actual bug in PR5559.

llvm-svn: 89532
2009-11-21 02:07:55 +00:00
Ted Kremenek 9d6daf2cc4 Restructure DereferenceChecker slightly to handle caching out when we would report a null dereference more than once.
llvm-svn: 89526
2009-11-21 01:50:48 +00:00
Ted Kremenek caf2c51fad Pull BadCallChecker int UndefinedArgChecker, and have UndefinedArgChecker also handled undefined receivers in message expressions.
llvm-svn: 89524
2009-11-21 01:25:37 +00:00
Edward O'Callaghan 847f2a10ee Add SigAtomicType to TargetInfo, Needed for MSP and PIC Targets, Credit to Ken Dyck.
llvm-svn: 89520
2009-11-21 00:49:54 +00:00
Ted Kremenek f7adea43b4 More checker refactoring. Passing undefined values in a message expression is now handled by UndefinedArgChecker.
llvm-svn: 89519
2009-11-21 00:49:41 +00:00
John Thompson c1b70ab9b8 Revised Win32 include path to search highest version in registry, plus platform SDK path
llvm-svn: 89517
2009-11-21 00:15:52 +00:00
Daniel Dunbar c2588c3bd9 Convert test to FileCheck.
llvm-svn: 89514
2009-11-20 23:46:56 +00:00
Mike Stump 58ef18b38c Checkpoint current work. WIP.
llvm-svn: 89513
2009-11-20 23:44:51 +00:00
Douglas Gregor ade9bcd72e Cope with extraneous "template" keyword when providing an out-of-line
definition of a member template (or a member thereof). Fixes PR5566.

llvm-svn: 89512
2009-11-20 23:39:24 +00:00
Daniel Dunbar a764eef0e9 Driver: Add clang -cc1 dependency output options parsing.
llvm-svn: 89508
2009-11-20 23:28:07 +00:00
Daniel Dunbar a604639635 Switch CompilerInvocation::CreateFromArgs to take const char** arguments until Driver itself switches to StringRef.
llvm-svn: 89503
2009-11-20 22:47:55 +00:00
Daniel Dunbar 2eaef18e76 Fix refactoro, clang-cc wasn't properly reporting errors when opening an output file failed.
llvm-svn: 89502
2009-11-20 22:32:38 +00:00
Daniel Dunbar 32164f4bdb Driver: Use '-target-abi' 'FOO' instead of '-target-abi=FOO'.
llvm-svn: 89501
2009-11-20 22:32:30 +00:00
Daniel Dunbar b17d34906a Update for palign intrinsic fix.
llvm-svn: 89499
2009-11-20 22:21:59 +00:00
Daniel Dunbar 4274685b63 Pass '-mcpu' 'FOO' instead of '-mcpu=FOO'.
llvm-svn: 89498
2009-11-20 22:21:52 +00:00
Daniel Dunbar 8bed86c43e Standardize Driver translation to call clang-cc using '-foo' form instead of '--foo'.
llvm-svn: 89497
2009-11-20 22:21:36 +00:00
Douglas Gregor 2094c5e80f A previous commit fixed PR5519; here's the test case.
llvm-svn: 89494
2009-11-20 22:05:53 +00:00
Douglas Gregor a25d65d1b6 Implement C++ [basic.lookup.classref]p3, which states how the type
name 'T' is looked up in the expression

  t.~T()

Previously, we weren't looking into the type of "t", and therefore
would fail when T actually referred to an injected-class-name. Fixes
PR5530.

llvm-svn: 89493
2009-11-20 22:03:38 +00:00
Douglas Gregor 09177b2b7f Update C++ status
llvm-svn: 89492
2009-11-20 22:00:06 +00:00
Douglas Gregor e4f764f013 When checking the base object of a member access expression (b.foo,
b->foo), don't look through pointers unless we have an -> operator.

llvm-svn: 89480
2009-11-20 19:58:21 +00:00
Douglas Gregor 51c538bee4 Teach FixOverloadedFunctionReference to build new expression ASTs rather
than tweaking existing ASTs, since we were (*gasp*) stomping on ASTs
within templates. I'm glad we found this little stick of TNT early...

llvm-svn: 89475
2009-11-20 19:42:02 +00:00
Mike Stump 4d119e49f9 Add testcases for recent checkins.
llvm-svn: 89469
2009-11-20 18:51:28 +00:00
Anders Carlsson 0a66c26191 Fix lifetime of conditional temporaries. Patch by Victor Zverovich!
llvm-svn: 89467
2009-11-20 17:27:56 +00:00
Daniel Dunbar 9c7efbb996 Fix some codegen tests to include positive checks.
llvm-svn: 89465
2009-11-20 17:23:39 +00:00
Daniel Dunbar 69fd86dd44 Add clang -cc1 parsing of CodeGenOptions.
llvm-svn: 89464
2009-11-20 17:23:30 +00:00
Daniel Dunbar 8cde1d978f clang-cc: Lift setForcedLangOptions out of options initialization.
llvm-svn: 89462
2009-11-20 16:55:31 +00:00
Ken Dyck 33211d9658 Avoid unwanted expansion in macros that paste together INT<n>_C(v) and
UINT<n>_C(v) macros. 

llvm-svn: 89461
2009-11-20 16:49:10 +00:00
Ken Dyck 8dcc21420b Avoid unwanted expansion in macros that paste together INT<n>_MIN, INT<n>_MAX,
and UINT<n>_MAX defintions.

llvm-svn: 89460
2009-11-20 16:44:38 +00:00
Ken Dyck 764a5f3881 Avoid unwanted macro expansion in macros that paste together int<n>_t and
uint<n>_t definitions.

llvm-svn: 89459
2009-11-20 16:37:35 +00:00
David Chisnall bc8bdea183 Fixed crash when using undefined protocols (GNU runtime).
llvm-svn: 89457
2009-11-20 14:50:59 +00:00
Benjamin Kramer df5280df05 Add a workaround to silence a bogus g++-4.4 -pedantic warning.
driver.cpp:211: warning: ISO C++ forbids zero-size array 'argv'

llvm-svn: 89455
2009-11-20 11:49:06 +00:00
Benjamin Kramer 7d875c7e7e Fix typo GCC 4.3 warned about.
llvm-svn: 89453
2009-11-20 10:03:00 +00:00
Zhongxing Xu adfd1a2e8b no need to cast.
llvm-svn: 89451
2009-11-20 06:14:56 +00:00
Eli Friedman 564048e692 Fix a couple minor memory leaks.
llvm-svn: 89450
2009-11-20 05:53:06 +00:00
Ted Kremenek a4f7c180ae Add simple static analyzer checker to check for sending 'release', 'retain', etc. directly to a class. Fixes <rdar://problem/7252064>.
llvm-svn: 89449
2009-11-20 05:27:05 +00:00
Ted Kremenek c1f161c012 Unused ivar checker: ivars referenced by lexically nested functions should not be flagged as unused. Fixes <rdar://problem/7254495>.
llvm-svn: 89448
2009-11-20 04:31:57 +00:00
Zhongxing Xu 1aec3c0427 No need to pass the state argument explicitly.
llvm-svn: 89447
2009-11-20 04:09:56 +00:00
Zhongxing Xu ab0ae2139a Revert r89437 and add a comment.
llvm-svn: 89446
2009-11-20 03:50:46 +00:00
Mike Stump d8d26d06a5 Implement throw d, where d is a class type that requires copy
construction.  WIP.

llvm-svn: 89442
2009-11-20 02:31:07 +00:00
Douglas Gregor 3153da7154 Don't build an explicit conversion to a reference type
llvm-svn: 89441
2009-11-20 02:31:03 +00:00
Mike Stump 4d7a07bdaf Handle throw d, where d is a class type but only has a trivial copy
constructor.  WIP.

llvm-svn: 89438
2009-11-20 01:57:39 +00:00
Zhongxing Xu 6d9a942174 It's unnecessary to check for unknown at this point.
llvm-svn: 89437
2009-11-20 01:56:48 +00:00
Daniel Dunbar f7535121a2 Driver: Add parsing for TargetOptions to CompilerInvocation::CreateFromArgs.
llvm-svn: 89435
2009-11-20 01:46:44 +00:00
Daniel Dunbar c5d28f2ea9 Ignore -Wstrict-overflow={3,4,5} for now.
llvm-svn: 89433
2009-11-20 01:31:27 +00:00
Ted Kremenek a96d02c76b Really fix test case.
llvm-svn: 89430
2009-11-20 01:20:12 +00:00
Ted Kremenek 4b412f51df Fix test case.
llvm-svn: 89429
2009-11-20 01:19:22 +00:00
Douglas Gregor ee9067c51f When we have a non-dependent expression such as
A::f

that occurs within a non-static member function with a type-dependent
"this", don't consider this to be a case for introduction of an
implicit "(*this)." to refer to a specific member function unless we
know (at template definition time) that A is a base class of *this.

There is some disagreement here between GCC, EDG, and Clang about the
handling of this case. I believe that Clang now has the correct,
literal interpretation of the standard, but have asked for
clarification (c++std-core-15483).

llvm-svn: 89425
2009-11-20 00:59:20 +00:00
Mike Stump d1782cc478 Add suport for throw;. WIP.
llvm-svn: 89424
2009-11-20 00:56:31 +00:00
Mike Stump 18fc44dfd3 Fix rtti generation for throws. WIP.
llvm-svn: 89420
2009-11-20 00:43:57 +00:00
Mike Stump 101f052faf Simplify rtti building code a little. Prep for reuse for throw rtti
generation.

llvm-svn: 89416
2009-11-20 00:31:50 +00:00
Ted Kremenek dd2b2b23c8 Fix null dereference in NSAutoreleasePoolChecker when analyzing messages sent to blocks.
llvm-svn: 89413
2009-11-20 00:12:36 +00:00
Mike Stump a7a1b7e780 Fixup key function calculations.
llvm-svn: 89412
2009-11-20 00:02:19 +00:00
Douglas Gregor deebf6efab Deduce a ConstantArrayType from a value-dependent initializer list
rather than punting to a DependentSizedArrayType, tightening up our
type checking for template definitions. Thanks, John!

llvm-svn: 89407
2009-11-19 23:25:22 +00:00
John McCall 8cd7813ca3 Draw a brighter line between "unresolved" expressions, where we have done the
appropriate lookup and simply can't resolve the referrent yet, and
"dependent scope" expressions, where we can't do the lookup yet because the
entity we need to look into is a dependent type.

llvm-svn: 89402
2009-11-19 22:55:06 +00:00
Fariborz Jahanian e774fa6412 Don't issue spurious diagnostic with Obj-C fast enumeration.
(radar 7409165).

llvm-svn: 89400
2009-11-19 22:12:37 +00:00
Daniel Dunbar 84e8a249fa Fix some default in the option classes, and some CompilerInvocation argification
errors.

llvm-svn: 89388
2009-11-19 20:54:59 +00:00
Daniel Dunbar 69d98a6818 Add missing dependency on TableGen.
llvm-svn: 89387
2009-11-19 20:54:45 +00:00
Mike Stump cd2b821241 Fixup address point computations. WIP.
llvm-svn: 89386
2009-11-19 20:52:19 +00:00
Ted Kremenek 439a6d146c Fix crash when using --analyzer-store=region when handling initializers with nested arrays/structs whose values are not explicitly specified. Fixes <rdar://problem/7403269>.
llvm-svn: 89384
2009-11-19 20:20:24 +00:00
Ted Kremenek 0c54d2da14 Remove printf statement.
llvm-svn: 89383
2009-11-19 20:01:53 +00:00
Ted Kremenek 0c78ae18ab Fix 80 col. violation.
llvm-svn: 89382
2009-11-19 19:59:42 +00:00
Ted Kremenek 4b35a2ed08 Only fetch the ASTContext object within the assertion.
llvm-svn: 89375
2009-11-19 19:04:08 +00:00
Daniel Dunbar 5d26212f6b Silence -Asserts warning.
llvm-svn: 89373
2009-11-19 18:53:25 +00:00
Daniel Dunbar 8c9efca5bd Driver: Move INPUT and UNKNOWN sentinel options into the OptParser.td file.
llvm-svn: 89371
2009-11-19 18:47:17 +00:00
Fariborz Jahanian 1eab66c7cc Patch to implement new-operators with default args.
Fixes pr5547.

llvm-svn: 89370
2009-11-19 18:39:40 +00:00
Daniel Dunbar 0f32a4bc86 Driver: Add Sentinel flag to option kinds.
llvm-svn: 89367
2009-11-19 18:09:06 +00:00
Douglas Gregor ad2956c25d Cope with an amusingly little anomaly with dependent types and
incomplete array initialization, where we have the following in a
template:

  int a[] = { 1, 2, something-value-dependent };
  // ...
  sizeof(a);

The type of "a" appears to be a non-dependent IncompleteArrayType, but
treating it as such makes the sizeof(a) fail at template definition
time. We now correctly handle this by morphing the IncompleteArrayType
into a DependentSizedArrayType with a NULL expression, indicating that
its size has no corresponding expression (and, therefore, the type is
distinct from others).

llvm-svn: 89366
2009-11-19 18:03:26 +00:00
John Thompson e467e19766 Added preliminary support step for PS3
llvm-svn: 89362
2009-11-19 17:18:50 +00:00
Douglas Gregor 45959e5556 Try yet again to de-bork CMake Windows build w.r.t. clang++
llvm-svn: 89361
2009-11-19 16:42:34 +00:00
Ken Dyck aff01ceb95 Define WCHAR_MIN and WCHAR_MAX in terms of __WCHAR_WIDTH__ for consistency with
other limit macros.

llvm-svn: 89355
2009-11-19 15:53:08 +00:00
Ken Dyck 0138b9e1db Define __WCHAR_WIDTH__ for use in stdint.h.
llvm-svn: 89353
2009-11-19 15:47:58 +00:00
Ken Dyck f0b343f5b7 Parameterize WINT_MIN and WINT_MAX with __WINT_WIDTH__ to support arbitrary
widths. This corrects the values of these definitions for MSP430 and PIC16.

llvm-svn: 89350
2009-11-19 14:35:19 +00:00
Ken Dyck a1f677c3d1 Add __WINT_WIDTH__ to paramaterize the limits of WINT_MIN and WINT_MAX in
stdint.h.

llvm-svn: 89348
2009-11-19 14:16:57 +00:00
Ken Dyck 279ed5189c Construct definition of SIZE_MAX from __SIZE_WIDTH__ to support targets of
arbitrary widths.

llvm-svn: 89347
2009-11-19 14:03:24 +00:00