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

20800 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner 1a4221cbe1 Don't warn about unused static functions if they are marked with
attr constructor or destructor.  Patch by Jean-Daniel Dupas!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100870 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 17:25:05 +00:00
Douglas Gregor 9f692a0308 On Windows, disable the modification-time check for files used in
precompiled headers and/or when reading the contents of the file into
memory. These checks seem to be causing spurious regression-test
failures on Windows.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 15:54:22 +00:00
Fariborz Jahanian 4ecb25fa94 Fixes a regression caused by implementing cstyle methods
for objc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100865 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 15:40:42 +00:00
Daniel Dunbar 08c0cdfd43 Forcibly disable test/PCH/pr4489.c, it is flaky on one of the buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100864 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 15:30:57 +00:00
John McCall 5dd52ac75e Add a note to the C++ compatibility page about templates with no
valid instantiations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100836 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 01:07:07 +00:00
Douglas Gregor d4eea83626 Improve diagnostics when we fail to convert from a source type to a
destination type for initialization, assignment, parameter-passing,
etc. The main issue fixed here is that we used rather confusing
wording for diagnostics such as

t.c:2:9: warning: initializing 'char const [2]' discards qualifiers,
      expected 'char *' [-pedantic]
  char *name = __func__;
        ^      ~~~~~~~~

We're not initializing a 'char const [2]', we're initializing a 'char
*' with an expression of type 'char const [2]'. Similar problems
existed for other diagnostics in this area, so I've normalized them all
with more precise descriptive text to say what we're
initializing/converting/assigning/etc. from and to. The warning for
the code above is now:

t.c:2:9: warning: initializing 'char *' from an expression of type
      'char const [2]' discards qualifiers [-pedantic]
  char *name = __func__;
        ^      ~~~~~~~~

Fixes <rdar://problem/7447179>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100832 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 00:35:39 +00:00
Ted Kremenek 355fa3a65d Use '%clang_cc1' instead of '%clang' to make the warning output more consistent across
platforms (for this test).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100827 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 23:17:16 +00:00
Ted Kremenek bace4ba042 For 'open' check in UnixAPIChecker, hard code value of 'O_CREAT' on Darwin.
This is still not an ideal solution, but should disable the check for other
targets where the value of O_CREAT is different.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100818 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 22:15:34 +00:00
Douglas Gregor 8804bdcac2 Reorder diagnostics to separate the Sema::AssignmentAction diagnostics from other diagnostics
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100817 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 22:07:57 +00:00
Ted Kremenek 5d07401587 Temporarily only enable 'open' check on Mac OS X to unbreak Windows buildbot. I'm
looking into an alternate fix right now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100816 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 21:54:13 +00:00
Douglas Gregor cb821d045f Downgrade the "declaration does not declare anything" error to a
warning. It's not harmful to have such pointless declarations, and GCC
does not diagnose this issue consistently.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100814 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 21:33:23 +00:00
Fariborz Jahanian 7732cc9c0f Implement method type encoding in the presense
of c-style arguments. Completes radar 7445205.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100813 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 21:29:11 +00:00
Ted Kremenek b4c0c2df7a Match GCC's behavior and do not include '-Wunused-parameter' in '-Wunused'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100810 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 21:10:56 +00:00
Jeffrey Yasskin c173be2aa7 Explain that a template needs arguments to make it into a type, for
variable declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100809 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 21:04:54 +00:00
John McCall ea7390c7b3 Set access properly on instantiated friend class template declarations.
Fixes PR6752.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100806 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 20:25:50 +00:00
Ted Kremenek 99d9838b25 Add static analyzer check for calls to 'pthread_once()' where the control-flow has
automatic storage.  This matches the corresponding check for 'dispatch_once()'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100803 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 19:53:31 +00:00
Ted Kremenek a8b48e4b68 Update test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100801 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 18:51:47 +00:00
Ted Kremenek b7e5f145f4 Remove micro-optimization for not issueing CFG-based warnings for 'static inline' functions
unless they are used.  I discussed this with Daniel Dunbar, and we agreed that this
provides an inconsistent warnings experience for the user and that there were
genuine cases where we wouldn't want to do this optimization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100800 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 18:51:44 +00:00
Douglas Gregor c53d0d7620 Introduce an egregious hack to work around a bug in libstdc++ 4.2.x's
<tr1/hashtable> header, where a friend class template
std::tr1::__detail::_Map_base is declared with the wrong template
parameters. GCC doesn't catch the problem, so Clang does a little
back-flip to avoid diagnosing just this one instance of the problem.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100790 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 18:16:15 +00:00
Fariborz Jahanian 6f46c2653c Fix a misuse of iterators when iterating through block's
parameters list for encoding.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100788 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 18:06:22 +00:00
Ted Kremenek e1fcf29951 Include all warnings under '-Wunused' in '-Wmost' and '-Wall'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100786 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 17:54:28 +00:00
Ted Kremenek bbf3fe4852 Sort entries in diagnostic group "Most".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100785 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 17:54:24 +00:00
John McCall 33cab704d9 Maybe we should store template arguments in the position we allocated for them
instead of scribbling over random memory.  Maybe.

