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

35550 Коммитов

Автор SHA1 Сообщение Дата
Benjamin Kramer 5aed86caa0 -arch is a darwin-only feature, use -target instead to make the linux buildbots happy again.
Also check the error message.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152694 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-14 01:17:52 +00:00
Eric Christopher 167174518c Add support to mangle templated member function names with template
args.

Fixes rdar://11042577

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152691 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-14 00:25:46 +00:00
Chad Rosier 1cdbfd37d5 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152686 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 23:48:50 +00:00
Fariborz Jahanian 9648a9ee3b objective-c modern rewriter. Do not add _class_ro_t.reserved
field. // rdar://11040024



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152685 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 23:48:09 +00:00
Chad Rosier 4574c3d75e [driver] Clang should report an error for -faltivec on non-ppc.
rdar://10963572


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152684 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 23:45:51 +00:00
Eric Christopher 3b10cfe6b8 When adding member functions to a class add any specializations of
function templates as well.

A future commit will mangle the added name with the template args
like classes are mangled.

Fixes rdar://10986010

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152683 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 23:40:48 +00:00
David Blaikie e7591c5118 Add a test case for PR8385.
"struct{template struct{" would fail an assertion.

This assertion failure seems to have gone away somewhere along the line so
here's a test to make sure we don't regress. We still accept some very weird
explicit template 'instantiations' ("template int;", anyone) but at least we're
not asserting/crashing here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152681 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 23:33:06 +00:00
Anna Zaks 6cc0969ab3 [analyser] Refactor shouldInline logic into a helper.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152677 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 22:15:58 +00:00
Anna Zaks fc544e3d52 [analyzer] Call enter/exit diagnostic should refer to caller/callee,
respectively.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152676 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 22:15:55 +00:00
Daniel Dunbar 3054f097f8 [Basic] Fix up DiagnosticBuilder::{FlushCounts,Emit} to be inline.
- This is much more important than it appears at first glance...

The intended design of DiagnosticBuilder was that it never escape and that all
its members would get lowered to registers by the compiler. By fixing Emit here,
the compiler can completely eliminate the DiagnosticBuilder object and never
need to push those registers back into it.

Unfortunately, Sema has broken DiagnosticBuilder in other ways (by introducing
SemaDiagnosticBuilder), so we don't get the fill impact of this, but it is still
good for 30k reduction in code size. I'll work on fixing the
SemaDiagnosticBuilder problems next.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152669 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 21:02:14 +00:00
Richard Smith 4b1f684416 Allow vectors to be constructed from constexpr function arguments in
constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152665 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 20:58:32 +00:00
Chad Rosier cf3a6c448c Update test case to use not tool.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152664 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 20:31:40 +00:00
Chad Rosier 2dec85b218 [driver] Parse diagnostic args in the driver.
Previously, only diagnostics thrown by the cc1 process were
actually honoring the diagnostic options given on the command line,
like -Werror.

Reuse the existing code in Frontend currently used for cc1,
adjusting it to not interpret -Wl, linker flags as warnings.

Also fix a faulty test exposed by this change.
It wasn't actually testing anything, and was giving this warning:

clang-3: warning: argument unused during compilation: '-verify'

Which -Werror didn't turn into an error because it was output
by the driver, not the cc1 process, and diagnostic options
weren't parsed by the driver. And you couldn't see the warning
when running the test suite.

Fixes PR12181.
Patch by Dylan Noblesmith <nobled@dreamwidth.org>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152660 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 20:09:56 +00:00
Anna Zaks b990d039c7 [analyzer] Change the order in which we analyze the functions under
inlining to be the reverse of their declaration.

This optimizes running time under inlining up to 20% since we do not
re-analyze the utility functions which are usually defined first in the
translation unit if they have already been analyzed while inlined into
the root functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152653 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 19:32:19 +00:00
Anna Zaks 7fe8dcef71 [analyzer] Use BFS over call graph when analysing functions.
BFS should give slightly better performance. Ex: Suppose, we have two
roots R1 and R2. A callee function C is reachable through both. However,
C is not inlined when analyzing R1 due to inline stack depth limit. With
DFS, C will be analyzed as top level even though it would be analyzed as
inlined through R2. On the other hand, BFS could avoid analyzing C as
top level.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152652 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 19:32:13 +00:00
Anna Zaks a2e589e60d [analyzer] Refactor CallGraph to use Recursive AST visitor when
collecting function Decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152651 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 19:32:08 +00:00
Anna Zaks aa5609891d [analyzer] Use recursive AST visitor to drive simple visitation order in
AnalysisConsumer.

