Commit Graph

9187 Commits

Author SHA1 Message Date
Chandler Carruth 456daba135 Switch to using %clang_cc1 properly rather than manually passing the -cc1 flag.
llvm-svn: 118996
2010-11-13 10:19:35 +00:00
Zhongxing Xu 1b038fa00f Do not add implicit dtors for CXXBindTemporaryExpr with elidable
CXXConstructExpr.

llvm-svn: 118991
2010-11-13 07:30:59 +00:00
Douglas Gregor 52773dcef6 Implement C++ [over.match.funcs]p4 as it concerns partial ordering of
function templates. Fixes PR8130.

llvm-svn: 118944
2010-11-12 23:44:13 +00:00
John McCall 31f82720d0 Replace one hack with a different hack: strip out the ObjectType
parameters to the Transform*Type functions and instead call out
the specific cases where an object type and the unqualified lookup
results are important.  Fixes an assert and failed compile on
a testcase from PR7248.

llvm-svn: 118887
2010-11-12 08:19:04 +00:00
Ted Kremenek bb437a6999 Fix use of an uninitialized SourceLocation because DeclarationNameLoc failed to completely zero-initialize itself.
Now we explicitly memset all of its values.

This bug was uncovered by the 'Index/recursive-cxx-member-calls.cpp', which exhibited an assertion
on an i386 darwin build of clang.  Adding this test case back since the assertion is now resolved.

llvm-svn: 118881
2010-11-12 04:25:07 +00:00
Douglas Gregor cbd0710a12 When performing initialization of a copy of a temporary object, use
direct-initialization (rather than copy-initialization) to initialize
the temporary, allowing explicit constructors. Fixes PR8342.

llvm-svn: 118880
2010-11-12 03:34:06 +00:00
Ted Kremenek 843c53828f RegionStore/BasicStore: do not return UndefinedVal for accesses to concrete addresses; instead return UnknownVal. This
leads it up to checkers (e.g., DereferenceChecker) to guard against illegal accesses (e.g., null dereferences).

Fixes PR 5272 and <rdar://problem/6839683>.

llvm-svn: 118852
2010-11-11 23:10:10 +00:00
Ted Kremenek b76f2402b0 Temporarily remove this test. It is causing an assertion failure in the builtbot.
llvm-svn: 118785
2010-11-11 08:17:57 +00:00
Ted Kremenek c7a5bae597 Annotate tokens in a separate thread to avoid blowing out stack space. While the CursorVisitor
is gradually becoming more data recursive, AnnotateTokensVisitor does its own recursive call
within the visitor that can still blow out the stack.  This can potentially be reworked to avoid this,
but for now just do token annotation on a separate thread.

llvm-svn: 118783
2010-11-11 08:05:23 +00:00
Ted Kremenek 92209a45b9 Generalize data-recursive visitation in CursorVisitor to also handle MemberExprs
and CXXCallMemberExprs.  This scheme is hopefully general enough to extend to the
rest of the visitor if necessary.

llvm-svn: 118782
2010-11-11 08:05:18 +00:00
John McCall deebbcf20d Undo a refactor-o and base the bitfield-truncation warning on the
uncoerced value.  Also, whitelist bool bitfields, which aren't
really a truncation.

llvm-svn: 118778
2010-11-11 05:33:51 +00:00
NAKAMURA Takumi 78e3fdb8a7 test/CMakeLists.txt: Use ${LLVM_LIT_ARGS} and remove redundant arguments "-sv" and "--no-progress-bar".
llvm-svn: 118777
2010-11-11 04:09:51 +00:00
John McCall 1f425648ca Extend the bitfield-truncation warning to initializations.
rdar://problem/8652606

llvm-svn: 118773
2010-11-11 03:21:53 +00:00
Douglas Gregor 44c6ee7729 Improve ASTUnit's capture of diagnostics so that the
diagnostic-capturing client lives as long as the ASTUnit itself
does. Otherwise, we can end up with crashes when we get a diagnostic
outside of parsing/code completion. The circumstances under which this
happen are really hard to reproduce, because a file needs to change
from under us.

llvm-svn: 118751
2010-11-11 00:39:14 +00:00
Fariborz Jahanian 2a5deb56a4 Adding couple of Block API, a bug fix and
a test change, all for blocks. wip.

