Commit Graph

11962 Commits

Author SHA1 Message Date
Zhongxing Xu 319deb83d2 Cast evaluation no longer touch GRState.
llvm-svn: 95290
2010-02-04 04:56:43 +00:00
Ted Kremenek 49f878524c Specially handle casts to 'void' in AdjustedReturnValueChecker.
llvm-svn: 95287
2010-02-04 04:18:55 +00:00
Ted Kremenek 33617e055a Remove stray typo.
llvm-svn: 95286
2010-02-04 04:14:49 +00:00
John McCall d061b4429e Mangle member expressions. Also invented.
llvm-svn: 95284
2010-02-04 02:56:29 +00:00
Zhongxing Xu 4f8b9899bb Now that CastRetrievedVal returns SVal, there is no need to use CastResult.
llvm-svn: 95279
2010-02-04 02:39:47 +00:00
John McCall 11ef09f8b5 Add a cautionary note about the mangling I just invented.
llvm-svn: 95275
2010-02-04 01:48:38 +00:00
John McCall 09de8ecd88 Add mangling support for calls, sizeof/alignof, constructor calls,
float literals, and unresolved lookups (which required hand-wavey extensions).

llvm-svn: 95273
2010-02-04 01:42:13 +00:00
Ted Kremenek 1e3b95580c static analyzer: handle casts of a function to a function pointer with
a different return type.  While we don't emit any errors (yet), at
least we avoid cases where we might crash because of an assertion
failure later on (when the return type differs from what is expected).

llvm-svn: 95268
2010-02-04 00:47:48 +00:00
Fariborz Jahanian b8355e3b9f Fix rewriting of 'const' __block variables in
the rewriter. (Fixes radar 7607781).

llvm-svn: 95267
2010-02-04 00:07:58 +00:00
Anders Carlsson b0695ef011 Don't try to fold DeclRefExprs that point to ParmVarDecls. This had the side-effect of always folding the expression to the default argument of the parameter. For example:
void f(int a = 10) {
  return a;
}

would always return 10, regardless of the passed in argument.

This fixes another 600 test failures. We're now down to only 137 failures!

llvm-svn: 95262
2010-02-03 21:58:41 +00:00
Fariborz Jahanian 80c54b05a0 Fix more rewriting of protocol-quialified 'id' type.
(Fixes radar 7607413).

llvm-svn: 95257
2010-02-03 21:29:28 +00:00
Sebastian Redl 2b37272c11 In some contexts, type declarations cannot occur. Pass this information down to ParseClassSpecifier, to make its decision easier. Fixes PR6200.
llvm-svn: 95255
2010-02-03 21:21:43 +00:00
Chris Lattner 93ddf80eb7 don't inform comment handlers about comments in #if 0 blocks,
doing so invalidates the file guard optimization and is not
in the spirit of "#if 0" because it is supposed to completely
skip everything, even if it isn't lexically valid. Patch by
Abramo Bagnara!

llvm-svn: 95253
2010-02-03 21:06:21 +00:00
Douglas Gregor 21e771e96e Define two types to be "compatible" in C++ if they are the same, and
remove some age-old FIXMEs and C++ workarounds within the
type-compatibility logic.

llvm-svn: 95249
2010-02-03 21:02:30 +00:00
Chris Lattner 5e854b95f3 Declarators can have grouping parens. This fixes rdar://7608537.
llvm-svn: 95246
2010-02-03 20:41:24 +00:00
Fariborz Jahanian 8c3f06d09c Patch to allow reinterpret_cast on objective-c pointers.
(partial fix for radar 7591784).

llvm-svn: 95245
2010-02-03 20:32:31 +00:00
Daniel Dunbar 45858d2d59 Revert "Numerous changes to selector handling:", this breaks a whole bunch of
working code, for no apparent reason.

llvm-svn: 95244
2010-02-03 20:11:42 +00:00
Sebastian Redl cbdffb1585 Top-level const changes do not make a qualification conversion. Fixes PR6089.
llvm-svn: 95239
2010-02-03 19:36:07 +00:00
Douglas Gregor 2973d406ba When determining whether a function without a prototype is compatible
with a function with a prototype, treat parameters of enumeration type
based on the enumeration type's promotion type.

llvm-svn: 95238
2010-02-03 19:27:29 +00:00
Anders Carlsson 66498388a7 Handle reference binding in aggregate initializers. Fixes another 47 tests.
llvm-svn: 95235
2010-02-03 19:13:55 +00:00
Anders Carlsson 9b92ef90f0 Add a band-aid fix for clang self-hosting. A better fix will follow shortly.
llvm-svn: 95232
2010-02-03 18:54:13 +00:00
Eli Friedman eb1df70bdc Fix for PR6220: compute the correct type for multicharacter literals.
llvm-svn: 95228
2010-02-03 18:21:45 +00:00
Anders Carlsson b247350ef7 More cleanup.
llvm-svn: 95226
2010-02-03 17:33:16 +00:00
Anders Carlsson 3b227bd629 Revert the new reference binding code; I came up with a way simpler solution for the reference binding bug that is preventing self-hosting.
llvm-svn: 95223
2010-02-03 16:38:03 +00:00
David Chisnall 5bb4efdf3c First pass at adding GC support for GNU runtime. GC ivar maps not yet constructed, GC flag not set.
Please don't try using this yet - the runtime support is still very immature and your code will almost certainly crash if you do.  

llvm-svn: 95222
2010-02-03 15:59:02 +00:00
Chandler Carruth 935384217d Teach the allocation function overload handling to deal with templates, and
prevent a crash on templates when looking for an existing declaration of the
predefined global operators. This fixes PR5918.

Added an easy test case for the overload handling, but testing the crash is
a bit trickier. Created a new test that can use multiple runs with a define to
trigger which test case is used so we can test this type of issue.

llvm-svn: 95220
2010-02-03 11:02:14 +00:00
Chandler Carruth 7ceffab64d Fix PR6149 by looking at the qualifiers on the referred to type for non-type
reference template arguments. Adds test cases for the cv-quals of reference
arguments.

llvm-svn: 95217
2010-02-03 09:37:33 +00:00
Douglas Gregor 7dc5c17d92 When a function or variable somehow depends on a type or declaration
that is in an anonymous namespace, give that function or variable
internal linkage.

This change models an oddity of the C++ standard, where names declared
in an anonymous namespace have external linkage but, because anonymous
namespace are really "uniquely-named" namespaces, the names cannot be
referenced from other translation units. That means that they have
external linkage for semantic analysis, but the only sensible
implementation for code generation is to give them internal
linkage. We now model this notion via the UniqueExternalLinkage
linkage type. There are several changes here:

  - Extended NamedDecl::getLinkage() to produce UniqueExternalLinkage
    when the declaration is in an anonymous namespace.
  - Added Type::getLinkage() to determine the linkage of a type, which
    is defined as the minimum linkage of the types (when we're dealing
    with a compound type that is not a struct/class/union).
  - Extended NamedDecl::getLinkage() to consider the linkage of the
    template arguments and template parameters of function template
    specializations and class template specializations.
  - Taught code generation to rely on NamedDecl::getLinkage() when
    determining the linkage of variables and functions, also
    considering the linkage of the types of those variables and
    functions (C++ only). Map UniqueExternalLinkage to internal
    linkage, taking out the explicit checks for
    isInAnonymousNamespace().

This fixes much of PR5792, which, as discovered by Anders Carlsson, is
actually the reason behind the pass-manager assertion that causes the
majority of clang-on-clang regression test failures. With this fix,
Clang-built-Clang+LLVM passes 88% of its regression tests (up from
67%). The specific numbers are:

LLVM:
  Expected Passes    : 4006
  Expected Failures  : 32
  Unsupported Tests  : 40
  Unexpected Failures: 736

Clang:
  Expected Passes    : 1903
  Expected Failures  : 14
  Unexpected Failures: 75

Overall:
  Expected Passes    : 5909
  Expected Failures  : 46
  Unsupported Tests  : 40
  Unexpected Failures: 811

Still to do:
  - Improve testing
  - Check whether we should allow the presence of types with
  InternalLinkage (in addition to UniqueExternalLinkage) given
  variables/functions internal linkage in C++, as mentioned in
  PR5792. 
  - Determine how expensive the getLinkage() calls are in practice;
  consider caching the result in NamedDecl.
  - Assess the feasibility of Chris's idea in comment #1 of PR5792.

llvm-svn: 95216
2010-02-03 09:33:45 +00:00
Chandler Carruth 54a0f48e0b Add FlatStore.cpp (from r95214) to CMake build. Don't forget about it! =D
llvm-svn: 95215
2010-02-03 09:31:39 +00:00
Zhongxing Xu 5df3f53616 Add skeleton of flat store manager.
llvm-svn: 95214
2010-02-03 09:10:32 +00:00
Douglas Gregor 4a2f5464a7 Look through CXXExprWithTemporaries when digging out the original
initializer. Grrr....

llvm-svn: 95211
2010-02-03 09:01:59 +00:00
Chris Lattner 78c8eaa4cb update for llvm api change.
llvm-svn: 95203
2010-02-03 05:55:22 +00:00
Chris Lattner eb1e610d00 remove a big chunk of #if 0 code.
llvm-svn: 95201
2010-02-03 05:28:17 +00:00
Ted Kremenek d960564b76 Fix regression in RegionStore due to recent changes in
RegionStoreManager::InvalidateRegions() by adjusting the worklist to
iterate over BindingKeys instead of MemRegions.  We also only need to
do the actual invalidation work on base regions, and for non-base
regions just blow away their bindings.

llvm-svn: 95200
2010-02-03 04:16:00 +00:00
Sam Weinig a16b0dd1ae Implement Doug's suggestion. Eliminate the Stmts pointer from CXXTryStmt and instead allocate the statements after the object.
llvm-svn: 95199
2010-02-03 03:56:39 +00:00
Daniel Dunbar c434394d18 Driver: Add -[no-]integrated-as for clang.
- Requires backend support, which only exists for i386--darwin currently.

No 'as' required:
--
ddunbar@ozzy:tmp$ cat t.c
int main() { return 42; }
ddunbar@ozzy:tmp$ clang -m32 -integrated-as t.c


ddunbar@ozzy:tmp$ ./a.out; echo $?
42
ddunbar@ozzy:tmp$
--

The random extra whitespace is how you know its working! :)

llvm-svn: 95194
2010-02-03 03:07:56 +00:00
Ted Kremenek 64efd0d213 Rework RegionStoreManager's implementation of InvalidateRegions() to
not build a subregion map and instead do a single scan of the store.
This is done by building "region clusters" that represent the
collection of regions that have the same base region.  Invalidating
any region in a cluster means that they all should get invalidated.

This change brought out a point that Zhongxing mentioned to me
offline: the flattened memory binding has issues distinguishing
between direct and default bindings.  For example, setting the default
value for an entire struct is the same as binding to the first
element.  To address this problem, I moved the binding "tag" (Direct
or Default) from BindingVal to BdingKey (and removed BindingVal
entirely).  This requires us to do double lookups in some cases; and
there is still much more cleanup that can be done.