Hopefully this fixes the -vg buildbot.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100784 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 17:47:15 +00:00
Jeffrey Yasskin 9ab1454171 Make CXXScopeSpec invalid when incomplete, and propagate that into any
Declarator that depends on it.  This fixes several redundant errors and bad
recoveries.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100779 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 16:38:48 +00:00
Anders Carlsson 461e326e74 Rename CGVtable files to CGVTables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100778 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 16:30:25 +00:00
Anders Carlsson ec9c202e9d Clarify an assert.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100776 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 16:18:36 +00:00
Douglas Gregor e17ad2fd5c Unbreak the build
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100775 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 16:07:47 +00:00
Benjamin Kramer cfb51b6d46 CIndex: move extractUSRSuffix out of extern "C" and simplify it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100773 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 15:54:07 +00:00
Douglas Gregor 1e201b4a9d Eliminate excessive PCH deserialization caused by the search for
__cxxabiv1::__fundamental_type_info in every translation
unit. Previously, we would perform name lookup for
__cxxabiv1::__fundamental_type_info at the end of IRGen for a each
translation unit, to determine whether it was present. If so, we we
produce type information for all of the fundamental types. However,
this name lookup causes PCH deserialization of a significant part of the
translation unit, which has a woeful impact on performance.

With this change, we now look at each record type after we've
generated its vtable to see if it is
__cxxabiv1::__fundamental_type_info. If so, we generate type info for
all of the fundamental types. This works because
__cxxabiv1::__fundamental_type_info should always have a key function
(typically the virtual destructor), that will be defined once in the
support library. The fundamental type information will end up there.

Fixes <rdar://problem/7840011>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100772 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 15:52:03 +00:00
Benjamin Kramer 71c972acd4 Remove caseless switch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100770 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 15:44:22 +00:00
John McCall af2094e7ce Implement dependent friend function template specializations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100753 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 09:05:18 +00:00
Ted Kremenek 2b60513052 Removed unused object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100750 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 07:30:50 +00:00
Daniel Dunbar b69eca5d21 Fronted: Kill overly specialized RecordLayoutDumper, just make -dump-record-layouts a bit that Sema honors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100747 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 02:59:56 +00:00
Daniel Dunbar bf9e48cbaa AST: Move C++ record layout dumping to ASTContext::DumpRecordLayout.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100746 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 02:59:49 +00:00
Daniel Dunbar 7f2896406c IRgen: Move the bit-field access type into CGBitFieldInfo, and change bit-field LValues to just store the base address of object containing the bit-field.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100745 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 02:59:45 +00:00
Fariborz Jahanian 4f4fd92c6c Patch to implement gcc's cstyle arguments in objc
methods. wip.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100734 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 00:30:06 +00:00
Chris Lattner d6f1906ffa refactor out a function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100733 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 00:23:06 +00:00
John McCall bb6fb465c7 Fix a (bogus) uninitialized-member-of-local warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100732 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 00:13:37 +00:00
Ted Kremenek d75fa6e1c0 Use SmallVector instead of an std::queue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100730 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 00:05:00 +00:00
Jeffrey Yasskin db88d8ad74 When a template (without arguments) is passed as a template type
parameter, explicitly ask the user to give it arguments.  We used to
complain that it wasn't a type and expect the user to figure it out.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100729 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 00:03:06 +00:00
Jeffrey Yasskin edc287751a Fix some redundant errors by changing CXXScopeSpec::isSet calls into
isNotEmpty calls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100722 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 23:29:58 +00:00
Chris Lattner 1e3c6f4ab5 update for api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100718 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 23:12:35 +00:00
Sean Hunt 216c278982 Implement checking for template literal operator functions. This
code won't actually get used yet because we don't handle non-type
parameter packs, but when we do, this code should jump in and work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100716 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 23:11:06 +00:00
Eric Christopher 19063cda59 Add support for stpncpy_chk.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100711 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 23:00:44 +00:00
Chris Lattner 83e7a78a9f rename llvm::llvm_report_error -> llvm::report_fatal_error
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100708 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 22:58:06 +00:00
Sean Hunt 30019c0621 Updated comment to reflect changes made in the most recent draft.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100707 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 22:57:35 +00:00
Sean Hunt c39f697624 Fixed 80-cols violation
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100704 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 22:52:07 +00:00
Chris Lattner 0f0c963f9b add a new driver-level -ferror-limit=412 option, which causes clang to stop
emitting diagnostics after it has produced that many errors.  Give this a
default value of 20 which produces plenty of errors for people to fix before
recompiling but not so many that their entire console scrolls away when the
compiler gets confused.  The experience looks like this:

$ clang foo.c
<tons of crap>
foo.c:102:3: error: unknown type name 'somethingbad'
  somethingbad x;
  ^
fatal error: too many errors emitted, stopping now
36 warnings and 20 errors generated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100689 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 20:49:23 +00:00
Chris Lattner c100214fdc add clang -cc1 level support for "-ferror-limit 42"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100687 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 20:37:06 +00:00
Douglas Gregor fc2ca56874 Return early from Sema::MarkDeclarationReferenced when we know there
isn't any extra work to perform. Also, don't check for unused
parameters when the warnings will be suppressed anyway. Improves
performance of -fsyntax-only on 403.gcc's combine.c by ~2.5%. 
<rdar://problem/7836787>



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 20:29:57 +00:00