llvm-svn: 118745
2010-11-11 00:11:38 +00:00
John McCall 817d4af557 When -Wconversion computes the range of a type, it uses the (bit-)range
of the enumerators rather than the actual expressible range.  This is 
great when dealing with opaque *values* of that type, but when computing
the range of the type for purposes of converting *into* it, it produces
warnings in cases we don't care about (e.g. enum_t x = 500;).  Divide 
the logic into these two cases and use the more conservative range for
targets.    

llvm-svn: 118735
2010-11-10 23:38:19 +00:00
Devang Patel 82abab0812 test case for r118726.
llvm-svn: 118727
2010-11-10 22:19:57 +00:00
Douglas Gregor 869853eea1 Instantiate class member template partial specialization declarations
in the order they occur within the class template, delaying
out-of-line member template partial specializations until after the
class has been fully instantiated. This fixes a regression introduced
by r118454 (itself a fix for PR8001).

llvm-svn: 118704
2010-11-10 19:44:59 +00:00
Fariborz Jahanian a0a9d85a5d Check for duplicate declaration of a property in current and
other class extensions. // rdar://7629420

llvm-svn: 118689
2010-11-10 18:01:36 +00:00
John McCall ad31b5f2cb Propagate the deprecated and unavailable attributes from a
@property declaration to the autogenerated methods.  I'm uncertain
whether this should apply to attributes in general, but these are
a reasonable core.

Implements rdar://problem/8617301

llvm-svn: 118676
2010-11-10 07:01:40 +00:00
Argyrios Kyrtzidis 2703bebc58 Replace UsingDecl's SmallPtrSet of UsingShadowDecls with a linked list to avoid leaking memory.
Fixes rdar://8649963.

llvm-svn: 118674
2010-11-10 05:40:41 +00:00
John McCall a8987a294d Friend function declarations can overload with tag declarations.
Fixes PR7915.

llvm-svn: 118670
2010-11-10 03:01:53 +00:00
John McCall 9b72f89f0f Diagnose attempst to template using declarations and using directives.
Recover from the latter and fail early for the former.  Fixes PR8022.

llvm-svn: 118669
2010-11-10 02:40:36 +00:00
John McCall fd81c52947 Tweak to bitfield-overflow warning: don't warn about storing
a positive value into a signed bitfield of the exact width of
the value.

llvm-svn: 118657
2010-11-10 00:26:50 +00:00
John McCall 0e6cfaf6c0 Typo.
llvm-svn: 118649
2010-11-09 23:36:43 +00:00
John McCall d2a5312e14 Add a warning for implicit truncation of constant values due to
bitfield assignment.

Implements rdar://problem/7809123

llvm-svn: 118647
2010-11-09 23:24:47 +00:00
John McCall 18a2c2c0b9 Split out -Wconversion warnings about constant precision into their
own subcategory, -Wconstant-conversion, which is on by default.

Tweak the constant folder to give better results in the invalid
case of a negative shift amount.

Implements rdar://problem/6792488

llvm-svn: 118636
2010-11-09 22:22:12 +00:00
Fariborz Jahanian b332ba3a51 Test moved to its correct place.
llvm-svn: 118635
2010-11-09 21:40:30 +00:00
Fariborz Jahanian d11da7e52a Restore patch reversed in r118475. Fixes
// rdar://8632525

llvm-svn: 118634
2010-11-09 21:38:20 +00:00
Douglas Gregor 0124e9ba9a Attempt to resolve overloaded functions in comma expressions and
conditional operators. Fixes PR7863.

llvm-svn: 118631
2010-11-09 21:07:58 +00:00
Fariborz Jahanian dbee986290 Issues good diagnostic when @end is missing.
// rdar://8283484

llvm-svn: 118629
2010-11-09 20:38:00 +00:00
Chris Lattner 0786544ac5 fix PR8380, a crash on invalid due to an illogical DeclSpec SourceRange being constructed.
llvm-svn: 118625
2010-11-09 20:14:26 +00:00
Douglas Gregor 928479e727 Revert the fix for PR8013.
That bug concerned the well-formedness of code such as (&ovl)(a, b,
c). GCC rejects the code, while EDG accepts it. On further study of the
standard, I see no support for EDG's position: in particular, C++
[over.over] does not list this as a context where we can take the
address of an overloaded function, C++ [over.call.func] does not
reference the address-of operator at any point, and C++ [expr.call]
claims that the function argument in a call is either a function
lvalue or a pointer-to-function; (&ovl) is neither.