This change produced a noticeable speedup when analyzing sqlite3 (a
reduction of 4% in running time).

llvm-svn: 95193
2010-02-03 03:06:46 +00:00
Douglas Gregor db56b919e5 Provide a real fix for PR6199, reverting the old workaround. Here, we
realize that CXXConstructExpr is always implicit, so we should just
return its argument (if there is only one) rather than directly
invoking the constructor.

llvm-svn: 95192
2010-02-03 03:01:57 +00:00
Sam Weinig ebcea988c2 Remove the SmallVector from CXXTryStmt.
llvm-svn: 95190
2010-02-03 02:09:59 +00:00
David Chisnall 92b762e256 Numerous changes to selector handling:
- Don't use GlobalAliases with non-0 GEPs (GNU runtime) - this was unsupported and LLVM will be generating errors if you do it soon.  This also simplifies the code generated by the GNU runtime a bit.  

- Make GetSelector() return a constant (GNU runtime), not a load of a store of a constant.

- Recognise @selector() expressions as valid static initialisers (as GCC does).

- Add methods to GCObjCRuntime to emit selectors as constants (needed for using @selector() expressions as constants.  These need implementing for the Mac runtimes - I couldn't figure out how to do this, they seem to require a load.

- Store an ObjCMethodDecl in an ObjCSelectorExpr so that we can get at the type information for the selector.  This is needed for generating typed selectors from @selector() expressions (as GCC does).  Ideally, this information should be stored in the Selector, but that would be an invasive change.  We should eventually add checks for common uses of @selector() expressions.  Possibly adding an attribute that can be applied to method args providing the types of a selector so, for example, you'd do something like this:

- (id)performSelector: __attribute__((selector_types(id, SEL, id)))(SEL)
           withObject: (id)object;

Then, any @selector() expressions passed to the method will be check to ensure that it conforms to this signature.  We do this at run time on the GNU runtime already, but it would be nice to do it at compile time on all runtimes.

- Made @selector() expressions emit type info if available and the runtime supports it.

Someone more familiar with the Mac runtime needs to implement the GetConstantSelector() function in CGObjCMac.  This currently just assert()s.

llvm-svn: 95189
2010-02-03 02:09:30 +00:00
Sebastian Redl d85be0cc60 Don't do an expensive definition check where a cheap 'is this C?' check suffices.
llvm-svn: 95188
2010-02-03 02:08:48 +00:00
Chris Lattner 35af0ab3eb fix PR6216
llvm-svn: 95185
2010-02-03 01:45:03 +00:00
Daniel Dunbar 92db0fbe5a clang -cc1: Wire up -emit-obj, for emitting object files.
llvm-svn: 95182
2010-02-03 01:18:43 +00:00
John McCall 2adddcae7e Remove abstract expression kinds from the StmtClass enum. Update a few users
appropriately.  Call out a few missing cases in the expression mangler.

llvm-svn: 95176
2010-02-03 00:55:45 +00:00
Fariborz Jahanian e165191990 Simplify setting of DeclContext for @catch variable
(per Doug's comment).

llvm-svn: 95169
2010-02-03 00:32:51 +00:00
Douglas Gregor b92a1565c3 Implement the lvalue-to-rvalue conversion where needed. The
lvalue-to-rvalue conversion adjusts lvalues of qualified, non-class
type to rvalue expressions of the unqualified variant of that
type. For example, given:

  const int i;
  (void)(i + 17);

the lvalue-to-rvalue conversion for the subexpression "i" will turn it
from an lvalue expression (a DeclRefExpr) with type 'const int' into
an rvalue expression with type 'int'. Both C and C++ mandate this
conversion, and somehow we've slid through without implementing it. 

We now have both DefaultFunctionArrayConversion and
DefaultFunctionArrayLvalueConversion, and which gets used depends on
whether we do the lvalue-to-rvalue conversion or not. Generally, we do
the lvalue-to-rvalue conversion, but there are a few notable
exceptions:
  - the left-hand side of a '.' operator
  - the left-hand side of an assignment
  - a C++ throw expression
  - a subscript expression that's subscripting a vector

Making this change exposed two issues with blocks:
  - we were deducing const-qualified return types of non-class type
  from a block return, which doesn't fit well
  - we weren't always setting the known return type of a block when it
  was provided with the ^return-type syntax

Fixes the current Clang-on-Clang compile failure and PR6076.

llvm-svn: 95167
2010-02-03 00:27:59 +00:00
Fariborz Jahanian 08d614d92e Fix DeclContext of an objective-c @catch variable
declaration. Fixes radar 7590273.

llvm-svn: 95164
2010-02-03 00:01:43 +00:00
Ted Kremenek b251eb6901 Remove RegionStoreSubRegionMap::iterator and RegionStoreSubRegionMap::begin_end(). This is a precursor to using DenseSet to represent region sets instead of ImmutableSet.
llvm-svn: 95151
2010-02-02 22:38:47 +00:00
Ted Kremenek 416b923786 Explicitly check for casts to double or complex types instead of possibly asserting in SValuator.
llvm-svn: 95128
2010-02-02 21:11:40 +00:00
Chris Lattner 60272554aa update for llvm api changes.
llvm-svn: 95125
2010-02-02 21:06:50 +00:00
Douglas Gregor a71cc15361 Implement promotion for enumeration types.
WHAT!?!

It turns out that Type::isPromotableIntegerType() was not considering
enumeration types to be promotable, so we would never do the
promotion despite having properly computed the promotion type when the
enum was defined. Various operations on values of enum type just
"worked" because we could still compute the integer rank of an enum
type; the oddity, however, is that operations such as "add an enum and
an unsigned" would often have an enum result type (!). The bug
actually showed up as a spurious -Wformat diagnostic
(<rdar://problem/7595366>), but in theory it could cause miscompiles.

In this commit:
  - Enum types with a promotion type of "int" or "unsigned int" are
  promotable.
  - Tweaked the computation of promotable types for enums
  - For all of the ABIs, treat enum types the same way as their
  underlying types (*not* their promotion types) for argument passing
  and return values
  - Extend the ABI tester with support for enumeration types

llvm-svn: 95117
2010-02-02 20:10:50 +00:00
Anders Carlsson 5dc86337fb Set the correct vtable pointers _before_ generating code for any member initializers. Fixes about ~2000 clang/LLVM tests in the clang-on-clang build.
llvm-svn: 95116
2010-02-02 19:58:43 +00:00
Chris Lattner f3c1b08508 update for llvm api change.
llvm-svn: 95110
2010-02-02 19:14:34 +00:00
John McCall eba90cd682 Dump the constructor type for a CXXConstructExpr.
llvm-svn: 95106
2010-02-02 19:03:45 +00:00
John McCall c17ae44b09 Fix this comment.
llvm-svn: 95104
2010-02-02 19:02:38 +00:00
Sebastian Redl f184291fec Check for redefinitions in MergeVarDecl. This finds redefinitions of globals without an initializer in C++ and thus fixes PR5451.
llvm-svn: 95098
2010-02-02 18:35:11 +00:00
Fariborz Jahanian 06769f9197 Fix up rewriting of protocol qualified types in objc rewriter.
Fixes radar 7589414.

llvm-svn: 95097
2010-02-02 18:35:07 +00:00
Sebastian Redl ccdb5ff17d Fix a C++ regression where redefinitions weren't diagnosed.
llvm-svn: 95096
2010-02-02 17:55:12 +00:00
Chris Lattner afe6a840d4 the declspec of a declaration can have storage-class specifiers,
type qualifiers and type specifiers in any order.   For example,
this is valid: struct x {...} typedef y;

This fixes PR6208.

llvm-svn: 95094
2010-02-02 17:32:27 +00:00
Daniel Dunbar ffa70e8b27 Driver/Darwin: Don't error/warn on conflicting deployment targets. Apparently
this is still a popular thing to do.

llvm-svn: 95093
2010-02-02 17:31:12 +00:00
Chandler Carruth 173bfe477b Use the Arg variable rather than re-computing it. This also silences GCC's
unused variable warning.

llvm-svn: 95085
2010-02-02 12:15:55 +00:00
John McCall 03c4848bf4 Mark dtors for parameter variables and eliminate some redundant type munging.
llvm-svn: 95079
2010-02-02 09:10:11 +00:00
John McCall 6781b05a92 Access control for implicit destructor calls. Diagnostic could be orders of
magnitude clearer.

llvm-svn: 95078
2010-02-02 08:45:54 +00:00
John McCall 49786a6c31 Codegen CXXConstructExprs with trivial constructors as constants.
Eliminates a lot of spurious global initializers, fixing PR6205.

llvm-svn: 95077
2010-02-02 08:02:49 +00:00
Anders Carlsson 75b1f959da Check in a test case and a nasty workaround for PR6199.
llvm-svn: 95076
2010-02-02 07:10:35 +00:00
John McCall 1acbbb5a4c Extract a common base class between UnresolvedLookupExpr and
UnresolvedMemberExpr and employ it in a few places where it's useful.

llvm-svn: 95072
2010-02-02 06:20:04 +00:00
Anders Carlsson e8bfe412ec Improve handling of emitting 'null' pointers to data members.
llvm-svn: 95066
2010-02-02 05:17:25 +00:00
Anders Carlsson 259688ce29 Move pointer to data member emission to CodeGenModule and use it in CGExprConstant. Fixes PR5674.
llvm-svn: 95063
2010-02-02 03:37:46 +00:00
John McCall fb7ad0f57a Improve the diagnostic used when an incompatible overload set is passed
as an argument during overload resolution.

llvm-svn: 95057
2010-02-02 02:42:52 +00:00
John McCall c1f69989b1 Implement C++ [temp.deduct.call]p6, template argument deduction for overloaded
arguments.  Fix a bug where incomplete explicit specializations were being
passed through as legitimate.  Fix a bug where the absence of an explicit
specialization in an overload set was causing overall deduction to fail.

Fixes PR6191.

llvm-svn: 95052
2010-02-02 02:21:27 +00:00
Ted Kremenek 545168268b Add a stop gap to Sema::CorrectTypo() to correct only up to 20 typos.
This is to address a serious performance problem observed when running
'clang -fsyntax-only' on really broken source files.  In one case,
repeatedly calling CorrectTypo() caused one source file to be rejected
after 2 minutes instead of 1 second.

This patch causes typo correction to take neglible time on that file
while still providing correction results for the first 20 cases.  I
felt this was a reasonable number for moderately broken source files.

I don't claim this is the best solution.  Comments welcome.  It is
necessary for us to address this issue because it is a serious
performance problem.

llvm-svn: 95049
2010-02-02 02:07:01 +00:00
Ted Kremenek fab459fc95 Fix bug in GRExprEngine::VisitSizeOfAlignOfExpr() where we do not add
'Pred' to 'Dst' for cases we currently don't handle.  This fixes
<rdar://problem/7593875>.

llvm-svn: 95048
2010-02-02 02:01:51 +00:00
Chris Lattner cf25141d14 Implement PR6180, substantially improving the diagnostics we get from
forgetting a ';' at the end of a struct.  For something like:

class c {
}
void foo() {}

we now produce:

t.cc:3:2: error: expected ';' after class
}
 ^
 ;

instead of:

t.cc:4:1: error: cannot combine with previous 'class' declaration specifier
void foo() {}
^
t.cc:2:7: error: 'class c' can not be defined in the result type of a function
class c {
      ^

GCC produces:

t.cc:4: error: new types may not be defined in a return type
t.cc:4: note: (perhaps a semicolon is missing after the definition of ‘c’)
t.cc:4: error: two or more data types in declaration of ‘foo’

I *think* I got the follow set right, but if I forgot anything, we'll start 
getting spurious "expected ';' after class" errors, let me know if you see
any.

llvm-svn: 95042
2010-02-02 01:23:29 +00:00
Chris Lattner 916dbf114a improve diagnostics for C++ struct ; issues. Before:
t.cc:4:3: error: expected ';' at end of declaration list
  int y;
  ^
t.cc:6:1: error: expected ';' at end of declaration list
};
^

After:

t.cc:3:8: error: expected ';' at end of declaration list
  int x
       ^
       ;
t.cc:5:8: error: expected ';' at end of declaration list
  int z
       ^
       ;

llvm-svn: 95039
2010-02-02 00:43:15 +00:00
Chris Lattner 245c5335b5 improve diagnostics on missing ; in a struct. Before:
t.c:4:3: error: expected ';' at end of declaration list
  int y;
  ^
t.c:4:8: warning: extra ';' inside a struct or union
  int y;
       ^
t.c:6:1: warning: expected ';' at end of declaration list
};
^

After:

t.c:3:8: error: expected ';' at end of declaration list
  int x  // expected-error {{expected ';' at end of declaration list}}
       ^
       ;
t.c:5:8: warning: expected ';' at end of declaration list
  int z
       ^
       ;

llvm-svn: 95038
2010-02-02 00:37:27 +00:00
Ted Kremenek 0059c491c1 Hoist diagnostic generation in ReturnStackAddressChecker into a separate method. No functionality change.
llvm-svn: 95037
2010-02-02 00:13:41 +00:00
Douglas Gregor 6791a0d43b Improve handling of enumerator values for C and C++, including:
- In C++, prior to the closing '}', set the type of enumerators
    based on the type of their initializer. Don't perform unary
    conversions on the enumerator values.
  - In C++, handle overflow when an enumerator has no initializer and
    its value cannot be represented in the type of the previous
    enumerator.
  - In C, handle overflow more gracefully, by complaining and then
    falling back to the C++ rules.
  - In C, if the enumerator value is representable in an int, convert the
    expression to the type 'int'.

Fixes PR5854 and PR4515.

llvm-svn: 95031
2010-02-01 23:36:03 +00:00
Daniel Dunbar 96ebba5770 ARM/APCS: Fix classification of small complex integer types as "integer like".
llvm-svn: 95030
2010-02-01 23:31:26 +00:00
Daniel Dunbar eedf151cb1 ARM/APCS: Pass Complex types following llvm-gcc.
llvm-svn: 95029
2010-02-01 23:31:19 +00:00
Ted Kremenek 016b605266 Add format string type checking support for 'long double'.
llvm-svn: 95026
2010-02-01 23:23:50 +00:00
Devang Patel ab793231c1 Fix FIXME and surrounding comment.
llvm-svn: 95023
2010-02-01 22:51:29 +00:00
Devang Patel e8fb4b7fd6 Use appropriate context descriptor in RecordDecl's debug info.
llvm-svn: 95016
2010-02-01 22:40:08 +00:00
Devang Patel 3efd1470c9 Do not use clang type name to name a local variable, e.g. Decl.
llvm-svn: 95010
2010-02-01 21:52:22 +00:00
Devang Patel 1c0954cca7 Do not use clang type name to name a local variable, e.g. Decl.
llvm-svn: 95009
2010-02-01 21:39:52 +00:00
Devang Patel 7b7f46f5a6 Use DeclContext as getContextDescriptor() argument.
llvm-svn: 95008
2010-02-01 21:34:11 +00:00
Daniel Dunbar 98188414ef Driver/Darwin: Darwin uses -fobjc-legacy-dispatch on ARM.
llvm-svn: 95006
2010-02-01 21:07:43 +00:00
Daniel Dunbar ca5e3eb7f7 NeXT: Add support for -fobjc-legacy-dispatch.
llvm-svn: 95005
2010-02-01 21:07:33 +00:00
Daniel Dunbar 2e3f2c805e Driver/Frontend: Add support for -fobjc-legacy-dispatch, not yet used.
llvm-svn: 95004
2010-02-01 21:07:25 +00:00
Chris Lattner 5b5d2db3f6 Don't explicitly force utf strings into the __TEXT,__ustring
by setting the section of the generated global.  This is an
optimization done by the code generator, and the code being
removed didn't handle the case when the string contained an
embedded nul (which the code generator does correctly 
handle).  This is rdar://7589850

llvm-svn: 95003
2010-02-01 20:59:08 +00:00
Sebastian Redl 5ca7984bb4 In C++, an initializer on a variable doesn't necessarily mean it's the definition. With that in mind, rename getDefinition to getAnyInitializer (to distinguish it from getInit) and reimplement it in terms of isThisDeclarationADefinition. Update all code to use this new function.
llvm-svn: 94999
2010-02-01 20:16:42 +00:00
Chris Lattner b18093e467 fix PR6187: various load functions in xmmintrin.h were missing 'const'.
emmintrin looks ok.

llvm-svn: 94998
2010-02-01 20:14:14 +00:00
Ted Kremenek fb20c4121e Use early return as suggested by Cristian Draghici.
llvm-svn: 94994
2010-02-01 19:38:10 +00:00
Ted Kremenek cd83106151 Format string checking: selectively ignore implicit casts to 'int'
when checking if the format specifier matches the type of the data
argument and the length modifier indicates the data type is 'char' or
'short'.

llvm-svn: 94992
2010-02-01 19:28:15 +00:00
Devang Patel 973f2eb0cd Emit debug info for namespaces.
llvm-svn: 94991
2010-02-01 19:16:32 +00:00
John McCall 8b9ed55bfb Note that an overload candidate was non-viable because template argument
deduction failed.  Right now there's a very vague diagnostic for most cases
and a good diagnostic for incomplete deduction.

llvm-svn: 94988
2010-02-01 18:53:26 +00:00
Sam Weinig deb55d5123 Fix for PR5185. C99 [*] VLA notation should be disallowed in function definitions.
llvm-svn: 94972
2010-02-01 05:02:49 +00:00
John McCall 760af170ff Access checking for implicit user-defined conversions.
llvm-svn: 94971
2010-02-01 03:16:54 +00:00
Sebastian Redl 35351a9554 Add VarDecl::isThisDeclarationADefinition(), which properly encapsulates the logic for when a variable declaration is a (possibly tentativ) definition. Add a few functions building on this, and shift C tentative definition handling over to this new functionality. This shift also kills the Sema::TentativeDefinitions map and instead simply stores all declarations in the renamed list. The correct handling for multiple tentative definitions is instead shifted to the final walk of the list.
llvm-svn: 94968
2010-01-31 22:27:38 +00:00
Eli Friedman a682427e42 Switch expressions like T() and T(1,2) over to new-style initialization. I'm
not quite sure what we want to do about the AST representation; comments
welcome.

llvm-svn: 94967
2010-01-31 20:58:15 +00:00
Eli Friedman 604179775a Simplify EmitMemberInitializer; no intended functionality change.
llvm-svn: 94965
2010-01-31 19:07:50 +00:00
Anders Carlsson ab0ddb57b1 Start creating CXXBindReferenceExpr nodes when binding complex types to references.
llvm-svn: 94964
2010-01-31 18:34:51 +00:00
Anders Carlsson 8abde4b447 Diagnose binding a non-const reference to a vector element.
llvm-svn: 94963
2010-01-31 17:18:49 +00:00
Chandler Carruth 3a693b7428 Return early, reduce indentation, and simplify line breaks. No functionality
change.

PS: I'm under the impression formatting-only patches don't need pre-commit
review, but feel free to yell at me if I should post these first! =D

llvm-svn: 94956
2010-01-31 11:44:02 +00:00
Chandler Carruth 00216980fb Really trivial patch to accept pointer to const void in indirect goto. Despite
the lack of documentation, this matches the behavior of GCC.

llvm-svn: 94954
2010-01-31 10:26:25 +00:00
Chandler Carruth 724a8a1fef Fix PR6159 and several other problems with value-dependent non-type template
arguments. This both prevents meaningless checks on these arguments and ensures
that they are represented as an expression by the instantiation.

Cleaned up and added standard text to the relevant test case. Also started
adding tests for *rejected* cases. At least one FIXME here where (I think) we
allow something we shouldn't. More to come in the area of rejecting crazy
arguments with decent diagnostics. Suggestions welcome for still better
diagnostics on these errors!

llvm-svn: 94953
2010-01-31 10:01:20 +00:00
Douglas Gregor 7ae2d7758f Rework base and member initialization in constructors, with several
(necessarily simultaneous) changes:

  - CXXBaseOrMemberInitializer now contains only a single initializer
    rather than a set of initialiation arguments + a constructor. The
    single initializer covers all aspects of initialization, including
    constructor calls as necessary but also cleanup of temporaries
    created by the initializer (which we never handled
    before!).

  - Rework + simplify code generation for CXXBaseOrMemberInitializers,
    since we can now just emit the initializer as an initializer.

  - Switched base and member initialization over to the new
    initialization code (InitializationSequence), so that it

  - Improved diagnostics for the new initialization code when
    initializing bases and members, to match the diagnostics produced
    by the previous (special-purpose) code.

  - Simplify the representation of type-checked constructor initializers in
    templates; instead of keeping the fully-type-checked AST, which is
    rather hard to undo at template instantiation time, throw away the
    type-checked AST and store the raw expressions in the AST. This
    simplifies instantiation, but loses a little but of information in
    the AST.

  - When type-checking implicit base or member initializers within a
    dependent context, don't add the generated initializers into the
    AST, because they'll look like they were explicit.

  - Record in CXXConstructExpr when the constructor call is to
  initialize a base class, so that CodeGen does not have to infer it
  from context. This ensures that we call the right kind of
  constructor.

There are also a few "opportunity" fixes here that were needed to not
regress, for example:

  - Diagnose default-initialization of a const-qualified class that
    does not have a user-declared default constructor. We had this
    diagnostic specifically for bases and members, but missed it for
    variables. That's fixed now.

  - When defining the implicit constructors, destructor, and
    copy-assignment operator, set the CurContext to that constructor
    when we're defining the body.

llvm-svn: 94952
2010-01-31 09:12:51 +00:00
Benjamin Kramer 43a645cd93 Try to unbreak MSVC build.
llvm-svn: 94951
2010-01-31 09:01:55 +00:00
Chandler Carruth 234c129fba Fix PR6156 and test several of the basic aspects of non-type template arguments
when implicitly supplied to the injected class name.

llvm-svn: 94948
2010-01-31 07:24:03 +00:00
Chandler Carruth 9b1fa25432 Handle instantiation of templates with non-type arguments expressed with an
explicit '&' by introducing an address-of operator prior to checking the
argument's type.

llvm-svn: 94947
2010-01-31 07:09:11 +00:00
Anders Carlsson 6276b2506d When performing a derived-to-base cast that we know will not change the offset, we don't need to null check the input pointer. Fixes PR5965.
llvm-svn: 94942
2010-01-31 02:39:02 +00:00
Anders Carlsson 600f737b95 When doing a base-to-derived cast we don't need to null check the derived value if the class offset is 0.
llvm-svn: 94939
2010-01-31 01:43:37 +00:00
Anders Carlsson 84673e200f Some class related cleanup.
llvm-svn: 94938
2010-01-31 01:36:53 +00:00
Daniel Dunbar 8fa74aa21d Simplify.
llvm-svn: 94929
2010-01-30 23:31:57 +00:00
Anders Carlsson 98323d29b6 Remove the SmallVectors from AsmStmt. Fixes PR6105.
llvm-svn: 94926
2010-01-30 23:19:41 +00:00
Anders Carlsson 9a020f9a3a Use IdentifierInfo * instead of std::string for the AsmStmt names.
llvm-svn: 94925
2010-01-30 22:25:16 +00:00
Daniel Dunbar 6b03ecef0d ASTUnit: Ensure the CompilerInvocation object used in LoadFromCommandLine is
live as long as the ASTUnit. This is useful for clients which want to maintain
pointers to the LangOptions object which ultimately lives in the
CompilerInvocation, although it would be nice to make all of this ownership
stuff more explicit and obvious.

llvm-svn: 94924
2010-01-30 21:47:16 +00:00
Daniel Dunbar 6824225465 CompilerInstance: Change to not contain the CompilerInvocation object.
This allows clients to install their own CompilerInvocation object, which is
important for clients that may wish to create references to things like
LangOptions whose lifetime will extend past that of the CompilerInstance.

llvm-svn: 94923
2010-01-30 21:47:07 +00:00
Anders Carlsson 0c5d7448d8 Fix thinko.
llvm-svn: 94922
2010-01-30 20:48:08 +00:00
Anders Carlsson 66de081f39 Even more AsmStmt cleanup.
llvm-svn: 94921
2010-01-30 20:38:10 +00:00
Anders Carlsson 087bc13d96 More asm cleanup.
llvm-svn: 94920
2010-01-30 20:05:21 +00:00
Benjamin Kramer 31a68e70a5 Simplify FreeBSD version parsing.
llvm-svn: 94919
2010-01-30 19:55:01 +00:00
Anders Carlsson 96fe0b5b96 Combine AsmStmt::setOutputsAndInputs and AsmStmt::setClobbers.
llvm-svn: 94918
2010-01-30 19:34:25 +00:00
Anders Carlsson c7c5baa482 Yay for more StringRefs.
llvm-svn: 94917
2010-01-30 19:12:25 +00:00
Anders Carlsson 0b0a122fde StringRef-ize the TargetInfo::ConstraintInfo constructor.
llvm-svn: 94916
2010-01-30 18:33:31 +00:00
Anders Carlsson bd32c434ae Add an assert to make sure that we don't try to mess with overridden methods for class templates.
llvm-svn: 94907
2010-01-30 17:42:34 +00:00
Benjamin Kramer 2ecf8eb2dc PCHReader doesn't implement classof so dyn_casting it will do really weird stuff. Use a static_cast instead.
I don't know if this hack is the right fix. Doug, please take a look.

llvm-svn: 94895
2010-01-30 16:23:25 +00:00
Daniel Dunbar 19b70bd46c Recognize 'q' as a format length modifier (from BSD).
llvm-svn: 94894
2010-01-30 15:49:20 +00:00
Benjamin Kramer 842bf17366 Use StringRef instead of returning a temporary std::string.
This fixes a really nasty bug in Darwin::getDarwinArchName where we were going
StringRef -> temporary std::string -> StringRef (and return the dead StringRef).
The StringRefs from Triple live as long as the Triple itself, that should be
long enough.

Hopefully 2 of 4 MSVC buildbot failures are gone now.

llvm-svn: 94892
2010-01-30 15:01:47 +00:00
Benjamin Kramer a87bdb793e We don't need to place 0 in the URL string now that we return a StringRef.
- URL can go into read only memory now.
- Compilers will fold away all the strstr calls.

llvm-svn: 94887
2010-01-30 14:01:39 +00:00
Anton Korobeynikov cbc4e98381 Fix alignment for msp430 integer types.
llvm-svn: 94879
2010-01-30 12:55:11 +00:00
Anders Carlsson a18f0fbca2 Eliminate yet another old-school PerformCopyInitialization.
llvm-svn: 94874
2010-01-30 01:56:32 +00:00
Ted Kremenek 9ff02052dd Add format string checking of 'double' arguments. Fixes <rdar://problem/6931734>.
llvm-svn: 94867
2010-01-30 01:02:18 +00:00
Ted Kremenek c3bdff7c8c Add basic type checking of format string conversion specifiers and their arguments. Thanks to Cristian Draghici for his help with this patch!
llvm-svn: 94864
2010-01-30 00:49:51 +00:00
Ted Kremenek 605b0113f3 Be a little more permissive than C99: allow 'unsigned' to be used for
the field width and precision of a format specifier instead of just
'int'.  This matches GCC, and fixes <rdar://problem/6079850>.

llvm-svn: 94856
2010-01-29 23:32:22 +00:00
Ted Kremenek ba775fe5c7 Fix spacing.
llvm-svn: 94852
2010-01-29 23:00:35 +00:00
Ted Kremenek 79db7b7b17 Per a suggestion from Cristian Draghici, add a method to FormatSpecifier that returns the expected type of the matching data argument. It isn't complete, but should handle several of the important cases.
llvm-svn: 94851
2010-01-29 22:59:32 +00:00
Devang Patel bb4820dc8e Use appropriate context for typedefs.
llvm-svn: 94849
2010-01-29 22:29:31 +00:00
Daniel Dunbar 1299819f71 Driver: Don't honor -std-default for C++, this makes it hard to run the gdb test
suite with clang++ enabled.

The right fix here is PR6175, although we would still have to find a different
work around for the gdb test suite.

llvm-svn: 94838
2010-01-29 21:03:02 +00:00
Ted Kremenek 8d9842d43f Switch Sema over to using the new implementation of format string
checking.  It passes all existing tests, and the diagnostics have been
refined to provide better range information (we now highlight
individual format specifiers) and more precise wording in the
diagnostics.

llvm-svn: 94837
2010-01-29 20:55:36 +00:00
Ted Kremenek 23a71a1cdf Enhancements to the alternate (WIP) format string checking:
- Add ConversionSpecifier::consumesDataArgument() as a helper method
  to determine if a conversion specifier requires a matching argument.
- Add support for glibc-specific '%m' conversion
- Add an extra callback to HandleNull() for locations within the
  format specifier that have a null character

llvm-svn: 94834
2010-01-29 20:29:53 +00:00
Douglas Gregor d1e08648c6 Fix reference-binding when we have a reference to const volatile type;
previously, we were allowing this to bind to a temporary. Now, we
don't; add test-cases and improve diagnostics.

llvm-svn: 94831
2010-01-29 19:39:15 +00:00
Ted Kremenek db4b7710f7 Fix subtle bug in Preprocessor::AdvanceToTokenCharacter(): use '+=' instead of '='.
llvm-svn: 94830
2010-01-29 19:38:24 +00:00
Douglas Gregor 65eb86e912 Fix reference binding of const lvalue references to bit-fields, which
requires a temporary. Previously, we were building an initialization
sequence that bound to the bit-field as if it were a real lvalue. Note
that we previously (and still) diagnose binding of non-const
references to bit-fields, as we should.

There's no real way to test that this code is correct, since reference
binding does not *currently* have any representation in the AST. This
fix should make it easier for that to happen, so I've verified this
fix with...

Added InitializationSequence::dump(), to print an initialization
sequence for debugging purposes.

llvm-svn: 94826
2010-01-29 19:14:02 +00:00
Anders Carlsson 7c5fe48060 And yet another call.
llvm-svn: 94824
2010-01-29 18:43:53 +00:00
Anders Carlsson a68e51e3a1 Another PerformCopyInitialization call bites the dust.
llvm-svn: 94823
2010-01-29 18:37:50 +00:00
Anders Carlsson 6f923f89c3 Get rid of another old PerformCopyInitialization call.
llvm-svn: 94819
2010-01-29 18:30:20 +00:00
Devang Patel 92e2541599 Maintain a map of regions (lexical scopes) and use it to find context for a global variable.
llvm-svn: 94817
2010-01-29 18:11:03 +00:00
Douglas Gregor 4b4844f88d When naming a function template via a qualified-id (or any other way
that ADL is suppressed), we need to build an
UnresolvedLookupExpr. Fixes PR6063, which was hitting Boost headers
pretty hard.

llvm-svn: 94814
2010-01-29 17:15:43 +00:00
Daniel Dunbar 6596984f3c Driver/Darwin: Fix a crash when diagnosing conflicting deployment targets.
llvm-svn: 94812
2010-01-29 17:02:25 +00:00
Douglas Gregor 16810ca647 Name mangling for cast expressions, from Matthias Schiffer! Fixes PR5876.
llvm-svn: 94811
2010-01-29 16:37:09 +00:00
Anders Carlsson 42c876dff2 Use EmitLValueForFieldInitialization when synthesizing the copy ctor as well.
llvm-svn: 94800
2010-01-29 05:41:25 +00:00
Anders Carlsson db78f0ad04 Add a new EmitLValueForFieldInitialization that will be used for initializing fields (and reference type fields in particular).
llvm-svn: 94799
2010-01-29 05:24:29 +00:00
Anders Carlsson 5d8645b150 Simplify EmitLValueForField - we can get whether the field is part of a union or not from the FieldDecl (through its DeclContext).
llvm-svn: 94798
2010-01-29 05:05:36 +00:00
Daniel Dunbar 45c7ff1d79 ARM/APCS ABI: Fix some problems with bit-fields in structures. After rereading
the ABI spec, this turns out to simplify the code. We still have some annoying
code which mismatches the spec with regard to empty structures.

llvm-svn: 94796
2010-01-29 03:22:29 +00:00
Ted Kremenek c22f78ddfd Alternate format string checking: issue warnings for incomplete format specifiers.
In addition, move ParseFormatString() and FormatStringHandler() from
the clang::analyze_printf to the clang namespace.  Hopefully this will
resolve some link errors on Linux.

llvm-svn: 94794
2010-01-29 03:16:21 +00:00
Anders Carlsson a91be641a7 Simplify InitListChecker::CheckReferenceType
llvm-svn: 94793
2010-01-29 02:47:33 +00:00
Ted Kremenek 94af575e9c Alternate format string checking: issue a warning for invalid conversion specifiers.
llvm-svn: 94792
2010-01-29 02:40:24 +00:00
Anders Carlsson ba6c437d52 Add an CXXBindReferenceExpr (not used just yet).
llvm-svn: 94791
2010-01-29 02:39:32 +00:00
Ted Kremenek 176f7d6ef0 Yet another attempt to make the Linux buildbots happy. Apparently there are differences on how nested namespaces are handled...
llvm-svn: 94790
2010-01-29 02:13:53 +00:00
Fariborz Jahanian b5f99c3f4f Fixes rewriter bug rewriting byref related API where a struct
definition comes after where it is needed. Fixes radar 7589385.

llvm-svn: 94788
2010-01-29 01:55:49 +00:00
Ted Kremenek 019d224d91 Alternate format string checking: check for excess data arguments.
llvm-svn: 94787
2010-01-29 01:50:07 +00:00
Ted Kremenek 9fcd8305c0 Alternate format string checking: check if the number of format specifiers exceeds the number of arguments.
llvm-svn: 94785
2010-01-29 01:43:31 +00:00
Ted Kremenek 559d89a02a Move definition of FormatStringHandler::~FormatStringHandler() within namespace directives. Hopefully this will make the Linux buildbots happy.
llvm-svn: 94784
2010-01-29 01:37:52 +00:00
Ted Kremenek d5fd0fac38 Alternate format string checking: warn of '%n' as being potentially insecure.
llvm-svn: 94782
2010-01-29 01:35:25 +00:00
Ted Kremenek 5739de77fa Add precision/field width checking to AlternateCheckPrintfString().
llvm-svn: 94774
2010-01-29 01:06:55 +00:00
Ted Kremenek b5c98ef61e Fix off-by-one error in ParseFormatSpecifier() when reporting the location of a null character.
llvm-svn: 94762
2010-01-28 23:56:52 +00:00
Ted Kremenek ab278de2d1 Start fleshing out Sema::AlternateCheckPrintfString():
- Add an anonymous class 'CheckPrintfHandler' which will do the
  checking of specific format specifiers
- Add checking for using the '@' conversion specifier outside
  an ObjC string literal
- Add checking for null characters within the string

llvm-svn: 94761
2010-01-28 23:39:18 +00:00
Devang Patel 7bfc596fcf s/CGDebugInfo::getContext/CGDebugInfo::getContextDescriptor/g to avoid confusion.
llvm-svn: 94760
2010-01-28 23:15:27 +00:00
Devang Patel 128aa9d176 Fix indentation.
llvm-svn: 94758
2010-01-28 21:54:15 +00:00
Devang Patel 4c3e7e99ca Static methods do not need "this" pointer argument.
llvm-svn: 94756
2010-01-28 21:43:50 +00:00
Devang Patel 946edc1aa6 Emit base classes info first, as expected by the debugger.
llvm-svn: 94755
2010-01-28 21:41:35 +00:00
Anders Carlsson b1ef991097 Fix an incorrect union layout assert. Fixes PR6164.
llvm-svn: 94754
2010-01-28 18:22:03 +00:00
Devang Patel 0d61eebd81 s/FunctionNames/DebugInfoNames/g
llvm-svn: 94753
2010-01-28 18:21:00 +00:00
Devang Patel 84033fb240 Emit vtable info.
llvm-svn: 94751
2010-01-28 18:11:52 +00:00
John McCall 2cb941642e Access control for surrogate function calls. Required a moderately gross hack
to get the access bits set properly in conversion sets.

llvm-svn: 94744
2010-01-28 07:38:46 +00:00
Douglas Gregor ac0605e927 Introduce serialization and deserialization of diagnostic information
so that CIndex can report diagnostics through the normal mechanisms
even when executing Clang in a separate process. This applies both
when performing code completion and when using ASTs as an intermediary
for clang_createTranslationUnitFromSourceFile().

The serialized format is not perfect at the moment, because it does
not encapsulate macro-instantiation information. Instead, it maps all
source locations back to the instantiation location. However, it does
maintain source-range and fix-it information. To get perfect fidelity
from the serialized format would require serializing a large chunk of
the source manager; at present, it isn't clear if this code will live
long enough for that to matter.

llvm-svn: 94740
2010-01-28 06:00:51 +00:00
Ted Kremenek fee0e96c82 Add position of conversion specifier character to 'ConversionSpecifier'.
llvm-svn: 94739
2010-01-28 02:46:17 +00:00
Ted Kremenek 08ad1cceb3 Rename namespace clang::printf to clang::analyze_printf to avoid problems where the reference to 'printf' is ambiguous.
llvm-svn: 94733
2010-01-28 02:02:59 +00:00
John McCall 49ec2e694c Access control for overloaded call operators. Not for surrogates yet,
mostly because we're going to want a better diagnostic for conversions.

Also this API needs to go back to sanity.

llvm-svn: 94730
2010-01-28 01:54:34 +00:00
John McCall b3a4400554 Access checking for overloaded operators.
llvm-svn: 94725
2010-01-28 01:42:12 +00:00
Fariborz Jahanian 81310810bd Fixes a rewrite bug rewriting nested ivars reference.
(Radar 7583971).

llvm-svn: 94724
2010-01-28 01:41:20 +00:00
Ted Kremenek c70ee8610d Add placeholder function in Sema for new format string checking logic.
This function will use the format string parsing logic in libAnalysis,
and once it is shown to be better than the current implementation it
will replace AlternateCheckPrintfString() entirely.

llvm-svn: 94721
2010-01-28 01:18:22 +00:00
Ted Kremenek e4fd3300c9 Fix 80 col violation.
llvm-svn: 94717
2010-01-28 01:04:48 +00:00
Ted Kremenek bcbdaea703 Allow HandleFormatSpecifier() to indicate that no more processing of the format string is desired.
llvm-svn: 94715
2010-01-28 01:00:59 +00:00
Ted Kremenek c06ead62f0 Add '@' conversion specifier.
llvm-svn: 94713
2010-01-28 00:55:28 +00:00
Devang Patel abb4413728 While emitting debugging infor for a C++ class, identify the holder of class's vtable, if any.
llvm-svn: 94712
2010-01-28 00:54:21 +00:00
Devang Patel 3d4e6d9dd0 Include "this" pointer argument while emitting debug info for a C++ method.
llvm-svn: 94710
2010-01-28 00:28:01 +00:00
Ted Kremenek fa784e88e8 Remove invalid conversion specifiers from format string checking.
llvm-svn: 94707
2010-01-28 00:17:51 +00:00
Ted Kremenek c8d9c01f04 Add a few more conversion specifiers to ParseFormatSpecifier (these appear in SemaChecking).
llvm-svn: 94704
2010-01-28 00:02:05 +00:00
Ted Kremenek a2e77b41f3 Add skeleton for a more structured way to analyzing pring format
strings than what we currently have in Sema.  This is both an
experiment and a WIP.

The idea is simple: parse the format string incrementally,
constructing a well-structure representation of each format specifier.
Each format specifier is then handed back one-by-one to a client via a
callback.  Malformed format strings are also handled with callbacks.
The idea is to separate the parsing of the format string from the
emission of diagnostics.  Currently what we have in Sema for handling
format strings is a mongrel of both that is hard to follow and
difficult to modify (I can apply this label since I'm the original
author of that code).

This is in libAnalysis as it is reasonable generic and can potentially
be used both by libSema and libChecker.

Comments welcome.

llvm-svn: 94702
2010-01-27 23:43:25 +00:00
Jeffrey Yasskin 3f565ae2dd Remove ModuleProviders from clang after r94686 removed them from LLVM.
llvm-svn: 94688
2010-01-27 21:12:04 +00:00
Daniel Dunbar 377dc2f91f ARM/APCS: Fix alignment of long double.
llvm-svn: 94685
2010-01-27 20:23:08 +00:00
Ted Kremenek e9918356b2 Move more naming conventions logic out of the retain/release checker to CocoaConventions.h.
llvm-svn: 94682
2010-01-27 18:00:17 +00:00
Ken Dyck 160146eba2 Change the return type of ASTContext::getDeclAlignInBytes() to CharUnits and,
now that the "InBytes" part of the name is implied by the return type, rename
it to getDeclAlign().

llvm-svn: 94681
2010-01-27 17:10:57 +00:00
Benjamin Kramer b925f7707e Use raw_ostreams in Preprocessor::ExpandBuiltinMacro. Still not nice but less fragile than the old code.
llvm-svn: 94679
2010-01-27 16:38:22 +00:00
Ted Kremenek 968999b5f6 Add missing call to Optional<...>.getValue() that was pointed out by Chandler.
llvm-svn: 94678
2010-01-27 16:31:37 +00:00
Ken Dyck 2c229a7c17 Use getTypeAlignInChars() for alignment in VisitSizeOfAlignOfExpr().
llvm-svn: 94677
2010-01-27 12:54:25 +00:00
David Chisnall 358e751a7b Unique ObjC strings (GNU Runtime); fix for PR6142. Note: Doing this in the runtime-specific code is a bit ugly. It would be a good idea to hoist all of the string / protocol uniqueing code up into CGObjCRuntime or CodeGenModule and only handle emitting the original versions in the runtime-specific code.
llvm-svn: 94676
2010-01-27 12:49:23 +00:00
Chris Lattner 0afd3a23cd fix a bug in the _MM_TRANSPOSE4_PS definition, patch by Brian Sumner from
PR6138

llvm-svn: 94669
2010-01-27 07:54:50 +00:00
Ted Kremenek d5e27af60a Remove unnecessary ASTContext* argument from isRefType().
llvm-svn: 94665
2010-01-27 06:45:10 +00:00
Ted Kremenek 49c0d89a10 Update CMake build.
llvm-svn: 94663
2010-01-27 06:14:12 +00:00
Ted Kremenek db1832d928 Start pulling out pieces of the monolithic retain/release checker into
reusable and modular API pieces.

Start by pulling the logic for deriving the Cocoa naming convention
into a separate API, header, and source file.

llvm-svn: 94662
2010-01-27 06:13:48 +00:00
Douglas Gregor 3edc4d5ec3 Fix a major oversight in the comparison of standard conversion
sequences, where we would occasionally determine (incorrectly) that
one standard conversion sequence was a proper subset of another when,
in fact, they contained completely incomparable conversions. 

This change records the types in each step within a standard
conversion sequence, so that we can check the specific comparison
types to determine when one sequence is a proper subset of the
other. Fixes this testcase (thanks, Anders!), which was distilled from
PR6095 (also thanks to Anders).

llvm-svn: 94660
2010-01-27 03:51:04 +00:00
John McCall 86121519ca Implement access-check delays for out-of-line member definitions
using the same framework we use for deprecation warnings.

llvm-svn: 94659
2010-01-27 03:50:35 +00:00
Anders Carlsson e437c6870a Add support for 3dnow and 3dnowa, and define the target macros accordingly. (This is needed in order to build Qt).
llvm-svn: 94658
2010-01-27 03:47:49 +00:00
Anders Carlsson 40446e8a0a Structs and classes with non-trivial destructors or copy constructors should be passed indirectly in the 32-bit ABI. Fixes PR6094.
llvm-svn: 94656
2010-01-27 03:25:19 +00:00
John McCall 58cc69d4c1 Implement access control for overloaded functions. Suppress access control
diagnostics in "early" lookups, such as during typename checks and when building
unresolved lookup expressions.

llvm-svn: 94647
2010-01-27 01:50:18 +00:00
Daniel Dunbar f48d51d693 Driver/Darwin: Eliminate invalid uses of DarwinVersion -- this fixes a number of
defaults when targetting iPhoneOS (blocks, non-fragile ABI, stack protector).

llvm-svn: 94642
2010-01-27 00:57:11 +00:00
Daniel Dunbar 6d23b2f503 Driver/Darwin: Simplify target version checks.
llvm-svn: 94641
2010-01-27 00:57:03 +00:00
Daniel Dunbar 8360803a8a Driver/Darwin: Fix a few link arguments when targetting different iPhoneOS
versions to match gcc (which is matching linker changes).

llvm-svn: 94640
2010-01-27 00:56:56 +00:00
Daniel Dunbar b73bb5d085 Driver/Darwin: Switch clang -triple synthesis to use computed target information.
llvm-svn: 94639
2010-01-27 00:56:49 +00:00
Daniel Dunbar 7c870175eb Driver/Darwin: Eliminate confusing IsIPhoneOS parameter -- this was actually
just indicating whether the default target should be iPhoneOS.

llvm-svn: 94638
2010-01-27 00:56:44 +00:00
Daniel Dunbar 15c8942baf Driver/Darwin: Switch to using isTargetIPhoneOS where appropriate.
llvm-svn: 94637
2010-01-27 00:56:37 +00:00
Daniel Dunbar 3b8e50d0ed Driver/Darwin: Track target platform more explicitly in tool chain, eventually
this should just be part of the tool chain itself once we have eliminated
argument translation.

llvm-svn: 94635
2010-01-27 00:56:25 +00:00
Ted Kremenek e36bceb97d Teach RegionStore to handle initialization of incomplete arrays in structures using a compound value. Fixes <rdar://problem/7515938>.
llvm-svn: 94622
2010-01-26 23:51:00 +00:00
Ted Kremenek 6296e0990b Move 'LocalCheckers.h' to the 'Checkers' subdirectory.
llvm-svn: 94609
2010-01-26 22:59:55 +00:00
Ted Kremenek b29faead69 Move 'include/Checkers/PathSensitive/Checkers' directory to 'include/Checkers'.
llvm-svn: 94608
2010-01-26 22:56:15 +00:00
Fariborz Jahanian d59baba9fd Patch to add 'volatile' to first argument of all
sync compare_and_swap to match them with gcc.
It also fixes a few incorrect argument defitions.
(fixes radar 7540291).

llvm-svn: 94607
2010-01-26 22:48:42 +00:00
Mike Stump ded0a406b4 Refine the non-virtual this adjustments for thunks by using the offset
to the declaring class from the nearest virtual base class.  WIP.

llvm-svn: 94606
2010-01-26 22:44:01 +00:00
Sebastian Redl 833ef45b1d Bring some semblance of order into Decl.h and Decl.cpp. While at it, fix some typo comments and remove an unused and unimplemented function prototype. No functionality change.
llvm-svn: 94599
2010-01-26 22:01:41 +00:00
Mike Stump a04ecfb701 Refine the non-virtual this adjustments for thunks by using the offset
to the declaring class from the nearest virtual base class.  WIP.

This fixes 40% of all the problems remaining in one of my testcases.

llvm-svn: 94592
2010-01-26 21:35:27 +00:00
Fariborz Jahanian f0ed69cb5b Added assert to the rewrite.
llvm-svn: 94584
2010-01-26 20:37:44 +00:00
Ken Dyck 7df3cbeb01 Convert one last size variable to CharUnits (follow-on to 94577).
llvm-svn: 94579
2010-01-26 19:59:28 +00:00
Ken Dyck 3eb55cfe8a Use CharUnits for sizes, offsets, alignments, and padding amounts for values
that are in character units.

llvm-svn: 94577
2010-01-26 19:44:24 +00:00
Douglas Gregor 64213261b4 Fix typo in comment
llvm-svn: 94576
2010-01-26 19:43:43 +00:00
Ken Dyck 5262b11962 Use CharUnits for alignments in character units.
llvm-svn: 94571
2010-01-26 19:13:33 +00:00
Ken Dyck a0f99ff230 Use CharUnits for alignment of UTF16 string in GetAddrOfConstantCFString().
llvm-svn: 94564
2010-01-26 18:46:23 +00:00
Ken Dyck e5402e4749 Use CharUnits for alignment in EmitNullInitializationLValue().
llvm-svn: 94563
2010-01-26 18:35:11 +00:00
Fariborz Jahanian f9e8c2b759 Refix rewriting of an ivar access when it is
type-cast to its sub-class (radar 7575882).

llvm-svn: 94559
2010-01-26 18:28:51 +00:00
Anders Carlsson ca4a5459d8 Use the right definition when emitting a global variable. Fixes PR5564.
llvm-svn: 94555
2010-01-26 17:43:42 +00:00
Anders Carlsson 7228117108 Change getUnique to return a GlobalDecl. Fixes PR6147.
llvm-svn: 94554
2010-01-26 17:36:47 +00:00
Ken Dyck a6046ab82b Correct cut-and-paste error in doxygen comment for newly introduced
getTypeAlignInChars().  

llvm-svn: 94553
2010-01-26 17:25:18 +00:00
Ken Dyck 24d28d6cde Add getTypeAlignInChars() for use in code that works in alignments in character
units.

llvm-svn: 94552
2010-01-26 17:22:55 +00:00
Ken Dyck 98ca79435a Introduce CodeGenModule::GetTargetTypeStoreSize() to calculate the store size
of LLVM types in character units.

llvm-svn: 94542
2010-01-26 13:48:07 +00:00
John McCall 1f6386b79b Avoid some unnecessary copying of unresolved lookup results.
llvm-svn: 94531
2010-01-26 07:37:41 +00:00
John McCall 8fe6808de0 Handle redeclarations found by ADL deterministically and reasonably.
This solution relies on an O(n) scan of redeclarations, which means it might
scale poorly in crazy cases with tons of redeclarations brought in by a ton
of distinct associated namespaces.  I believe that avoiding this
is not worth the common-case cost.

llvm-svn: 94530
2010-01-26 07:16:45 +00:00
Chandler Carruth 72343706c1 Correctly treat 64 bit integers specified via the mode attribute as the 'long'
type when that type is 64 bits wide, and the 'long long' type when 'long' is
only 32 bits wide. This fixes PR6108.

Also adds a bunch of test cases to ensure proper conversion between equally
sized standard types and mode-specified types on both 32 and 64 bit targets.

llvm-svn: 94527
2010-01-26 06:39:24 +00:00
Anders Carlsson d6b21e4842 If a global variable has an initializer with side effects, it can never be deferred (even if it's in an anonymous namespace).
llvm-svn: 94525
2010-01-26 06:15:16 +00:00
John McCall 91f61fc921 Allow ADL to find functions imported by using decls. Leave wordy comment
about interaction between ADL and default arguments.  Shrug shoulders, commit.

llvm-svn: 94524
2010-01-26 06:04:06 +00:00
Anders Carlsson 0b5f1ddf0a Fix another debug info crash with virtual bases.
llvm-svn: 94520
2010-01-26 05:26:39 +00:00
Anders Carlsson 17ed0496c5 Fix the test I broke, and also fix a crash when declaring a virtual destructor. Add debug info support for pure virtual member functions.
llvm-svn: 94519
2010-01-26 05:19:50 +00:00
Anders Carlsson b85f0ab976 Factor creating the DISubprogram for a member function out into a separate function.
llvm-svn: 94513
2010-01-26 04:49:33 +00:00
Anders Carlsson c1821155bf Simplify CGDebugInfo::CollectCXXMemberFunctions a little. More to come.
llvm-svn: 94511
2010-01-26 04:40:11 +00:00
Anders Carlsson 20bbbd489b Make sure to always mark a global variable as not being constant if it has a C++ initializer.
llvm-svn: 94504
2010-01-26 04:02:23 +00:00
Daniel Dunbar 19afd61201 Simplify.
llvm-svn: 94503
2010-01-26 03:56:40 +00:00
Mike Stump 77537b136e Be sure to track the non-virtual part of the vcall offset in complex
multiple inheritance cases.  WIP.

This fixes 20% of the outstanding problems found by the randomized
tester.

llvm-svn: 94499
2010-01-26 03:42:22 +00:00
John McCall 4c4c1dfc2b Preserve access bits through overload resolution much better. Some
general refactoring in operator resolution.

llvm-svn: 94498
2010-01-26 03:27:55 +00:00
Daniel Dunbar d54669d30b Driver/Darwin: Honor IPHONEOS_DEPLOYMENT_TARGET.
llvm-svn: 94488
2010-01-26 01:45:19 +00:00
Daniel Dunbar d86666ffd7 Driver/Darwin: Stuff iPhoneOS into environment portion of the (llvm/clang) triple instead of keying off architecture. Also, fix version define to properly include the revision/micro component of the version number.
llvm-svn: 94487
2010-01-26 01:44:04 +00:00
John McCall b89836b6db Pass access specifiers around in overload resolution.
llvm-svn: 94485
2010-01-26 01:37:31 +00:00
Fariborz Jahanian 7b99f27392 Fix a regression caused by my rewriting of cast of ivar
access (was radar 7575882).

llvm-svn: 94481
2010-01-26 00:29:22 +00:00
Mike Stump 90181eb294 Fixup a missing vcall entry. WIP.
llvm-svn: 94478
2010-01-26 00:05:04 +00:00
Devang Patel c54353d935 First cut at emitting inheritance info.
llvm-svn: 94473
2010-01-25 23:32:18 +00:00
Devang Patel 7af03fb4f0 Emit debug info for virtual functions.
llvm-svn: 94467
2010-01-25 23:17:15 +00:00
John McCall 5cb5287467 Fixit to remove 'volatile' in file-scope 'asm volatile'.
llvm-svn: 94466
2010-01-25 23:12:50 +00:00
Daniel Dunbar 4e29505a95 Driver: Fix fallback to gcc to -c instead of -S if trying to generate an LLVM bc
file.

llvm-svn: 94463
2010-01-25 22:35:08 +00:00
John McCall 9dfb16210e Warn on top-level 'asm volatile' (instead of misparsing it).
"Fixes" rdar://problem/7574870

llvm-svn: 94458
2010-01-25 22:27:48 +00:00
Fariborz Jahanian 5cda92820f global variable that binds reference to a non-lvalue reproted
as NYI now.

llvm-svn: 94453
2010-01-25 21:40:39 +00:00
Fariborz Jahanian d360ce9d57 Fixes a rewriting bug of access ivar of a variable cast
to subclass. (Fixes radar 7575882).

llvm-svn: 94444
2010-01-25 20:50:02 +00:00
Fariborz Jahanian 210031b79c Fix a code gen. bug involving compiling global references.
(fixes radar 7574896).

llvm-svn: 94434
2010-01-25 18:30:26 +00:00
Ted Kremenek fe0fc40c3b Move BugReporter.h, PathDiagnostic.h, and BugType.h to 'include/Checker/BugReporter'
llvm-svn: 94428
2010-01-25 17:10:22 +00:00
Eli Friedman 673f94a0c9 Code simplification; this should have no visible effects.
llvm-svn: 94427
2010-01-25 17:04:54 +00:00
Douglas Gregor 7210063126 Move the type specifier location for elaborated-type-specifiers from
the tag kind (union, struct, class, enum) over to the name of the tag,
if there is a name, since most clients want to point at the name.

llvm-svn: 94424
2010-01-25 16:33:23 +00:00
Benjamin Kramer ea9f3f240c Update C++ include paths for Exherbo, by Ingmar Vanhassel.
llvm-svn: 94420
2010-01-25 12:20:15 +00:00
Ted Kremenek 0a4546b6fc Add missing file.
llvm-svn: 94407
2010-01-25 04:48:38 +00:00
Ted Kremenek d6b8708643 Split libAnalysis into two libraries: libAnalysis and libChecker.
(1) libAnalysis is a generic analysis library that can be used by
    Sema.  It defines the CFG, basic dataflow analysis primitives, and
    inexpensive flow-sensitive analyses (e.g. LiveVariables).

(2) libChecker contains the guts of the static analyzer, incuding the
    path-sensitive analysis engine and domain-specific checks.

Now any clients that want to use the frontend to build their own tools
don't need to link in the entire static analyzer.

This change exposes various obvious cleanups that can be made to the
layout of files and headers in libChecker.  More changes pending.  :)

This change also exposed a layering violation between AnalysisContext
and MemRegion.  BlockInvocationContext shouldn't explicitly know about
BlockDataRegions.  For now I've removed the BlockDataRegion* from
BlockInvocationContext (removing context-sensitivity; although this
wasn't used yet).  We need to have a better way to extend
BlockInvocationContext (and any LocationContext) to add
context-sensitivty.

llvm-svn: 94406
2010-01-25 04:41:41 +00:00
Chris Lattner 83b0dd16c3 fix rdar://7556129 a crash in blocks debug info codegen.
llvm-svn: 94402
2010-01-25 03:34:56 +00:00
Chris Lattner bf78478d35 simplify code.
llvm-svn: 94401
2010-01-25 03:29:35 +00:00
Daniel Dunbar fcf2d428e4 ASTUnit: Don't check that input files exist when parsing ASTs from the command
line -- they may be remapped (fake) files. This is useful for testing parsing
entirely from memory.

llvm-svn: 94395
2010-01-25 00:44:02 +00:00
Chris Lattner 0bcc858a2b -fno-rtti is now the default.
llvm-svn: 94379
2010-01-24 20:43:31 +00:00
Anders Carlsson 77babdb99a Implement [dcl.fct.spec]p6.
llvm-svn: 94365
2010-01-24 16:49:46 +00:00
Anders Carlsson aaeef07280 Implement instantiation of AsmStmts (Crazy, I know)
llvm-svn: 94361
2010-01-24 05:50:09 +00:00
Alexis Hunt aecc45cb3c Mangle static variables with an extra name to distinguish them from non-static variables in the same TU.
Fixes PR5966 for real this time; also reverts r92911, which had a incorrect fix.

llvm-svn: 94352
2010-01-24 03:04:27 +00:00
Chris Lattner 8fd2d01118 fix PR6034, a crash on invalid where the switch stack would get
unbalanced.

llvm-svn: 94347
2010-01-24 01:50:29 +00:00
Anders Carlsson 60ddba67a8 Fix a nasty bug where temporaries weren't marked as being conditional in some cases.
llvm-svn: 94341
2010-01-24 00:20:05 +00:00
Anders Carlsson 0bd52403d4 Use new initialization code when dealing with [dcl.init.aggr]p12. This fixes the bug where array elements and member initializers weren't copied correctly.
llvm-svn: 94340
2010-01-24 00:19:41 +00:00
Anders Carlsson 6cabf318c9 Change all InitializedEntity pointers over to be references.
llvm-svn: 94335
2010-01-23 23:23:01 +00:00
Anders Carlsson 3fa93b7e54 Start passing InitializedEntity to CheckDesignatedInitializer.
llvm-svn: 94334
2010-01-23 22:49:02 +00:00
John McCall f9b528c7cf Preserve access for enum constants during template instantiation.
llvm-svn: 94333
2010-01-23 22:37:59 +00:00
Anders Carlsson dbb25a38b9 More init work, adding more entity parameters.
llvm-svn: 94332
2010-01-23 20:47:59 +00:00
Anders Carlsson 73eb7cd351 Use the new init code for member subobjects.
llvm-svn: 94329
2010-01-23 20:20:40 +00:00
Anders Carlsson 0cf999b663 Switch some array initialization over to the new init code.
llvm-svn: 94327
2010-01-23 20:13:41 +00:00
Anders Carlsson d0849254de Baby steps towards migrating the InitListChecker over to the new initialization code. Pass an InitializedEntity pointer through to most init checker functions. Right now, it's ignored everywhere except when initializing vectors in C++.
llvm-svn: 94325
2010-01-23 19:55:29 +00:00
Anders Carlsson 3cc795ae8d When an InitializedEntity is passed to CheckSingleInitializer, call the new Sema::PerformCopyInitialization overload.
llvm-svn: 94324
2010-01-23 19:22:30 +00:00
Eli Friedman d6ef69a7db Add bzero builtin; this should help codegen quality for code using this
function.

llvm-svn: 94320
2010-01-23 19:00:10 +00:00
Anders Carlsson 26d0564fd1 Change CheckSingleInitializer to take/return OwningExprResults instead. No functionality change.
llvm-svn: 94316
2010-01-23 18:35:41 +00:00
Benjamin Kramer 12a6ce7cad Simplify code with StringRef.
llvm-svn: 94314
2010-01-23 18:16:35 +00:00
Benjamin Kramer 8f8f405c71 No need to terminate this buffer.
llvm-svn: 94313
2010-01-23 18:16:07 +00:00
John McCall 6d174646dd Produce a special diagnostic when users call a function with an argument of
incomplete type (or a pointer/reference to such).

The causes of this problem are different enough to justify a different "design"
for the diagnostic.  Most notably, it doesn't give an operand index:
it's usually pretty obvious which operand is the problem, it adds a lot of
clutter to mention it, and the fix is usually in a different part of the file
anyway.

This is yet another diagnostic that should really have an analogue in the
non-overloaded case --- which should be much easier to write because of
the weaker space constraints.

llvm-svn: 94303
2010-01-23 08:10:49 +00:00
Anders Carlsson 8e01dcf6f6 Fix the EntityKind order so that all entity kinds that can be copied (using copy constructors) come first. Also, fix a bug where EK_New was left out of the err_init_conversion_failed diagnostic (It is now reported as 'new value'). Please review Doug :)
llvm-svn: 94289
2010-01-23 05:47:27 +00:00
John McCall fe796ddd5a During overload resolution diagnostics, sort non-viable candidates by the quality of their
conversions.  To make this work, fill out all conversions for all candidates
(but only when diagnosing overload failure).  Split out a few cases from
ovl_fail_bad_conversion which didn't actually involve a failed argument
conversion.

I'm pretty sure this is not a well-founded ordering, but I'm not sure it matters.

llvm-svn: 94283
2010-01-23 05:17:32 +00:00
Anders Carlsson ed8d80d72b Separate EK_ArrayOrVectorElement into EK_ArrayElement and EK_VectorElement; arrays and vectors are pretty different beasts in C++. Doug, please review/comment.
llvm-svn: 94279
2010-01-23 04:34:47 +00:00
David Chisnall 481e3a87fe Created __builtin___NSStringMakeConstantString() builtin, which generates constant Objective-C strings.
llvm-svn: 94274
2010-01-23 02:40:42 +00:00
Ted Kremenek 4c0df3dc1d Rename getClangFullVendorVersion() to getClangFullVersion().
llvm-svn: 94273
2010-01-23 02:11:34 +00:00
John McCall 553c0796ee Implement elementary access control.
llvm-svn: 94268
2010-01-23 00:46:32 +00:00
Douglas Gregor aa98ed9a07 Extend clang_createTranslationUnitFromSourceFile() to support creating
translation units that include unsaved files.

llvm-svn: 94258
2010-01-23 00:14:00 +00:00
Fariborz Jahanian 935f041243 outside a method, 'super' should resolve in a normal name look up
to mimic gcc's behavior. Fixes radar 7400691.

llvm-svn: 94246
2010-01-22 23:04:44 +00:00
Ted Kremenek c0f3f72fa4 Add 'clang_getClangVersion()' function to CIndex. This exposes the full Clang version string through the CIndex API.
llvm-svn: 94242
2010-01-22 22:44:15 +00:00
Ted Kremenek 51b8bc93f8 Move version string generation (e.g., "clang 1.1 ...") to libBasic/Version.cpp, getClangFullVendorVersion().
llvm-svn: 94235
2010-01-22 22:29:50 +00:00
Ted Kremenek 18e066f6a9 (1) Rename getClangSubversionRevision() to getClangRevision(), and
have it return a StringRef instead of an integer (to be more VCS
    agnostic).

(2) Add getClangFullRepositoryVersion(), which contains an
    amalgamation of the repository name and the revision.

(3) Change PCH to only emit the string returned by
    getClangFullRepositoryVersion() instead of also emitting the value
    of getClangSubversionRevision() (which has been removed).  This is
    functionally equivalent.

More cleanup to version string generation pending...

llvm-svn: 94231
2010-01-22 22:12:47 +00:00
Fariborz Jahanian 8c6c0b6a1f ui64, etc. are valid VS suffixes.
Fixes radar 7562363.

llvm-svn: 94224
2010-01-22 21:36:53 +00:00
Ted Kremenek 17437130e9 Rename pch::SVN_BRANCH_REVISION to pch::VERSION_CONTROL_BRANCH_REVISION.
llvm-svn: 94214
2010-01-22 20:59:36 +00:00
Ted Kremenek 2377a0e0ea Rename getClangSubversionPath() -> getClangRepositoryPath() and have it return a StringRef.
llvm-svn: 94213
2010-01-22 20:55:35 +00:00
Mike Stump 0a2754ed8a Be sure to select primary bases among the nearly empties in preorder,
not just among the direct bases.  Before we where missing nearly
empties that were bases of virtual base classes.

llvm-svn: 94208
2010-01-22 20:27:17 +00:00
Douglas Gregor 562c1f9365 Teach CIndex's cursor visitor to restrict its traversal to a specific
region of interest (if provided). Implement clang_getCursor() in terms
of this traversal rather than using the Index library; the unified
cursor visitor is more complete, and will be The Way Forward.

Minor other tweaks needed to make this work:
  - Extend Preprocessor::getLocForEndOfToken() to accept an offset
  from the end, making it easy to move to the last character in the
  token (rather than just past the end of the token).
  - In Lexer::MeasureTokenLength(), the length of whitespace is zero.

llvm-svn: 94200
2010-01-22 19:49:59 +00:00
Mike Stump 1f49d65235 Finish off fixing up debug information.
llvm-svn: 94193
2010-01-22 18:48:47 +00:00
Fariborz Jahanian 53967e2abd Patch fixes a lookup bug in c++'s anonymous union member
lookup. Fixes radar 7562438.

llvm-svn: 94191
2010-01-22 18:30:17 +00:00
Anders Carlsson 7caa4cb87a No need to canonicalize the type and use dyn_cast. Also, correctly diagnose trying to override a function returning an lvalue reference with a function overriding an rvalue reference.
llvm-svn: 94183
2010-01-22 17:37:20 +00:00
Douglas Gregor 0599df16a6 Eliminate some Clang warnings
llvm-svn: 94177
2010-01-22 15:41:14 +00:00
Benjamin Kramer d6b28fc6ad Simplify code.
llvm-svn: 94175
2010-01-22 13:59:13 +00:00
Chandler Carruth df7fd5f8d5 Fix an obvious goof that caused us to only see the top level of return types
when checking for covariance. Added some fun test cases, fixes PR6110.

This felt obvious enough to just commit. ;] Let me know if anything needs
tweaking.