As a result:
 - We now analyze the C++ methods which are defined within the
class body. These were completely skipped before.

- Ensure that AST checkers are called on functions in the
order they are defined in the Translation unit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152650 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 19:32:00 +00:00
Anna Zaks 98520835eb [analyzer] Minor: factor out logic for determining if we should skip a
function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152649 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 19:31:54 +00:00
Anna Zaks b6ee44dd29 [analyzer] Move the check for parser errors out of the loop over Decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152648 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 19:31:47 +00:00
Roman Divacky efe9c0dffc Fix the long double to be of width/align 64. Rename va_list_test to
powerpc_types and add testing for the (long) double there.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152647 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 19:20:17 +00:00
Daniel Dunbar 00b43848e4 Spelling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152644 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 18:30:54 +00:00
Daniel Dunbar cefcbef6f3 [Basic] Make DiagnosticBuilder::{Clear,Emit} protected.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152643 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 18:30:50 +00:00
Daniel Dunbar 243d7abb0f [Basic] Eliminate DiagnosticBuilder::Suppress and matching ctor, this stuff is
not used anymore (good thing we are still paying for it!).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152642 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 18:30:46 +00:00
Daniel Dunbar 06265bd820 [Basic] Make DiagnosticBuilder::{isActive,getLocation,getDiagID} protected.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152641 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 18:30:42 +00:00
Daniel Dunbar 53c83b3255 [Basic] Fix ~Diagnostic() to not call Emit() when there is no diag obj (most
commonly when the diag has been copied).
 - This eliminates a completely spurious call to Emit() which was in
   Sema::Diag(). Sob.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152640 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 18:30:38 +00:00
Daniel Dunbar 981e279b95 [Basic] Stop using a SmallVector<> for Diagnostic. This drops Clang binary size
by ~%.3/~100k in my build -- simply by eliminating the horrible code bloat coming
from the .clear() of the SmallVector<FixItHint>, which does a std::~string, etc.
 - My understanding is we don't ever emit arbitrary numbers of fixits, so I just
   moved us to using a statically sized array like we do for arguments and
   ranges.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152639 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 18:21:17 +00:00
Benjamin Kramer bea6c0a2e7 Remove unused-but-set variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152633 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 17:05:43 +00:00
Roman Divacky e3d175da72 Long double is just double on FreeBSD/{PPC,PPC64}.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152632 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 16:53:54 +00:00
David Chisnall e6dd683d99 Tweak linkage order for solaris.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152627 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 14:14:54 +00:00
James Molloy 9cda03ff7f Ensure that default arguments are handled correctly in sub scopes. For example:
void f () {
  int g (int a, int b=4);
  {
    int g(int a, int b=5);
  }
}

should compile.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152621 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 08:55:35 +00:00
Richard Smith e37f484ab9 Implement [temp.param]p5: the top-level cv-qualifiers on a non-type template
parameter's declaration are ignored when determining the parameter's type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152619 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 07:21:50 +00:00
Richard Smith 7c5d28b634 PR11850 + duplicates: don't assume that a function parameter pack expansion is
at the end of the parameter list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152618 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 06:56:52 +00:00
Richard Smith b03a9df681 PR11925: A function can't have a variably-modified return type. Not even in C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152615 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 05:56:40 +00:00
Nick Lewycky 65daef1797 It never makes sense to do a lookup into a LinkageSpecDecl, so assert that we
don't, and clean up the places that do it.

The change to ASTWriter is surprising, but the deleted code is a no-op as of
r152608.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152609 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 04:12:34 +00:00
Richard Smith 1b7f9cbed1 Fix PR10447: lazily building name lookup tables for DeclContexts was broken.
The deferred lookup table building step couldn't accurately tell which Decls
should be included in the lookup table, and consequently built different tables
in some cases.

Fix this by removing lazy building of DeclContext name lookup tables. In
practice, the laziness was frequently not worthwhile in C++, because we
performed lookup into most DeclContexts. In C, it had a bit more value,
since there is no qualified lookup.

