Commit Graph

14043 Commits

Author SHA1 Message Date
Douglas Gregor 9f21889a7d Canonicalize the declaration we write to a PCH file for an
InjectedClassNameType; otherwise, it won't be properly wired to the
original (canonical) declaration when it is deserialized. Fixes
<rdar://problem/11112464>.

llvm-svn: 153442
2012-03-26 15:52:37 +00:00
Richard Smith 2e6610affd Handle instantiations of redeclarations of forward-declared enumerations within
templated functions. Build a redeclaration chain, and only instantiate the
definition of the enum when visiting the defining declaration.

llvm-svn: 153427
2012-03-26 04:58:10 +00:00
Richard Smith 258a744bbd Delay checking of dependent underlying types for redeclarations of member
enumerations in templates until the template is instantiated.

llvm-svn: 153426
2012-03-26 04:08:46 +00:00
NAKAMURA Takumi 9a0ca277b0 test/Driver/cpath.c: Escape a few args that contain %{pathsep}.
On msys bash, with %pathsep==os.pathsep==';', I can see lines like below in this script;

    env DIR=X:/foo%{pathsep}X:/bar

Then it is expanded to;

    env DIR=X:/foo;X:/bar

It should be with quote;

    env "DIR=X:/foo;X:/bar"

llvm-svn: 153402
2012-03-25 03:42:26 +00:00
Rafael Espindola d0decdec57 Fix copy and pasto.
llvm-svn: 153385
2012-03-24 16:57:10 +00:00
Rafael Espindola 5c0034a7c6 Add back r153360 with a fix for enums that cover all the 32 bit values.
Thanks to NAKAMURA Takumi for finding it!

llvm-svn: 153383
2012-03-24 16:50:34 +00:00
NAKAMURA Takumi 2681efcc95 Revert r153360 (and r153380), "Second part of PR12251. Produce the range metadata in clang for booleans and".
For i686 targets (eg. cygwin), I saw "Range must not be empty!" in verifier.

It produces (i32)[0x80000000:0x80000000) from (uint64_t)[0xFFFFFFFF80000000ULL:0x0000000080000000ULL), for signed i32 on MDNode::Range.

llvm-svn: 153382
2012-03-24 14:43:42 +00:00
Benjamin Kramer e2c1e64909 On i386 the alignment of i64 is 4, not 8.
llvm-svn: 153380
2012-03-24 13:22:50 +00:00
Argyrios Kyrtzidis 6db850133f [parser] If there are unmatched braces in a function definition, try to
recover by returning the statements that we parsed so far, instead of
dropping the whole function body.

rdar://10967343

llvm-svn: 153367
2012-03-24 02:26:51 +00:00
Rafael Espindola 54355820e8 Second part of PR12251. Produce the range metadata in clang for booleans and
c++ enums.

llvm-svn: 153360
2012-03-24 00:28:06 +00:00
Richard Smith 5614ca7715 Teach APValue printer to print boolean 0 and 1 as 'false' and 'true'. Fix up
some calling code to actually pass in a non-null type, to avoid a crash.

llvm-svn: 153358
2012-03-23 23:55:39 +00:00
Argyrios Kyrtzidis 822c433a27 Make sure we don't accept an @interface inside another objc container
just because there was an attribute in front of it.

llvm-svn: 153355
2012-03-23 23:24:23 +00:00
Argyrios Kyrtzidis aaf9743f56 [libclang] Make sure we don't crash when trying to index code that
managed to insert an @interface as top level decl contained by another
@interface.

A commit to also not allow this as valid code will be coming.

rdar://11105114.

llvm-svn: 153354
2012-03-23 23:24:18 +00:00
Richard Smith b66d77793f When defining a forward-declared enum, don't try to attach the definition to
a previous declaration if the redeclaration is invalid. That way lies madness.
Fixes a crash-on-invalid reported by Abramo.

llvm-svn: 153349
2012-03-23 23:09:08 +00:00
Ted Kremenek 161046edab Avoid applying retain/release effects twice in RetainCountChecker when a function call was inlined (i.e., we do not need to apply summaries in such cases).
llvm-svn: 153309
2012-03-23 06:26:56 +00:00
Richard Smith 7d137e3b98 Support for definitions of member enumerations of class templates outside the
class template's definition, and for explicit specializations of such enum
members.

llvm-svn: 153304
2012-03-23 03:33:32 +00:00
Argyrios Kyrtzidis a754a03550 [libclang] For a CXCursor_ObjCInstanceMethodDecl/CXCursor_ObjCClassMethodDecl cursor,
return from clang_getCursorLocation the start location of the method name.