llvm-svn: 94173
2010-01-22 13:07:41 +00:00
Mike Stump 9eb76d47f2 Ensure we output all non-virtual base vtables. Fixes PR5890.
llvm-svn: 94163
2010-01-22 06:45:05 +00:00
Zhongxing Xu a1293a67cd Process cast according to the cast kind. Prepare for more specific cast
handling (for C++). No functionality change for now.

llvm-svn: 94153
2010-01-22 04:30:00 +00:00
Daniel Dunbar 7cde09ac8a Driver/Darwin: Update tool chain to use static clang_rt libraries provided by
compiler-rt. This tool chain now works on x86 and ARM, but isn't the x86 default
yet. 

This drastically cleans up the linker invocation, old invocation:
--
"/Developer/usr/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-weak_reference_mismatches" "non-weak" "-o" "a.out" "-lcrt1.10.6.o" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.." "t.o" "-lSystem" "-lgcc"
--

New invocation:
--
# For 10.6:
 "/usr/bin/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-o" "a.out" "-lcrt1.10.6.o" "t.o" "-lSystem"
# For 10.4:
 "/usr/bin/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.4" "-o" "a.out" "-lcrt1.o" "t.o" "-lSystem" "-lgcc_s.10.4" "/Volumes/Data/ddunbar/llvm.obj.64/Debug/lib/clang/1.1/lib/darwin/libclang_rt.10.4.a"
