Граф коммитов

33444 Коммитов

Автор SHA1 Сообщение Дата
Fariborz Jahanian ba96ffcb2a objc-arc: better diagnostic when block is declared
inside a struct/union.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146444 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 23:17:04 +00:00
Eli Friedman fa2b3dd31c Make CGRecordLayoutBuilder correctly switch over to a packed class when a class has a base whose alignment will break the class layout. <rdar://problem/10551376>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146443 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 23:13:20 +00:00
Chad Rosier ff7892758f Add frontend flags to enable bitcode verifier pass.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146441 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 23:05:47 +00:00
Matt Beaumont-Gay 8ef8f431aa Suppress -Warray-bounds in certain cases involving macros from system headers.
The motivation here is a "clever" implementation of strncmp(), which peels the first few comparisons via chained conditional expressions which ensure that the input arrays are known at compile time to be sufficiently large.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146430 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 22:35:02 +00:00
Fariborz Jahanian 364a59ed8f Fixes a bug in calculation of field offsets of ms_struct
fields by just following what comment says.
// rdar://10513599


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146414 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 21:16:36 +00:00
Tony Linthicum 9631939f82 Hexagon backend support
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146413 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 21:14:55 +00:00
Richard Smith 60f24e7814 Further tweaking of diagnostic text for casts performing reinterpret_cast
conversions in constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146406 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 19:33:27 +00:00
Douglas Gregor 3b29bb9994 When we have an umbrella directory in a module map, recursively walk
the subdirectories to find headers in submodules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146398 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 19:13:53 +00:00
Richard Smith 4cd9b8f7fb Clean up diagnostic wording for disallowed casts in C++11 constant expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146395 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 19:10:03 +00:00
Douglas Gregor d83d2e73fd Don't mark include guard macros as implicitly private. This isn't
actually a terribly good heuristic, and the world is too horrible for
it to work.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146393 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 18:47:39 +00:00
Hans Wennborg c08e618f99 Fix signature of vsscanf in Builtins.def
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146392 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 18:46:05 +00:00
Hans Wennborg d95a8ab030 Fix signature of sscanf in Builtins.def
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146390 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 18:33:02 +00:00
Richard Smith c216a01c96 Implement C++11 constant expression cast restrictions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146371 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 12:46:16 +00:00
Hans Wennborg 439ddaada2 Make fscanf, vscanf, etc. be recognized as scanf-like functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146367 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 10:34:18 +00:00
Richard Smith d509342030 Fix some not-yet-used diagnostic code in a template, which gcc spotted and clang
did not!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146366 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 09:41:58 +00:00
Richard Smith dd1f29b6d6 Prepare constant expression infrastructure for the generation of richer
diagnostics. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146365 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 09:28:41 +00:00
Chandler Carruth 50058ec63f Update Clang to emit the new form of llvm.cttz and llvm.ctlz intrinsics,
setting the is_zero_undef flag appropriately to true as that matches the
semantics of these GCC builtins.

This is the Clang side of r146357 in LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146358 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 04:28:35 +00:00
David Blaikie 4db8c4483e Fix/test decltype dtor calls with invalid base expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146354 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 04:13:55 +00:00
Anna Zaks e3d250e488 [analyzer] CStringChecker should not rely on the analyzer generating UndefOrUnknown value when it cannot reason about the expression.
We are now often generating expressions even if the solver is not known to be able to simplify it. This is another cleanup of the existing code, where the rest of the analyzer and checkers should not base their logic on knowing ahead of the time what the solver can reason about. 