llvm-svn: 118620
2010-11-09 20:03:54 +00:00
Charles Davis 99202b358f Use the right calling convention when mangling names in the Microsoft C++
mangler. Now member functions and pointers thereof have their calling
convention mangled as __thiscall if they have the default CC (even though,
they technically still have the __cdecl CC).

llvm-svn: 118598
2010-11-09 18:04:24 +00:00
Douglas Gregor 8f225bb508 Handle overload resolution when calling an overloaded function set
with, e.g., (&f)(a, b, c). Fixes PR8013.

llvm-svn: 118508
2010-11-09 16:13:15 +00:00
Douglas Gregor ba57154614 Make #pragma unused work for static local variables.
llvm-svn: 118500
2010-11-09 14:57:47 +00:00
Douglas Gregor 229bebdeb5 ntroduce clang_getSpellingLocation() into libclang, to provide the
location where we're spelling a token even within a
macro. clang_getInstantiationLocation() tells where we instantiated
the macro.

I'm still not thrilled with the CXSourceLocation/CXSourceRange APIs,
since they gloss over macro-instantiation information.

Take 2: this time, adjusted tests appropriately and used a "simple"
approach to the spelling location.

llvm-svn: 118495
2010-11-09 06:24:54 +00:00
Douglas Gregor 12a610d1fa Revert r118492, which didn't update all of its tests accordingly
llvm-svn: 118494
2010-11-09 05:52:02 +00:00
Douglas Gregor d1ea3f0d29 Introduce clang_getSpellingLocation() into libclang, to provide the
location where we're spelling a token even within a
macro. clang_getInstantiationLocation() tells where we instantiated
the macro.

I'm still not thrilled with the CXSourceLocation/CXSourceRange APIs,
since they gloss over macro-instantiation information.

llvm-svn: 118492
2010-11-09 05:28:47 +00:00
Douglas Gregor 2927c0c817 Teach code completion not to include out-of-line declarations and
definitions in its results. The original declarations will be visible
wherever they are declared.

llvm-svn: 118484
2010-11-09 03:59:40 +00:00
Argyrios Kyrtzidis 8b4cf00cdc Fix the test for Release.
llvm-svn: 118483
2010-11-09 03:43:49 +00:00
Douglas Gregor 4aff944f1a Add __nullptr as a C++0x nullptr literal, available in C++98
llvm-svn: 118482
2010-11-09 03:43:04 +00:00
Douglas Gregor 23ab745e79 Fix source locations in unnamed bitfield diagnostic, from Jakub
Wieczorek! Fixes PR8025.

llvm-svn: 118481
2010-11-09 03:31:16 +00:00
Fariborz Jahanian 1e2d01e77d Remove this test for now.
llvm-svn: 118476
2010-11-09 02:24:38 +00:00
Fariborz Jahanian 3655e59688 Reverse patch for // rdar://8632525. It might
has broken a build.

llvm-svn: 118475
2010-11-09 02:24:08 +00:00
Fariborz Jahanian 115393ce66 Remove space from rdar URIs.
llvm-svn: 118474
2010-11-09 02:16:57 +00:00
Ted Kremenek dcf85a8d18 Teach AttrNonNullChecker about transparent unions. Fixes crash reported in <rdar://problem/8642434>.
llvm-svn: 118473
2010-11-09 02:11:43 +00:00
Argyrios Kyrtzidis 8909686b22 Fix miscompilation regarding VLAs; subscription of VLA pointers was incorrect.
Fixes rdar://8644873 & http://llvm.org/PR8567.

llvm-svn: 118468
2010-11-09 01:30:48 +00:00
John McCall 478382521e When re-using a vtable slot for the nearest overridden method, just because
there's no return adjustment from the overridden to the overrider doesn't
mean there isn't a return adjustment from the overrider to the final
overrider.  This matters if we're emitting a virtual this-adjustment thunk
because the overrider virtually inherits from the class providing the
nearest overridden method.  Do the appropriate return adjustment in this case.

Fixes PR7611.

llvm-svn: 118466
2010-11-09 01:18:05 +00:00
Nick Lewycky 6147891648 Don't lose track of previous-declarations when instantiating a class template.
Fixes PR8001.

llvm-svn: 118454
2010-11-08 23:29:42 +00:00