--

llvm-svn: 94150
2010-01-22 03:38:14 +00:00
Daniel Dunbar 93d7acfcf2 Driver/Darwin/ld: Fix refacto, -force_cpusubtype_ALL should only be forwarded,
not always added.

llvm-svn: 94149
2010-01-22 03:37:33 +00:00
Mike Stump d2808449e4 Update debugging code.
llvm-svn: 94145
2010-01-22 02:51:26 +00:00
Daniel Dunbar dcc3b657f2 Driver/Darwin/ld: Factor out getDarwinArchName, for getting the "Darwin" arch
name being used in an driver invocation.

llvm-svn: 94139
2010-01-22 02:04:58 +00:00
Daniel Dunbar a48823fdbe Driver/Darwin/ld: Eliminate AddDarwinSubArch, our linker invocation is going to
diverge from gcc anyway.

llvm-svn: 94138
2010-01-22 02:04:52 +00:00
Daniel Dunbar 42e3df065e Use raw_ostream instead of cstdio.
llvm-svn: 94136
2010-01-22 02:04:41 +00:00
John McCall f7b2fb51d1 Create function, block, and template parameters in the context of the
translation unit.  This is temporary for function and block parameters;
template parameters can just stay this way, since Templates aren't
DeclContexts.  This gives us the nice property that everything created
in a record DC should have access in C++.