In the place of lazy lookup table building, we simply don't build lookup tables
for function DeclContexts at all. Such name lookup tables are not useful, since
they don't capture the scoping information required to correctly perform name
lookup in a function scope.

The resulting performance delta is within the noise on my testing, but appears
to be a very slight win for C++ and a very slight loss for C. The C performance
can probably be recovered (if it is a measurable problem) by avoiding building
the lookup table for the translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152608 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 03:12:56 +00:00
Argyrios Kyrtzidis 4bd265468c [libclang] When there's a file error when saving the PCH, make sure to
clear the error from raw_fd_ostream, otherwise we will crash.

rdar://10976410

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152605 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 02:17:06 +00:00
John McCall 23dde82d90 Make the error about assigning to lambda-captured variables
clearer, and mention the existence of mutable lambdas.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152598 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 01:10:51 +00:00
Argyrios Kyrtzidis a5f4441de7 [Sema] Prefer to use ObjCInterfaceDecl's protocol_begin()/protocol_end() iterators instead of
ObjCInterfaceDecl::getReferencedProtocols(), because the iterators are safe to use
even if the caller did not check that the interface is a definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152597 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 01:09:41 +00:00
Argyrios Kyrtzidis cd707abbc7 Fix crash at @implementation with a forward reference as base class.
rdar://11020003

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152596 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 01:09:36 +00:00
John McCall 78dae24600 Alternate fix to PR12248: put Sema in charge of special-casing
the diagnostic for assigning to a copied block capture.  This has
the pleasant side-effect of letting us special-case the diagnostic
for assigning to a copied lambda capture as well, without introducing
a new non-modifiable enumerator for it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152593 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 00:37:01 +00:00
NAKAMURA Takumi 8ce6d214ae [msvc] Honor %INCLUDE%. It should know essential search paths with vcvarsall.bat.
FYI,

On VS10, %INCLUDE% contains;
(VS10)\VC\INCLUDE
(VS10)\VC\ATLMFC\INCLUDE
(SDK70A)\include

On VS11,
(VS11)\VC\INCLUDE
(VS11)\VC\ATLMFC\INCLUDE
(SDK80)\include\shared
(SDK80)\include\um
(SDK80)\include\winrt

FIXME: It may be enabled also on mingw.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152589 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 00:02:21 +00:00
Fariborz Jahanian c38503b4c1 modern objective-c translator. @try/@catch translation. wip.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152587 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 23:58:28 +00:00
Ted Kremenek 29af3c7425 Add new analyzer diagnostic mode where plists can have bugs that span multiple files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152586 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 23:14:53 +00:00
Ted Kremenek e881efe785 [analyzer] Include inlining call stack depth in plist output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152584 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 22:10:57 +00:00
Bill Wendling 3d7171582b Address some of the concerns by Chandler.
* s/AddDirectoryList/addDirectoryList/
* Move the call to ::getenv into the function.
* FileCheck-ize the testcase.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152583 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 22:10:06 +00:00
Bill Wendling e8cb554c36 Update FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152579 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 21:24:57 +00:00
Bill Wendling bdb8f3ce95 Have clang pay attention to the LIBRARY_PATH environment variable.
The LIBRARY_PATH environment variable should be honored by clang. Have the
driver pass the directories to the linker.
<rdar://problem/9743567> and PR10296.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152578 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 21:22:35 +00:00
Douglas Gregor 860d9b780b C++11 [temp.deduct.call]p6 tweak: when given a set of overlaoded
functions that includes an explicit template argument list, perform
an inner deduction against each of the function templates in that list
and, if successful, use the result of that deduction for the outer
template argument deduction. Fixes PR11713.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152575 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 21:09:16 +00:00
Eli Friedman 71930e0273 Make sure we treat variables captured by reference in lambda as modifiable lvalues. Regression from r152491. Fixes PR12248.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152573 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 20:57:19 +00:00
Argyrios Kyrtzidis 9a0b6b4e2b [Sema] -Add an invalid objc category to the DeclContext so that it can be
serialized
-Don't add methods of invalid objc containers to the global method pool.
 This protects us from trying to serialize a method whose container was not
 serialized.

Part of rdar://11007039.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152566 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 18:34:26 +00:00