rdar://11105223

llvm-svn: 153303
2012-03-23 03:33:19 +00:00
Fariborz Jahanian e005070ccf modern objc translation of block literal expressions
declared at file scope.
// rdar://11006566

llvm-svn: 153293
2012-03-23 00:00:49 +00:00
Bill Wendling f351774f7b Small cleanup.
llvm-svn: 153292
2012-03-22 23:34:01 +00:00
Bill Wendling 9382fdb163 Use correct FileCheck regexp.
llvm-svn: 153291
2012-03-22 23:32:07 +00:00
Bill Wendling 3b9eaa177d When an MMX output variable is tied to the input variable, we have to implicitly
cast the value to x86_mmx. This gives the ASM string the correct call signature.
<rdar://problem/10919182>

llvm-svn: 153290
2012-03-22 23:25:07 +00:00
Matt Beaumont-Gay 1617ee30fb line endings
llvm-svn: 153289
2012-03-22 23:15:04 +00:00
Eli Friedman 610bb87e17 Make sure we correctly set the alignment for vector loads and stores associated with vector element lvalues. Patch by Kevin Schoedel (with some minor modifications by me).
llvm-svn: 153285
2012-03-22 22:36:39 +00:00
Ted Kremenek 30de950bba Fix static analyzer crash on code taking the address of a field. Fixes PR 11146.
llvm-svn: 153283
2012-03-22 21:42:31 +00:00
Fariborz Jahanian bdf975ea3f modern objc rewriter: until we can translate block literals
at global scope properly, issue diagnostics.

llvm-svn: 153271
2012-03-22 19:54:39 +00:00
Fariborz Jahanian ee1db7a0fd modern objective-c rewriter: Fix up translation of
property attributes. // rdar://11095151

llvm-svn: 153261
2012-03-22 17:39:35 +00:00
Argyrios Kyrtzidis bf6c3395db [PCH] When we are replacing a decl in a chained PCH that is also a DeclContext,
make sure to fully load its external lexical and visible declarations before
re-writing it.

rdar://10914192

llvm-svn: 153254
2012-03-22 16:08:04 +00:00
Ted Kremenek 40c13431aa "Teach" RetainCountChecker about dispatch_set_context, which can indirectly free its argument later. Fixes <rdar://problem/11059275>.
llvm-svn: 153244
2012-03-22 06:29:41 +00:00
Chandler Carruth 13332ee518 Relax the FileCheck assertions in this test a touch. Previously the test
relied on an artifact of how the inliner and subsequent passes in
clang's -O3 mode happen to treat basic blocks and the labels for the
basic blocks. In my work on the inliner, and changed this fundamental
assumption, and the label that was being checked on the entry basic
block will no longer appear in opt builds. There was no reason to expect
the label to always be present anyways, much to my regret.

I've changed the test to just ensure that we return an immediate
constant. If there are intervening instructions, that's bad, but not
really that relevant to the test.

I'd love it if others have a better way of checking that a function body
contains only a 'ret' instruction that isn't dependent on whether or not
the entry block receives a label...

llvm-svn: 153243
2012-03-22 06:22:13 +00:00
Ted Kremenek 213d05304e Fix broken CFG when an initializer is a statement expression that starts with a while loop (PR 12325).
llvm-svn: 153242
2012-03-22 05:57:43 +00:00
Richard Smith 0b472d86de During the instantiation of a class template specialization, that
specialization is known to be incomplete. If we're asked to try to
complete it, don't attempt to instantiate it again -- that can lead
to stack overflow, and to rejects-valids if the class being incomplete
is not an error.

llvm-svn: 153236
2012-03-22 03:35:28 +00:00
Anna Zaks 9fe8098e29 [analyzer] Malloc: drop symbols captured by blocks.
llvm-svn: 153232
2012-03-22 00:57:20 +00:00
Richard Trieu ba4d0871f7 Change the binary operator data recursive evaluator to not stop at the first
non-constant value encountered.  This allows the evaluator to deduce that
expressions like (x < 5 || true) is equal to true.  Previously, it would visit
x and determined that the entire expression is could not evaluated to a
constant.

This fixes PR12318.

llvm-svn: 153226
2012-03-21 23:30:30 +00:00
Fariborz Jahanian a6983a9bce For enums with no tag name, display its location in
the diagnostic instead of displaying ''.
// rdar://11082110