llvm-svn: 94122
2010-01-22 00:28:27 +00:00
Chris Lattner fde85356c6 revert my patch for rdar://7520940 that warns when a published header
is #included with "foo.h" style syntax instead of framework syntax.
It produced too much noise.

llvm-svn: 94120
2010-01-22 00:14:44 +00:00
Mike Stump 6cbe36fe5a Wire up the new range reporting for unreachable code.
llvm-svn: 94118
2010-01-21 23:49:01 +00:00
Mike Stump 60dbeebee8 Improve unreachable code warnings with respect to dead member and
dead array references.

llvm-svn: 94115
2010-01-21 23:15:53 +00:00
Mike Stump fcd6f94ba7 Improve unreachable code warnings for with respect to dead functional casts in C++.
llvm-svn: 94106
2010-01-21 22:12:18 +00:00
Mike Stump d12e495f17 Improve unreachable code warnings for with respect to c-style casts.
llvm-svn: 94094
2010-01-21 19:51:34 +00:00
Mike Stump c18c403670 Improve unreachable code warnings for with respect to ? :.
llvm-svn: 94093
2010-01-21 19:44:04 +00:00
Ted Kremenek 819e873791 Allocate the 'Protocols' array in ObjCInterfaceType and
ObjCObjectPointerType using the allocator associated with ASTContext.
Not only does this fix a memory leak, but it also makes these arrays
BumpPtrAllocated (in the typical case).