In this case, CStringChecker is performing a check for overflow of 'left+right' operation. The overflow can be checked with either 'maxVal-left' or 'maxVal-right'. Previously, the decision was based on whether the expresion evaluated to undef or not. With this patch, we check if one of the arguments is a constant, in which case we know that 'maxVal-const' is easily simplified. (Another option is to use canReasonAbout() method of the solver here, however, it's currently is protected.)

This patch also contains 2 small bug fixes:
 - swap the order of operators inside SValBuilder::makeGenericVal.
 - handle a case when AddeVal is unknown in GenericTaintChecker::getPointedToSymbol.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146343 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-11 18:43:40 +00:00
Benjamin Kramer 9f32a920c6 Reuse forAddr to create ignored AggValueSlots.
Silences valgrind warnings about uninitalized alignment values.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146342 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-11 16:34:24 +00:00
Anna Zaks 6d6a83c375 [analyzer]Fixup r146336.
Forgot to commit the Header files. 
Rename generateUnknownVal -> makeGenericVal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146337 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 23:42:38 +00:00
Anna Zaks 24d052cdb7 [analyzer] Introduce IntSymExpr, where the integer is on the lhs.
Fix a bug in SimpleSValBuilder, where we should swap lhs and rhs when calling generateUnknownVal(), - the function which creates symbolic expressions when data is tainted. The issue is not visible when we only create the expressions for taint since all expressions are commutative from taint perspective.

Refactor SymExpr::symbol_iterator::expand() to use a switch instead of a chain of ifs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146336 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 23:36:51 +00:00
Hans Wennborg 6fcd932dfd Check that arguments to a scanf call match the format specifier,
and offer fixits when there is a mismatch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146326 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 13:20:11 +00:00
NAKAMURA Takumi e7edf30143 test/Sema/attr-availability.c: Add explicit -triple x86_64-apple-darwin9, for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146321 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 07:50:30 +00:00
Argyrios Kyrtzidis 16ed0e6fda [libclang] Add defensive checks to make sure we don't try to dereference
a null pointer after getCursorDecl() is called. rdar://10298421.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146312 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 02:36:25 +00:00
Argyrios Kyrtzidis a4288c4aa0 In ContentCache::replaceBuffer, add sanity check to make sure that we do not free a buffer
and then continue using it. rdar://10359140.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146308 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 01:38:26 +00:00
Douglas Gregor 9aab9c4116 Make sure that we infer __strong, etc. when we instantiate variables
under ARC. Fixes <rdar://problem/10530209>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146307 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 01:22:52 +00:00
Richard Smith ee19f43bf8 Add a fast path to the constant evaluator for integer literals. This speeds up
compilation of some translation units of SPEC's 445.gobmk by ~4%, and does not
seem to cause a measurable slowdown in other cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146306 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 01:10:13 +00:00
Argyrios Kyrtzidis d575254dcd Add a sanity check in SourceManager::getColumnNumber, make sure
we don't try to access beyond the buffer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146305 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 00:30:38 +00:00
Fariborz Jahanian 006e42f0c8 Add ability to supply additional message to availability macros,
// rdar://10095131


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146304 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 00:28:41 +00:00
Douglas Gregor d937c21f53 Use the right CHECK prefix so that we actually do this checking. Miraculously, this hasn't broken
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146303 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 00:28:18 +00:00
Douglas Gregor 92be2a5f4e When we manage to re-use an expression during tree transformation (=
template instantiation), and that expression might produce a
temporary, invoke MaybeBindToTemporary. Otherwise, we forget to
destroy objects, release objects, etc. Fixes <rdar://problem/10531073>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146301 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 00:23:21 +00:00
Daniel Dunbar 001f628a69 Driver: Handle -f{no-}honor-infinities, -f{no-}honor-nans, and
-ffinite-math-only.
 - No test case yet, I don't know how to construct a situation where this
   matters.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146297 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 23:41:18 +00:00
Matt Beaumont-Gay 2c3c7675b4 Fix up doxyments (\arg vs \p).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146292 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 23:16:01 +00:00
Eli Friedman 40563cd5ea Make array new on a pointer to data member type work correctly. PR11523.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146291 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 23:05:37 +00:00
Richard Smith 9eed49c2bb Mechanically convert static_assert_fold to static_assert, now we implement the
C++11 ICE rules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146290 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 23:00:37 +00:00
Richard Smith f48fdb0937 C++11 constant expressions: Don't use CheckICE in C++11; instead, determine
whether an expression is a (core) constant expression as a side-effect of
evaluation. This takes us from accepting far too few expressions as ICEs to
accepting slightly too many -- fixes for the remaining cases are coming next.

The diagnostics produced when an expression is found to be non-constant are
currently quite poor (with generic wording but reasonable source locations),
and will be improved in subsequent commits.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146289 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 22:58:01 +00:00
Ted Kremenek 0373fcc3e5 Add clang_getDiagnosticSetFromTU() to libclang. Fixes <rdar://problem/10553081>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146287 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 22:28:32 +00:00
Ted Kremenek 52a9b5aa5d Sort exports list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146286 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 22:28:29 +00:00
David Blaikie 2def77399a Add notes for suppressing and (if it's a zero-arg function returning bool) fixing the function-to-bool conversion warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146280 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 21:42:37 +00:00
Fariborz Jahanian 6dce88d9f7 objc-arc: diagnose synthesis of a 'weak unavailable' property.
// rdar://10535245


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146272 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 19:55:11 +00:00
David Blaikie 44d95b5571 Provide a separate warning for weak vtables in explicit template instantiations. There's no (current) way to fix such templates to emit strong symbols/vtables, but perhaps users want to know about the cost being incurred anyway.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146265 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 18:32:50 +00:00
Douglas Gregor efda0e8705 When performing subframework header lookup, don't search for
".framework/" in the path name, because it could be ".framework\" on
Windows. This whole function needs to be rewritten with PathV2.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146261 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 16:48:01 +00:00
Douglas Gregor 99a922b6da Use llvm::sys::fs::equivalent rather than comparing inodes, because
comparing inodes doesn't actually work on Windows.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146260 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 16:22:07 +00:00
Hans Wennborg 630821869c Remove unnecessary braces from my previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146259 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 15:57:33 +00:00
Hans Wennborg f4f0c6095d Make printf warnings refer to wint_t and wchar_t by name
in addition to underlying type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146254 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 12:22:12 +00:00
Hans Wennborg b8ec3e35d2 Move definition of ConversionSpecifier::toString() to FormatString.cpp
It's declared in FormatString.h, so it shouldn't be defined in
PrintfFormatString.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146253 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 11:11:07 +00:00
Hans Wennborg 117348caf0 fix format specifier fixit for printf("%ld", "foo");
It should reset the length modifier (unless it's a wchar_t string).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146252 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 10:51:29 +00:00
Chandler Carruth 4b45c111f0 Fix a blatant typo or cut/paste-o reported by users of this header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146251 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 09:23:55 +00:00
Richard Smith 4ec4089b30 Teach isConstantInitializer that numeric literals are constants, rather than
having it evaluate them. No change in functionality, but a speed up of about 5%
on some translation units in SPEC 445.gobmk.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146248 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 06:47:34 +00:00