llvm-svn: 153219
2012-03-21 20:56:29 +00:00
Fariborz Jahanian 0740ed9835 fixes the diagnostic issued in // rdar://11069896
llvm-svn: 153217
2012-03-21 20:28:39 +00:00
Chad Rosier b57321ad3d Report the natural alignment of unsigned long long, not the preferred alignment.
rdar://11054144

llvm-svn: 153216
2012-03-21 20:20:47 +00:00
Nico Weber 6a2eee0cfb Try to get cpath.c passing on windows, using lit's new ${pathsep} variable.
llvm-svn: 153214
2012-03-21 19:57:21 +00:00
Anna Zaks fc2e153444 [analyzer] Malloc: Utter the name of the leaked variable.
Specifically, we use the last store of the leaked symbol in the leak diagnostic.
(No support for struct fields since the malloc checker doesn't track those
yet.)

+ Infrastructure to track the regions used in store evaluations.
This approach is more precise than iterating the store to
obtain the region bound to the symbol, which is used in RetainCount
checker. The region corresponds to what is uttered in the code in the
last store and we do not rely on the store implementation to support
this functionality.

llvm-svn: 153212
2012-03-21 19:45:08 +00:00
Anna Zaks d42e828720 [analyzer] Re-enable the test disabled by r152969.
(The fix was committed in r152982.)

llvm-svn: 153210
2012-03-21 19:44:57 +00:00
Fariborz Jahanian 3ba24bab1c Allow void blocks to return witn a void expression in
c-mode to match behavior with void functions in c. Issue
warning with -pedantic. // rdar://11069896

llvm-svn: 153200
2012-03-21 16:45:13 +00:00
John McCall b6c4a7ef21 For the annals of subtle but terrible bugs: fix a longstanding bug
in vtable layout where virtual methods inherited from virtual bases
could be assigned the same vcall adjustment slot if they shared
a name and parameter signature but differed in their
cv-qualification.  The code was already trying to handle this
case, but unfortunately used the ordinary type qualifiers
(which are always empty here) instead of the method qualifiers.
This seems like something that the API should discourage, but
I don't know how to carry that principle out in this instance.

Eliminate this function's need for an ASTContext while we're at it.

This bug affects the ABI, and fixing it brings us into accord with
the Itanium ABI (and GCC's implementation of it), but, obviously,
technically breaks full compatibility with previous releases of Clang.
Just letting you know.

llvm-svn: 153168
2012-03-21 06:57:19 +00:00
John McCall f21bfcf805 Test case for rdar://problem/11055105, a bug with the instantiation
of references to function template parameters in noexcept clauses when
the instantiation is forced from a point during parsing when a block
is in scope.

llvm-svn: 153152
2012-03-21 00:45:33 +00:00
Fariborz Jahanian cd79a49f37 modern objective-c translator: add static function to initialize
the class pointer in the category structure.
// rdar://11076938

llvm-svn: 153138
2012-03-20 21:41:28 +00:00
Sebastian Redl d9170b09e6 More careful consideration of C++11 13.3.3.1p4. Fixes PR12257.
llvm-svn: 153130
2012-03-20 21:24:14 +00:00
Sebastian Redl 6db0b1bfed Fix the other place where C++98 work for initializer lists was necessary.
llvm-svn: 153129
2012-03-20 21:24:03 +00:00
Ted Kremenek 4a64230ee7 Don't include FixIts with a null replacement range. Fixes <rdar://problem/11040133>.
llvm-svn: 153122
2012-03-20 20:49:45 +00:00
Benjamin Kramer e6b4a16ddd Fix a use-after-free in thunk emission. EmitThunk may call RAUW on Init, invalidating the pointer.
Fixes PR12284. The test case only triggered under asan/valgrind, but it's better than nothing.

llvm-svn: 153120
2012-03-20 20:18:13 +00:00
Fariborz Jahanian 40ca00dc4c modern objective-c translator: provide meta-data initialization
via functions for certain pointer initialization
fields. // rdar://11076938

llvm-svn: 153117
2012-03-20 19:54:33 +00:00
Benjamin Kramer 8cc491a601 Debug info: Tighten up uses of plain MDNode pointers which don't survive replaceOperandWith.
TrackingVH notices when it gets RAUW'd. Fixes PR12305 and PR12315.

llvm-svn: 153115
2012-03-20 19:49:14 +00:00
Fariborz Jahanian 6e60c1376f modern objective-c translator: couple of minor
changes to how meta-data is declared. 
// rdar://11076938

llvm-svn: 153098
2012-03-20 17:34:50 +00:00