llvm-svn: 94090
2010-01-21 19:22:34 +00:00
Fariborz Jahanian da8ec2bc9e Patch to implement rewriting of properties.
Fixes radar 7562952.

llvm-svn: 94087
2010-01-21 17:36:00 +00:00
Mike Stump 14781509fd Improve unreachable code warnings for with respect to compound
assignments.

llvm-svn: 94086
2010-01-21 17:31:41 +00:00
Mike Stump cc3a853df7 Improve unreachable code warnings with respect to dead binary and
unary operators.

llvm-svn: 94084
2010-01-21 17:21:23 +00:00
Daniel Dunbar ae928714df Update to use llvm/utils/GetSourceVersion to detect version number, instead of
assuming SVN. This should be fixed to not necessarily be an integer.

llvm-svn: 94081
2010-01-21 16:56:47 +00:00
Anders Carlsson f768db7775 Move the VTT related code into its own file, CGVTT.cpp
llvm-svn: 94079
2010-01-21 16:50:45 +00:00
Douglas Gregor ff59f676d0 Teach code-completion to deal with calls to functions without prototypes.
llvm-svn: 94076
2010-01-21 15:46:19 +00:00
Mike Stump 04c6851cd6 Speed up compilation by avoiding generating exceptional edges from
CallExprs as those edges help cause a n^2 explosion in the number of
destructor calls.  Other consumers, such as static analysis, that
would like to have more a more complete CFG can select the inclusion
of those edges as CFG build time.

