Commit Graph

36909 Commits

Author SHA1 Message Date
Richard Smith 169f219001 Add a special-case diagnostic for one of the more obnoxious special cases of
unscoped enumeration members: an enumerator name which is visible in the
out-of-class definition of a member of a templated class might not actually
exist in the instantiation of that class, if the enumeration is also lexically
defined outside the class definition and is explicitly specialized.

Depending on the result of a CWG discussion, we may have a different resolution
for a class of problems in this area, but this fixes the immediate issue of a
crash-on-invalid / accepts-invalid (depending on +Asserts). Thanks to Johannes
Schaub for digging into the standard wording to find how this case is currently
specified to behave.

llvm-svn: 153461
2012-03-26 20:28:16 +00:00
Daniel Dunbar eec0abefb6 [tests] Fix test failure in release mode.
llvm-svn: 153460
2012-03-26 20:18:16 +00:00
Benjamin Kramer a4988caa26 Simplify code, no functionality change.
llvm-svn: 153459
2012-03-26 20:12:15 +00:00
Daniel Dunbar 94d34ca2d9 Revert r153443 "objective-c modern translator: extern "C" exported", it fails in testing.
llvm-svn: 153454
2012-03-26 18:48:59 +00:00
Anna Zaks a651c4099d [analyzer] Malloc: Allow a pointer to escape through OSAtomicEnqueue.
llvm-svn: 153453
2012-03-26 18:18:39 +00:00
Akira Hatanaka efe96a682d Test case for r153348.
llvm-svn: 153449
2012-03-26 17:37:20 +00:00
Kostya Serebryany 141e46faf0 add tbaa metadata to vtable pointer loads/stores
llvm-svn: 153447
2012-03-26 17:03:51 +00:00
Benjamin Kramer db534a4eb9 Move CodeCompletionBuilder's chunk adding methods out of line.
This makes sense because chunk's ctor is also out of line and simplifies considerably
when inlined with a constant parameter. Shrinks clang on i386-linux-Release+Asserts by 65k.

llvm-svn: 153446
2012-03-26 16:57:36 +00:00
Douglas Gregor b11f94590c When diagnosing an invalid out-of-line redeclaration, don't permit
typo correction to introduce a nested-name-specifier; we aren't
prepared to handle it here. Fixes PR12297 / <rdar://problem/11075219>.

llvm-svn: 153445
2012-03-26 16:54:18 +00:00
Fariborz Jahanian c29ebc36b1 objective-c modern translator: extern "C" exported
symbols. // rdar://11103982

llvm-svn: 153443
2012-03-26 16:29:49 +00:00
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
Benjamin Kramer e6f5123e16 Driver: Factor string vector push_back into a helper class and optimize it.
Due to lack of move semantics we would create a temporary std::string from the
string literal, copy it into the vector and discard the temporary. This leads
to massive code bloat, optimizing it saves 50k on i386-linux-Release+Asserts.

While there add a two-element overload for push_back, simplifying code a bit.

llvm-svn: 153441
2012-03-26 15:39:31 +00:00
Benjamin Kramer 40b099b068 ThreadSafetyReporter: Manage diagnostics in a std::list.
std::list is expensive, but so is std::sorting a SmallVector of SmallVectors of
heavyweight PartialDiagnostics.

Saves ~30k in a i386-linux-Release+Asserts clang build.

llvm-svn: 153437
2012-03-26 14:05:40 +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
Aaron Ballman eceaddc864 Since this change is generating a considerable amount of discussion (and possibly even a regression for known bad versions), I'm reverting it.
llvm-svn: 153420
2012-03-25 22:46:17 +00:00
Aaron Ballman 9345d68ff7 No longer hard coding paths to the MinGW include directories; using a regular expression instead.
Patch thanks to Nikola Smiljanic

llvm-svn: 153413
2012-03-25 15:47:41 +00:00
NAKAMURA Takumi e9ca55ea9b clang/lib/Analysis/CFG.cpp: Get rid of early insertion of placeholder to the map.
llvm-svn: 153407
2012-03-25 06:30:37 +00:00
NAKAMURA Takumi f0434b09fc clang/lib/Analysis/CFG.cpp: Fix memory leak since r153297.
evaluateAsBooleanConditionNoCache(S) might update the map and invalidate the iterator.

llvm-svn: 153406
2012-03-25 06:30:32 +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
Benjamin Kramer e894e09e70 Simplify some users of DenseMap::erase.
llvm-svn: 153389
2012-03-24 18:22:12 +00:00
Fariborz Jahanian 16366da437 remove declaration of _objc_empty_vtable no longer
used in modern objc translator. // rdar://11105680

llvm-svn: 153386
2012-03-24 16:57:13 +00:00
Rafael Espindola d0decdec57 Fix copy and pasto.
llvm-svn: 153385
2012-03-24 16:57:10 +00:00
Fariborz Jahanian 341348111d moderin objc translator: remove 'const' from remaining
fields in _class_ro_t metadata. //  rdar://11079898

llvm-svn: 153384
2012-03-24 16:53:16 +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 f392d4ba30 Don't cast away constness.
llvm-svn: 153381
2012-03-24 13:59: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
Jordy Rose 21ff76e916 [analyzer] Tighten up the realloc() failure path note generation...make sure we get the right realloc()!
llvm-svn: 153370
2012-03-24 03:15:09 +00:00
Jordy Rose 43a9af7352 [analyzer] Restart path diagnostic generation if any of the visitors change the report configuration while walking the path.
This required adding a change count token to BugReport, but also allowed us to ditch ImmutableList as the BugReporterVisitor data type.

Also, remove the hack from MallocChecker, now that visitors appear in the opposite order. This is not exactly a fix, but the common case -- custom diagnostics after generic ones -- is now the default behavior.

llvm-svn: 153369
2012-03-24 03:03:29 +00:00
Jordy Rose f78877e99a [analyzer] Add a clone() method to BugReporterVisitor, so that we'll be able to reset diagnostic generation.
llvm-svn: 153368
2012-03-24 02:45:35 +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
Kostya Serebryany d18cb502bd use EP_OptimizerLast instead of EP_ScalarOptimizerLate for ThreadSanitizer
llvm-svn: 153356
2012-03-23 23:25:23 +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 34bd1eb560 Revert accidentally-committed www changes (and an unused diagnostic);
forward-declared enums aren't /quite/ done yet.

llvm-svn: 153350
2012-03-23 23:11:49 +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
Akira Hatanaka 6976ec8551 Add support for MIPS' floating ABIs (hard, soft and single) to clang driver.
Patch by Simon Atanasyan.

llvm-svn: 153348
2012-03-23 23:07:09 +00:00
Ted Kremenek 888ac96f2b Update checker build.
llvm-svn: 153312
2012-03-23 07:06:16 +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
Eric Christopher aefeaa9873 Remove the vestiges of the C backend.
llvm-svn: 153308
2012-03-23 05:51:52 +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
Anton Yartsev edb062887f corrected check::EndOfTranslationUnit checker name and added 'const' to declaration
llvm-svn: 153302
2012-03-23 02:43:24 +00:00
Argyrios Kyrtzidis 5f172a3301 [CFG] Cache boolean evaluations of expressions to avoid multiple re-evaluations
during construction of branches for chained logical operators.

This makes -fsyntax-only for test/Sema/many-logical-ops.c about 32x times faster.

With measuring SemaExpr.cpp I see differences below the noise level.

llvm-svn: 153297
2012-03-23 00:59:17 +00:00
Rafael Espindola 6dc3d97a65 Remove unused bits.
llvm-svn: 153295
2012-03-23 00:05:14 +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