This also fixes up the two compilation users of CFGs to be tolerant of
having or not having those edges.  All catch code is assumed be to
live if we didn't generate the exceptional edges for CallExprs.

llvm-svn: 94074
2010-01-21 15:20:48 +00:00
Mike Stump 0c2ec779cf Move some recent checking code into SemaChecking instead.
llvm-svn: 94067
2010-01-21 03:59:47 +00:00
Mike Stump 87f2f9b465 Avoid instantiating std::sort to save on compiler size.
llvm-svn: 94065
2010-01-21 03:43:13 +00:00
Mike Stump 7df27e7038 When checking for unreachable code, we can trivially avoid checking
for unreachable loops if all the blocks are already marked live by
this point.

llvm-svn: 94064
2010-01-21 03:07:51 +00:00
Mike Stump 02230ab7a6 When checking for unreachable blocks, we can trivially avoid extra
work, if we know we already marked all blocks as live.

llvm-svn: 94063
2010-01-21 02:55:37 +00:00
Mike Stump 6bf1c08e99 Add infrastructure to add base initializers and member initializers to
the CFG.  WIP.

llvm-svn: 94062
2010-01-21 02:21:40 +00:00
Fariborz Jahanian 879cc735fc Fixes comments.
llvm-svn: 94053
2010-01-21 00:08:17 +00:00
Fariborz Jahanian e4951fdc4b Also allow cast of block pointer type to
pointer to an any object. Another variation of
radar 7562285.

llvm-svn: 94052
2010-01-21 00:05:09 +00:00
Devang Patel 3f4a77e082 A Decl->getName() is not unique. However, the debug info descriptors
are uniqued. The debug info descriptor describing record's context is
necessary to keep two Decl's descriptor unique if their name match.

There is more work to do to create descriptors for DeclContext. 
As a temp. step use type's name in FwdDecl.

llvm-svn: 94050
2010-01-20 23:56:40 +00:00
Fariborz Jahanian 4efdec0677 In objective-c++ land, a block pointer is another object pointer.
So, casting a generic object pointer ('id' or 'Class') to the
block pointer is allowed. Fixes radar 7562285.

llvm-svn: 94045
2010-01-20 22:54:38 +00:00
John McCall 401982f56c First pass at collecting access-specifier information along inheritance paths.
Triggers lots of assertions about missing access information;  fix them.

Will actually consume this information soon.

llvm-svn: 94038
2010-01-20 21:53:11 +00:00
Fariborz Jahanian 4f8a57112f Settled rule on warning on unimplemented property in
category implementation when some implementations
are missing in the primary class implementation.
(fixes radar 6505200).

llvm-svn: 94014
2010-01-20 19:36:21 +00:00
Chris Lattner 6a89c50e23 reduce redundant are's
llvm-svn: 94009
2010-01-20 17:53:58 +00:00
Fariborz Jahanian b36606aa71 Improve performance of warning when not implementing a required
property of a protocol (my previous patch). No change in functionality.
(radar 7544809).

llvm-svn: 94005
2010-01-20 17:27:59 +00:00
Benjamin Kramer 9c22cc800f Make some helper functions static.
llvm-svn: 94004
2010-01-20 16:21:40 +00:00
Benjamin Kramer c1a62aa67d Don't store a Twine temporary, it's unsafe.
llvm-svn: 94003
2010-01-20 16:18:11 +00:00
Zhongxing Xu eb76a85af0 Correct comments.
llvm-svn: 93999
2010-01-20 07:57:45 +00:00