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

24655 Коммитов

Автор SHA1 Сообщение Дата
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 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
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
Jordy Rose d8b5ca1427 ObjCBoolLiterals (__objc_yes/__objc_no) behave like C++ booleans (true/false). They are NOT objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152564 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 17:53:02 +00:00
Fariborz Jahanian 40a777a157 objective-c modern translator: ivar offset symbols
will reside in .objc_ivar$B sections. // rdar://11023490



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152563 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 16:46:58 +00:00
David Blaikie 6f42669b7c Fix a crash-on-invalid found by -Wlogical-op-parentheses.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152559 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 15:39:49 +00:00
James Molloy e45b9b71b9 Use ZeroLengthBitfieldAlignment for AAPCS, as well as APCS-GNU.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152552 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 09:14:10 +00:00
Richard Smith 7796eb5643 Fix parsing of trailing-return-type. Types are syntactically prohibited from
being defined here: [] () -> struct S {} does not define struct S.

In passing, implement DR1318 (syntactic disambiguation of 'final').


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152551 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 08:56:40 +00:00
Richard Smith 69730c115c Fix parsing of type-specifier-seq's. Types are syntactically allowed to be
defined here, but not semantically, so

  new struct S {};

is always ill-formed, even if there is a struct S in scope.

We also had a couple of bugs in ParseOptionalTypeSpecifier caused by it being
under-loved (due to it only being used in a few places) so merge it into
ParseDeclarationSpecifiers with a new DeclSpecContext. To avoid regressing, this
required improving ParseDeclarationSpecifiers' diagnostics in some cases. This
also required teaching ParseSpecifierQualifierList about constexpr... which
incidentally fixes an issue where we'd allow the constexpr specifier in other
bad places.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152549 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-12 07:56:15 +00:00
Nick Lewycky 0be8fb5bdf Fix typo in comment, 'langauge' -> 'language'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152547 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11 23:14:21 +00:00
Fariborz Jahanian 1ca052c098 objective-c modern abi rewriter: provide section pragmas for
statically writter metadata.
// rdar://11023490



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152546 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11 19:41:56 +00:00
David Blaikie 4e4d08403c Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).
The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11 07:00:24 +00:00
Stepan Dyatkovskiy 7c02cfeb08 llvm::SwitchInst
Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default.
Added some notes relative to case iterators.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152533 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11 06:09:37 +00:00
Douglas Gregor 93a7067302 Document the availability attribute
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152531 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11 04:53:21 +00:00
Douglas Gregor fc55a8290a When template argument deduction is ignoring qualifiers, perform deep
structural comparison of non-dependent types. Otherwise, we end up
rejecting cases where the non-dependent types don't match due to
qualifiers in, e.g., a pointee type. Fixes PR12132.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152529 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11 03:29:50 +00:00
Douglas Gregor 8e55ed1ad3 Add a missing 'template' keyword.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152526 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11 02:23:56 +00:00
Jordy Rose 3e67814381 [analyzer] Replace a static helper with existing logic. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152521 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11 00:08:24 +00:00
Douglas Gregor 5a7a5bb209 When determining whether an identifier followed by a '<' in a member
access expression is the start of a template-id, ignore function
templates found in the context of the entire postfix-expression. Fixes
PR11856.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152520 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 23:52:41 +00:00
David Blaikie 426d6ca163 Fix crash & accepts-invalid for array of arrays of user defined type.
Test case/other help by Richard Smith.
Code review by John McCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152519 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 23:40:02 +00:00
Aaron Ballman 5b31d55ab3 No longer defining GNUC mode when compiling for Microsoft compatibility. This allows people's cross-platform compiler-specific macros to work properly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152512 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 22:21:14 +00:00
Richard Smith e5658f0ab2 PR12225: The requirement that literal operators be namespace-scope functions
does not imply that such functions can't be declared at block scope.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152509 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 22:18:57 +00:00
Benjamin Kramer 09c9a5635f Use VersionTuple to manage macosx versions in the driver. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152504 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 20:55:36 +00:00
Benjamin Kramer 4e494cf563 Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152503 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 20:38:56 +00:00
Fariborz Jahanian ce0d89744b objective-c modern rewriter: add __declspec(dllexport) to forward
declaration of class metadata when they are defined later.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152500 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 18:25:06 +00:00
Fariborz Jahanian 6991bc5a45 objc modern rewriter: Define __OBJC2__ in written file.
// rdar://11024543



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152496 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 17:45:38 +00:00
Benjamin Kramer 9b20a90dff Replace a map of boolean values with a set.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152494 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 15:08:09 +00:00
Rafael Espindola 2f47c366bc The type of a definition should not increase its visibility. Fixes PR12221.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152493 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 13:01:40 +00:00
John McCall f4b88a4590 Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr to
track whether the referenced declaration comes from an enclosing
local context.  I'm amenable to suggestions about the exact meaning
of this bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152491 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 09:33:50 +00:00
Nick Lewycky 1659c3758b Slightly tweak this condition. "isTransparentContext()" was checking whether an
enum is scoped or not, which is not relevant here. Instead, phrase the loop in
the same terms that the standard uses, instead of this awkward set of
conditions that is *nearly* equal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152489 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 07:47:07 +00:00
Nick Lewycky 8d17681906 Could not find this in C99. Perhaps this rule comes from a DR, but in any case
please annotate it with a note explaining why this wrong-seeming behaviour is
correct.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152488 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 07:45:33 +00:00
Douglas Gregor f52757d63f Only make a call to a copy constructor elidable if in fact we are
doing a copy. Fixes PR12139.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152485 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 06:53:13 +00:00
Argyrios Kyrtzidis a346efaaad [Sema] A tag decl that is marked as invalid and is used in a decl-spec,
should not impede creating a proper TypeLoc info for the decl-spec.

This improves our semantic error recovery.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152481 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 03:20:58 +00:00
John McCall dd2ecee313 Unify the BlockDeclRefExpr and DeclRefExpr paths so that
we correctly emit loads of BlockDeclRefExprs even when they
don't qualify as ODR-uses.  I think I'm adequately convinced
that BlockDeclRefExpr can die.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152479 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 03:05:10 +00:00
John McCall 89da8cf16b Fix the dumping of BlockExprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152478 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 03:04:55 +00:00
Benjamin Kramer 79a55010ed Fix a use of the C99 PRI format macros not to conflict with C++11 UDLs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152475 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 02:06:27 +00:00
Eli Friedman 540659e102 Make sure the accessors for overridden methods don't return inherited constructors. Fixes PR12219.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152470 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 01:39:01 +00:00
Fariborz Jahanian 117591f624 objc modern rewriter: don't export @package ivar symbols.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152469 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 01:34:42 +00:00
Ted Kremenek 337e4dbc68 [analyzer] fix regression in analyzer of NOT actually aborting on Stmts it doesn't understand. We registered
as aborted, but didn't treat such cases as sinks in the ExplodedGraph.

Along the way, add basic support for CXXCatchStmt, expanding the set of code we actually analyze (hopefully correctly).

Fixes: <rdar://problem/10892489>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152468 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 01:34:17 +00:00
Daniel Dunbar edfac03024 IRgen/ABI/x86_64: Avoid passing small structs using byval sometimes.
- We do this when it is easy to determine that the backend will pass them on
   the stack properly by itself.

Currently LLVM codegen is really bad in some cases with byval, for example, on
the test case here (which is derived from Sema code, which likes to pass
SourceLocations around)::

  struct s47 { unsigned a; };
  void f47(int,int,int,int,int,int,struct s47);
  void test47(int a, struct s47 b) { f47(a, a, a, a, a, a, b); }

we used to emit code like this::

  ...
  movl	%esi, -8(%rbp)
  movl	-8(%rbp), %ecx
  movl	%ecx, (%rsp)
  ...

to handle moving the struct onto the stack, which is just appalling.

Now we generate::

  movl	%esi, (%rsp)

which seems better, no?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152462 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 01:03:58 +00:00
Fariborz Jahanian d1c84d3c02 Minor change to my last rewrite patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152461 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 00:53:02 +00:00
Fariborz Jahanian e57303c8ce objc modern rewriter: Mark class and ivar definitions with __declspec(dllexport)
// rdar://11023563


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152459 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 00:39:34 +00:00
Douglas Gregor db762ef262 Qualifiers on a canonical array type go on the outermost type, not the
innermost type. Fixes PR12142.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152456 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 00:29:33 +00:00
Richard Smith 0069b84c2a Assign APValues by swapping from a temporary. Removes a bunch of unnecessary
copy-construction, which Daniel Dunbar reports as giving a 0.75% speedup on
403.gcc/combine.c. The performance differences on my constexpr torture tests
are below the noise floor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152455 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 00:28:11 +00:00
Fariborz Jahanian 97c1fd651c objective-c modern rewriter. More fixes related to rewriting
ivars in the modern rewriter.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152451 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 23:46:23 +00:00
Ted Kremenek 7acf23f03e Teach RetainCountChecker about mixing method families with explicit annotations. Fixes <rdar://problem/10824732>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152448 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 23:34:08 +00:00
Richard Smith 26b75c0731 Improve diagnostics for UCNs referring to control characters and members of the
basic source character set in C++98. Add -Wc++98-compat diagnostics for same in
literals in C++11. Extend such support to cover string literals as well as
character literals, and mark N2170 as done.

This seems too minor to warrant a release note to me. Let me know if you disagree.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152444 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 22:27:51 +00:00
Daniel Dunbar e7d6ca079a [Sema] Fix a diag change to include a range that appeared intended, but never
actually happened.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152442 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 21:38:22 +00:00
Nico Weber df423545a1 Update comment after r152140. Clarify a bit too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152441 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 21:19:44 +00:00
Anna Zaks 3fd5f370a2 [analyzer] Add support for NoRedundancy inlining mode.
We do not reanalyze a function, which has already been analyzed as an
inlined callee. As per PRELIMINARY testing, this gives over
50% run time reduction on some benchmarks without decreasing of the
number of bugs found.

Turning the mode on by default.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152440 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 21:14:01 +00:00
Anna Zaks a5d531f67d CallGraph: Add getNode() method, constify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152439 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 21:13:53 +00:00
Argyrios Kyrtzidis ba50b3e8bc Allow serializing an invalid ParmVarDecl and don't set access to public for
invalid ParmVarDecls.

Part of rdar://11007039.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152437 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 21:09:04 +00:00
Argyrios Kyrtzidis 216f78b733 Improve our semantic error recovery.
When an error made a record member invalid, the record would stay as "isBeingDefined" and
not "completeDefinition". Even easily recoverable errors ended up propagating records in
such "beingDefined" state, for example:

struct A {
  ~A() const; // expected-error {{'const' qualifier is not allowed on a destructor}}
};
struct B : A {}; // A & B would stay as "not complete definition" and "being defined".

This weird state was impending lookups in the records and hitting assertion in the ASTWriter.

Part of rdar://11007039

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152432 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 20:10:30 +00:00
Daniel Dunbar 780249b1a3 [Sema] Remove dead getSourceRange() call, caught by Clang after marking
LLVM_READONLY.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152428 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 20:02:47 +00:00
Fariborz Jahanian 509fb3e2cd lldb support: under debugger support flag, when sending message
to forward class, and assigning to an 'id' type var, message
sends default to 'id'. // rdar"//10988847



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152420 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 18:47:16 +00:00
Daniel Dunbar 96a0014f9b [AST/Sema/libclang] Replace getSourceRange().getBegin() with getLocStart().
- getSourceRange().getBegin() is about as awesome a pattern as .copy().size().

I already killed the hot paths so this doesn't seem to impact performance on my
tests-of-the-day, but it is a much more sensible (and shorter) pattern.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152419 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 18:35:03 +00:00
Daniel Dunbar 8fbc6d23d6 [AST] Define a few more key getLocStart() implementations.
- This cuts the # of getSourceRange calls by 60% on
   OGF/NSBezierPath-OAExtensions.m.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152412 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 15:39:24 +00:00
Daniel Dunbar 90e25a8b2c [AST] Reimplement Stmt::getLoc{Start,End} to dispatch to subclass overloads.
- getSourceRange() can be very expensive, we should try to avoid it if at all possible.

In conjunction with the previous commit I measured a ~2% speedup on 403.gcc/combine.c and a 3% speedup on OmniGroupFrameworks/NSBezierPath-OAExtensions.m.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152411 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 15:39:19 +00:00
Daniel Dunbar 396ec676b7 [AST] Add {DeclRefExpr,MemberExpr,ImplicitCastExpr}::{getLocStart,getLocEnd} methods.
- There are probably a lot more of these worth adding, but these are a start at hitting some of the exprs for which getSourceRange().getBegin() is a poor substitute for getLocStart().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152410 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 15:39:15 +00:00
Daniel Dunbar 7b14026640 [Basic] Rename LangOptions::NoInline to NoInlineDefine, to make things a bit
more obvious.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152408 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 15:39:08 +00:00
Hans Wennborg f856264531 -Wformat-non-iso: warn about positional arguments (pr12017)
This renames the -Wformat-non-standard flag to -Wformat-non-iso,
rewords the current warnings a bit (pointing out that a format string
is not supported by ISO C rather than being "non standard"),
and adds a warning about positional arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152403 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 10:10:54 +00:00
Richard Smith ef9f29804f Fix statement printing for raw and template user-defined literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152401 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 10:10:02 +00:00
Richard Smith 9c1dda7d7b User-defined literals are done.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152396 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 08:41:27 +00:00
Richard Smith 3a5032b89d Literal operator suffixes and regular names live in separate namespaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152395 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 08:37:16 +00:00
Richard Smith a9e88b2549 Literal operators can't have default arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152394 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 08:16:22 +00:00
Richard Smith 36f5cfe4df Support for raw and template forms of numeric user-defined literals,
and lots of tidying up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152392 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 08:00:36 +00:00
Daniel Dunbar bc5419a2ed [AST] Memoize ASTContext::getTypeInfo().
- On -emit-llvm-only of 403.gcc/combine.c, for example, we make 160k calls to
   getTypeInfo but only ever deal with 680 some distinct types.

I saw these speedups (user time):
  403.gcc/combine.c -- 3.1%
  OmniGroupFrameworks/NSBezierPath-OAExtensions.m -- 3.6%
  JavaScriptCore/Interpreter.cpp -- 1.4%
which seems pretty sweet.

I ran some histograms on those compiles and we end up doing a ton of
getTypeInfo() on 'char' and 'int'. I tried splitting out a fast path for builtin
types, but this wasn't a win. Still kinda seems like we could be doing better
here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152377 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 04:12:54 +00:00
John McCall 5aba3eb1be Perform l2r conversions on delete operands before doing
type-analysis;  otherwise, we just completely do the
wrong thing for placeholders.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152375 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 04:08:29 +00:00
Eli Friedman 71cba34b6e Make sure we update the static local decl address map when we are forced to rebuild a global because of the initializer. <rdar://problem/10957867>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152372 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 03:27:46 +00:00
Eli Friedman 8b42ab718d Make sure constant emission handles initializer lists with strings correctly. Part of <rdar://problem/10957867>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152370 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 03:06:56 +00:00
Daniel Dunbar 42f42c8c58 [AST] NestedNameSpecifier's ctor/dtor are trivial and should be inlined.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152365 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 01:51:59 +00:00
Daniel Dunbar cd485926f1 [AST] Type::isVoidType() is trivial and should be inlined.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152364 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 01:51:56 +00:00
Daniel Dunbar 3d13c5a1e7 [AST] Reduce Decl::getASTContext() calls.
- This function is not at all free; pass it around along some hot paths instead
   of recomputing it deep inside various VarDecl methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152363 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 01:51:51 +00:00
Ted Kremenek 76aadc346c [analyzer] Implement basic path diagnostic pruning based on "interesting" symbols and regions.
Essentially, a bug centers around a story for various symbols and regions.  We should only include
the path diagnostic events that relate to those symbols and regions.

The pruning is done by associating a set of interesting symbols and regions with a BugReporter, which
can be modified at BugReport creation or by BugReporterVisitors.

This patch reduces the diagnostics emitted in several of our test cases.  I've vetted these as
having desired behavior.  The only regression is a missing null check diagnostic for the return
value of realloc() in test/Analysis/malloc-plist.c.  This will require some investigation to fix,
and I have added a FIXME to the test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152361 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 01:13:14 +00:00
Anna Zaks d95e0b830e [analyzer] Use call graph to determine order in which functions are
analyzed.

The CallGraph is used when inlining is on, which is the current default.

This alone does not bring any performance improvement. It's a
stepping stone for the upcoming optimization in which we do not
re-analyze a function that has already been analyzed while inlined in
other functions. Using the call graph makes it easier to play with
the order of functions to minimize redundant analyzes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152352 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 23:16:38 +00:00
Anna Zaks 6625335213 [analyzer] Rework inlining related command line options.
- Remove -analyzer-inline-call.
 - Add -analyzer-ipa=[none|inlining]
 - Add -analyzer-inlining-mode to allow experimentation for
different performance tuning methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152351 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 23:16:35 +00:00
Anna Zaks d277661370 Call Graph: Only the root node is allowed to have an invalid Decl*.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152350 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 23:16:26 +00:00
Richard Smith 3376277570 Fix a couple of issues with literal-operator-id parsing, and provide recovery
for a few kinds of error. Specifically:

Since we're after translation phase 6, the "" token might be formed by multiple
source-level string literals. Checking the token width is not a correct way of
detecting empty string literals, due to escaped newlines. Diagnose and recover
from a missing space between "" and suffix, and from string literals other than
"", which are followed by a suffix.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152348 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 23:06:02 +00:00
John McCall 1e5bc4ffb2 Don't crash when a statement in a block is ill-formed but
introduces cleanups anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152345 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 22:00:17 +00:00
Richard Smith 49d517467c When checking the encoding of an 8-bit string literal, don't just check the
first codepoint! Also, don't reject empty raw string literals for spurious
"encoding" issues. Also, don't rely on undefined behavior in ConvertUTF.c.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152344 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 21:59:28 +00:00
Sebastian Redl 188158db29 Turn explicit construction of temporaries using initializer list syntax into CXXTemporaryObjectExprs, not just CXXConstructExprs, which have a worrying tendency to vanish. Fixes PR12167.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152340 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 21:05:45 +00:00
Benjamin Kramer 56757e9eaf Untangle getUnderlyingDeclImpl, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152339 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 21:00:45 +00:00
Daniel Dunbar a50a5cd9db Remove stray semi-colon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152331 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 20:28:59 +00:00
Daniel Dunbar 7a8c758868 [AST] APValue: Split the fast path of MakeUninit to be inline.
- This change seems to be a tiny loss on 403.gcc/combine.c (.2%), but I think
   it is the right thing to do.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152330 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 20:28:55 +00:00
Daniel Dunbar 6daffa5d60 [AST] Change NamedDecl::getUnderlyingDecl() to inline the fast (and incredibly common) path.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152321 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 18:20:41 +00:00
Rafael Espindola 025039377d Replace MarkVarRequired with a more generic
HandleCXXStaticMemberVarInstantiation. Suggested by Argyrios.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152320 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 15:51:03 +00:00
Rafael Espindola 701ec8d110 Implement -fno-dwarf2-cfi-asm on linux too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152316 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 14:39:55 +00:00
Richard Smith 916883004c Ensure we don't print 123ULL_foo when printing a user-defined integer literal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152303 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 09:02:38 +00:00
Richard Smith b453ad3214 Add support for cooked forms of user-defined-integer-literal and
user-defined-floating-literal. Support for raw forms of these literals
to follow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152302 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 08:45:32 +00:00
Stepan Dyatkovskiy aae1d8bd6f Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html

Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*".

ConstCaseIt is just a read-only iterator.
CaseIt is read-write iterator; it allows to change case successor and case value.

Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters.

Main way of iterator usage looks like this:
SwitchInst *SI = ... // intialize it somehow

for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) {
  BasicBlock *BB = i.getCaseSuccessor();
  ConstantInt *V = i.getCaseValue();
  // Do something.
}

If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method.
If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method.

There are also related changes in llvm-clients: klee and clang.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152298 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 07:06:48 +00:00
Daniel Dunbar 76e035a529 [AST] Change Type::isIntegerType to be inlined(). It is very popular.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152289 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 02:52:18 +00:00
Richard Smith 2fb4ae3682 Implement C++11 [lex.ext]p10 for string and character literals: a ud-suffix not
starting with an underscore is ill-formed.

Since this rule rejects programs that were using <inttypes.h>'s macros, recover
from this error by treating the ud-suffix as a separate preprocessing-token,
with a DefaultError ExtWarn. The approach of treating such cases as two tokens
is under discussion for standardization, but is in any case a conforming
extension and allows existing codebases to keep building while the committee
makes up its mind.

Reword the warning on the definition of literal operators not starting with
underscores (which are, strangely, legal) to more explicitly state that such
operators can't be called by literals. Remove the special-case diagnostic for
hexfloats, since it was both triggering in the wrong cases and incorrect.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152287 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 02:39:21 +00:00
Douglas Gregor 5bc37f6e0c Loosen the precondition of isCXXInstanceMember() to simply return
"false" for declarations that aren't members of classes. Fixes PR12106.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152284 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 02:08:05 +00:00
Daniel Dunbar c2bd73bba5 Sema: Don't emit a gajillion calls to sanity() -- an empty function -- in NDEBUG
builds. Sheesh.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152279 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 01:43:06 +00:00
Richard Smith dd66be718f User-defined literal support for character literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152277 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 01:34:56 +00:00
Richard Trieu ffea6b4560 Fix -Wuninitialized to catch the case of a class being initialized with a call
to its own member function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152276 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 01:15:31 +00:00
Argyrios Kyrtzidis 29f98b40ca [libclang] Fix a crash when serializing a preprocessing record that contains
an #include entry that did not resolve to header file.

Part of rdar://11007039

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152275 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 01:08:28 +00:00
Douglas Gregor d78ef5b941 Streamline BalancedDelimiterTracker, by eliminating the duplicate
paren/brace/bracket tracking (the Consume* functions already did it),
removing the use of ConsumeAnyToken(), and moving the hot paths inline
with the error paths out-of-line.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152274 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 01:00:17 +00:00
Anna Zaks 196b8cfe9c Add a basic CallGraph to Analysis.
The final graph contains a single root node, which is a parent of all externally available functions(and 'main'). As well as a list of Parentless/Unreachable functions, which are either truly unreachable or are unreachable due to our analyses imprecision.

The analyzer checkers debug.DumpCallGraph or debug.ViewGraph can be used to look at the produced graph.

Currently, the graph is not very precise, for example, it entirely skips edges resulted from ObjC method calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152272 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 00:42:23 +00:00
Fariborz Jahanian a34194f035 improve on diagnostic and provide a fixit hint when
an uninitialized block variable is being called inside the
block literal. // rdar://10817031


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152271 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 00:22:50 +00:00
Bob Wilson e286d9b8b1 Workaround module test failures by removing the version info from module hashes.
PR12196: The module hash strings are not actually hashing the compiler version
string; the entire version string is being included in the hash.  Depending on
the module cache directory name, that can lead to failures where the path
names become too long.  As a temporary workaround, just remove the version
string from the hash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152266 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 23:50:05 +00:00
Sebastian Redl cbf82092cd Be smarter in discovering list-initialization of temporaries. Fixes PR12182.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152231 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 16:10:45 +00:00
Richard Smith 9fcce65e7e AST representation for user-defined literals, plus just enough of semantic
analysis to make the AST representation testable. They are represented by a
new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic
properties, including full CodeGen support, are achieved for free by this
representation.

UserDefinedLiterals can never be dependent, so no custom instantiation
behavior is required. They are mangled as if they were direct calls to the
underlying literal operator. This matches g++'s apparent behavior (but not its
actual mangling, which is broken for literal-operator-ids).

User-defined *string* literals are now fully-operational, but the semantic
analysis is quite hacky and needs more work. No other forms of user-defined
literal are created yet, but the AST support for them is present.

This patch committed after midnight because we had already hit the quota for
new kinds of literal yesterday.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152211 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 08:35:16 +00:00
Richard Smith e816c717d4 Add -Wc++11-compat warning for string and character literals followed by
identifiers, in cases where those identifiers would be treated as
user-defined literal suffixes in C++11.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152198 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 03:13:00 +00:00
Richard Smith 946e2726f9 Don't even try to directly emit the value of a DeclRefExpr if that declaration
is not usable in a constant expression. ~2.5% speedup on 403.gcc / combine.c.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152193 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 01:58:44 +00:00
Argyrios Kyrtzidis bef35c91b5 [PCH] Mark a PCH file with a flag to indicate if the serialized AST had
compiler errors or not.

-Control whether ASTReader should reject such a PCH by a boolean flag at ASTReader's creation time.
By default, such a PCH file will be rejected with an error when trying to load it.

[libclang] Allow clang_saveTranslationUnit to create a PCH file even if compiler errors
occurred.
-Have libclang API calls accept a PCH that had compiler errors.

The general idea is that we want libclang to stay functional even if a PCH had a compiler error.
rdar://10976363.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152192 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 01:51:17 +00:00
Eli Friedman 9e9c454b12 Make sure we consistently canonicalize types when canonicalizing TemplateTemplateParmDecls. PR12179.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152189 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 01:09:33 +00:00
Fariborz Jahanian 458a7fbe73 objective-c lldb support: don't perform ivar access control check
when debugging. // rdar://10997647


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152187 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 00:58:41 +00:00
Andrew Trick fddfbdbf14 More git-svn compatible version string, by request.
If you're using git-svn, the clang and llvm repository will typically
map to a different revision.

Before we had:
clang version 3.1 (trunk 152167 trunk 152162)

After this change:
clang version 3.1 (trunk 152167) (llvm/trunk 152162)

So it's self-descriptive with an extra parens group. Which is more
compatible with version string parsers is probably debatable, but this
style was requested.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152183 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 00:44:24 +00:00
Richard Smith 485ea8e8ea The constant folder's diagnosic mechanism is irrelevant for C; don't bother
producing a C-only diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152181 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 00:30:44 +00:00
Chad Rosier 8ba9a6244c [driver] Don't try to generate diagnostic information for linker crashes.
rdar://10993648



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152180 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 00:30:40 +00:00
Benjamin Kramer 8b8d9534f1 Silence unused variable warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152170 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 00:14:40 +00:00
Michael Han e53ac8aea2 Refactor Clang sema attribute handling.
This submission improves Clang sema handling by using Clang tablegen
to generate common boilerplate code. As a start, it implements AttributeList
enumerator generation and case statements for AttributeList::getKind.

A new field "SemaHandler" is introduced in Attr.td and by default set to 1
as most of attributes in Attr.td have semantic checking in Sema. For a small
number of attributes that don't appear in Sema, the value is set to 0.

Also there are a small number of attributes that only appear in Sema but not
in Attr.td. Currently these attributes are still hardcoded in Sema AttributeList.

Reviewed by Delesley Hutchins.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152169 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 00:12:16 +00:00
Daniel Dunbar 047da195ae [AST] VarDecl::hasDefinition() - Early exit if we find a strong definition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152166 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 23:52:46 +00:00
Daniel Dunbar 60d302a707 [AST] FunctionDecl::getBuiltinID() - Eliminate spurious calls to getASTContext
-- which is very much not free -- in the common case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152165 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 23:52:37 +00:00
Ted Kremenek 8e282c332f Fix horrific CFG bug where '@autoreleasepool' would be put in a dangling block in the CFG.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152163 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 23:40:47 +00:00
Chad Rosier 53cb2b4759 Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152159 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 23:14:35 +00:00
Sean Callanan ba66c6c5eb Cleanup (style). Thanks to Argyrios for catching
this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152158 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 23:12:57 +00:00
NAKAMURA Takumi 00fd5ddc26 CMake: Fix build to add clangEdit to USED_LIBS.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152154 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 22:32:32 +00:00
Sean Callanan ce9c8319f4 Extended the UnknownAnyTy resolver to handle
blocks with unknown return types.  This allows
LLDB to call blocks even when their return types
aren't provided in the debug information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152147 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 21:34:12 +00:00
Chad Rosier 634a4b1b04 [driver] What was implemented in r152130 was actually -fno-inline-functions, not
-fno-inline.
Part of rdar://10972766


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152145 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 21:17:19 +00:00
Ted Kremenek 30660a8985 Add new code migrator support for migrating existing Objective-C code to use
the new Objective-C NSArray/NSDictionary/NSNumber literal syntax.

This introduces a new library, libEdit, which provides a new way to support
migration of code that improves on the original ARC migrator.  We now believe
that most of its functionality can be refactored into the existing libraries,
and thus this new library may shortly disappear.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152141 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 20:06:33 +00:00
Ted Kremenek 2a253960f0 Enable default @synthesize by default.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152140 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 20:06:15 +00:00
Ted Kremenek 1a45a5ff5d Add static analyzer support for new NSArray/NSDictionary/NSNumber literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152139 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 20:06:12 +00:00
Ted Kremenek ebcb57a8d2 Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,
NSNumber, and boolean literals.  This includes both Sema and Codegen support.
Included is also support for new Objective-C container subscripting.

My apologies for the large patch.  It was very difficult to break apart.
The patch introduces changes to the driver as well to cause clang to link
in additional runtime support when needed to support the new language features.

Docs are forthcoming to document the implementation and behavior of these features.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152137 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 20:05:56 +00:00
Chad Rosier 250008b467 [driver] Add support for -fno-inline.
rdar://10972766


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152130 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 18:49:20 +00:00
Fariborz Jahanian 27949f65b0 Undo patch for // rdar://10735698
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152128 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 18:41:35 +00:00
Daniel Dunbar f9aa3635fc AST: Move several Type::is...Type() functions to be inline.
- These functions are both (a) very commonly called and (b) excellent
   candidates for CSE in the callers in which they are commonly used.
 - That isHalfType() is hot makes me sad, but it is trivially when inlined (and
   a huge waste of time when not!!!).
 - The extra IsEnumDeclComplete() function is a hack to break the cycle between
   Type.h and Decl.h, I'm not sure of how to do this more cleanly, but am open
   to ideas.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152126 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 18:20:20 +00:00
Fariborz Jahanian 9a2105bc79 objective-c modern translator. Don't ignore unnamed bitfields
when rewriting.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152123 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 17:16:27 +00:00
Richard Smith 99831e4677 User-defined literals: reject string and character UDLs in all places where the
grammar requires a string-literal and not a user-defined-string-literal. The
two constructs are still represented by the same TokenKind, in order to prevent
a combinatorial explosion of different kinds of token. A flag on Token tracks
whether a ud-suffix is present, in order to prevent clients from needing to look
at the token's spelling.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152098 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 03:21:47 +00:00
Argyrios Kyrtzidis c1b0f7fa9b Use TinyPtrVector instead of UsuallyTinyPtrVector.
The latter is just a worse version of the former.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152096 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 03:00:11 +00:00
Ted Kremenek 097ebb3d8c [analyzer] add a diagnostic event when entering a call via inlining, within the callee, and add an edge.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152086 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 01:25:01 +00:00
Ted Kremenek 2dd17abf11 [analyzer] 'Looping back to the head of the loop' diagnostics are prunable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152083 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 01:00:36 +00:00
Jordy Rose 218fce0f11 [analyzer] Remove now-unused constant. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152080 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 00:33:35 +00:00
Jordy Rose 257c60f23b [analyzer] Fix unnecessary dyn_cast_or_null. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152078 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 00:28:20 +00:00
Ted Kremenek e4d653b5a4 Teak CallAndMessageChecker to only warn about uninitialized struct fields in call arguments
when the called function is never inlined.

Fixes <rdar://problem/10977037>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152073 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 23:57:14 +00:00
Richard Smith 0cc323c6be static_assert: Allow any string-literal as the message, not just a character
string literal, and adjust the diagnostic code to match. This also causes us
to escape any control characters in the message.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152069 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 23:20:05 +00:00
Ted Kremenek a99f874bf2 Teach SimpleSValBuilder that (in the absence of more information) stack memory doesn't alias symbolic memory. This is a heuristic/hack, but works well in practice. Fixes <rdar://problem/10978247>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152065 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 23:06:19 +00:00
Daniel Dunbar 02892a65b1 AST/stats: Don't effectively use an out-of-line function to return a static
bool. Ugh.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152062 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 21:42:49 +00:00
Anna Zaks d38f795431 [analyzer] Time the execution (per each TU) with -analyzer-stats.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152059 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 20:53:59 +00:00
Sebastian Redl 2835745a45 If the element type of an initializer list has a destructor, make sure we check it. Fixes PR12178.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152048 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 19:35:43 +00:00
Fariborz Jahanian abf9d908cc patch to optionally warn for block implementations without explicit
return types that return non-void values. // rdar://10735698


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152047 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 19:34:00 +00:00
Anna Zaks f420fe35dc [analyzer] False positive in SelfInit - teach the checker about method
calls with self as a parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152039 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 18:58:25 +00:00
Anna Zaks fb7f76f285 [analyzer] Malloc should assume that ownership is transfered when
calling an ObjC method ending with 'NoCopy'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152037 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 17:42:10 +00:00
Benjamin Kramer 52c1668206 Avoid double lookup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152033 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 17:20:04 +00:00
Peter Collingbourne 12fc4b0624 Properly handle non-canonical underlying types in
ASTContext::getUnaryTransformType.  This can happen if, for example,
an enumeration's underlying type is a typedef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152031 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 16:02:06 +00:00
Nico Weber 2bfdad1196 Fix a -Wstring-plus-int warning.
Patch from Sean Silva <silvas@purdue.edu>!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152030 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 15:48:34 +00:00
Benjamin Kramer 713575afda TargetInfo: create less temporary strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152029 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 15:10:44 +00:00
Rafael Espindola 234fe654a3 Fix a small difference in sema and codegen views of what needs to be output.
In the included testcase, soma thinks that we already have a definition after we
see the out of line decl. Codegen puts it in a deferred list, to be output if
a use is seen. This would break when we saw an explicit template instantiation
definition, since codegen would not be notified.

This patch adds a method to the consumer interface so that soma can notify
codegen that this decl is now required.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152024 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 10:54:55 +00:00
James Molloy b3c312ce4d Fix a bug in the mangler where in 'namespace std { extern "C" {X;} }', X would not be seen to be in ::std::.
Migrate two other places where the same logic is used to use the helper function that already exists.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152022 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 09:59:43 +00:00
Argyrios Kyrtzidis 2a2781805a [arcmt]
-Make sure we don't change to '__weak' a __block variable used as output.
-Make sure we don't apply __weak twice.

Fixes rdar://10520757&10521362

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152020 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 08:46:24 +00:00
Argyrios Kyrtzidis c6c54521f9 [preprocessor] Enhance PreprocessingRecord to keep track of locations of conditional directives.
Introduce PreprocessingRecord::rangeIntersectsConditionalDirective() which returns
true if a given range intersects with a conditional directive block.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152018 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 05:48:17 +00:00
Argyrios Kyrtzidis bb66066688 [preprocessor] Enhance the preprocessor callbacks:
-Add location parameter for the directives callbacks
-Skip callbacks if the directive is inside a skipped range.
-Make sure the directive callbacks are invoked in source order.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152017 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 05:48:09 +00:00
Richard Smith 5cc2c6eb67 Lexing support for user-defined literals. Currently these lex as the same token
kinds as the underlying string literals, and we silently drop the ud-suffix;
those issues will be fixed by subsequent patches.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152012 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 04:02:15 +00:00
Erik Verbruggen a81d3d434e Remove a recursive visitation in ExprEngine that is no longer needed because the CFG is fully linearized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152007 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-04 18:12:21 +00:00
Chandler Carruth 77889c43b7 Silence a GCC warning about a set-but-not-used variable in release builds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152005 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-04 12:16:40 +00:00
Richard Smith b4a7b1e587 Add tests for [over.literal]. Fix a few bugs which were exposed by the tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151997 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-04 09:41:16 +00:00
Chris Lattner d6e73569cc add a testcase for PR12094 and fix a crash on pointer to incomplete type,
reported by Richard Smith.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151993 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-04 00:52:12 +00:00
Richard Smith ec92bc7897 Add a pile of tests for unrestricted unions, and advertise support for them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151992 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-03 23:51:05 +00:00
Richard Smith 1aa0be8635 constexpr: Remove APValue/CCValue distinction. It is no longer useful given the
resolution of core issue 1454.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151991 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-03 22:46:17 +00:00
Benjamin Kramer 7eb7d99d75 Remove unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151989 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-03 21:52:22 +00:00
Eli Friedman 16412ef25a Avoid an unnecessary recursive loop between type canonicalization and NNS canonicalization which would (rarely) lead to memory corruption. While I'm here, simplify. Fixes PR12166. Not committing a testcase because it's impossible to reduce it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151967 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-03 04:09:56 +00:00
Ted Kremenek 7e8678314c [analyzer] do not warn about returning stack-allocated memory when it comes from an ancestor stack frame.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151964 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-03 01:22:03 +00:00
Daniel Dunbar e21dd284d8 Frontend: Default to creating output files using temporary files + rename.
- This is a more reliable default, as it behaves better on failure and also
   ensures that we create *new* files (instead of reusing existing inodes). This
   is useful for other applications (like lldb) which want to cache inode's to
   know when a file has been rewritten.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151961 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-03 00:36:06 +00:00
Daniel Dunbar 12f28ab8a5 Frontend: Don't automatically create missing directories when using temporary files with createOutputFile()
- This would otherwise happen as a side effect of llvm::sys::fs::unique_file creating parent directories.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151960 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-03 00:36:02 +00:00
DeLesley Hutchins 0d95dfcc0e Thread safety analysis: expand set of expressions that can be used to denote locks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151956 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 23:36:05 +00:00
Richard Smith a3ca41f0c2 Reinstate r151879, r151880, reverted in r151922, along with a bugfix for
scalar emission of DeclRefExprs to const bools: emit scalar bools as i1,
not as i8.

In addition to the extra unit testing, this has successfully bootstrapped.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151955 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 23:27:11 +00:00
Anna Zaks 067cc40308 Unbreak the CMake builds following the CallGraph change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151952 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 23:18:45 +00:00
Anna Zaks 190f6003cb [analyzer] Rename clang::CallGraph into clang::idx::CallGraph + rename
the corresponding files to avoid confusion.

This is a preparation to adding an AST-based call graph to Analysis. The
existing call graph works with indexer entries. We might be able to
refactor it to use the AST based graph in the future.

(Minimal testing here as the only example that uses the API has been
completely broken, does not compile.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151950 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 22:54:36 +00:00
Aaron Ballman 4c55c54db8 Adding support for #pragma include_alias in MS compatibility mode. This implements PR 10705.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151949 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 22:51:54 +00:00
DeLesley Hutchins 7ec419aa8f Issue warning when late-parsed attributes have no declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151947 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 22:29:50 +00:00
DeLesley Hutchins 2287c5e235 Make late-parsed attributes follow the conventions of ordinary
GNU attributes to a better extent, by allowing them in more
places on a declator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151945 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 22:12:59 +00:00
DeLesley Hutchins 2a35be803c Thread safety analysis: handle CFG blocks which call functions marked as noreturn.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151944 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 22:02:58 +00:00
Nico Weber 1cb2d742eb Add -Wstring-plus-int, which warns on "str" + int and int + "str".
It doesn't warn if the integer is known at compile time and within
the bounds of the string.

Discussion: http://comments.gmane.org/gmane.comp.compilers.clang.scm/47203



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151943 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 22:01:22 +00:00
Fariborz Jahanian b0a6615cb9 objc: When issue diagnostic about deprecated method, also
issue the note if it is because message is sent to a forward class
declaration in delayed diagnostic. // rdar://10290322


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151942 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 21:50:02 +00:00
Ted Kremenek 4ba86bc53b [analyzer diagnostics] flush locations *before* popping the current path when visiting a CallEnter.
Fixes <rdar://problem/10967815>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151938 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 21:16:22 +00:00
Hal Finkel 178a9b8b22 Fix an ABI problem with ptrdiff_t and intptr_t on PPC32
ptrdiff_t on PPC32 on Linux, etc. should be int not long.
This does not matter for C, but it does matter for C++ because of
name mangling.

The preprocessor test has been changed accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151935 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 20:54:36 +00:00
Argyrios Kyrtzidis 5a61e0c422 [Sema] Fix crash-on-invalid-code issue:
@class I;
@implementation I(cat) // crashes here
@end

rdar://10968158

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151931 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 19:14:29 +00:00
Anna Zaks 8235f9c9c8 [analyzer] Bound the size of the functions being inlined + provide
command line options for inlining tuning.

This adds the option for stack depth bound as well as function size
bound. 

+ minor doxygenification

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151930 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 19:05:03 +00:00
Jay Foad f4c3db1751 PR12094: Set the alignment of memory intrinsic instructions based on the
types of the pointer arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151927 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 18:34:30 +00:00
Fariborz Jahanian a0e005b06b Change diagnostic test for my last patch.
// rdar://10961370


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151923 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 17:05:03 +00:00
Daniel Dunbar c169e08f3a Revert r151879, r151880, "PR12145: Avoid emitting loads of constexpr variables in contexts where there" and "Fix buildbot: make this test less dependent on the value names in the produced IR."
They broke bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151922 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 16:24:25 +00:00
Benjamin Kramer edd1caec02 Use tabs instead of spaces.
No, really, make doesn't work with spaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151920 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 16:06:37 +00:00
Jia Liu f8e5d4cf39 clang -v support for separate clang.git and llvm.git, patch by Andrew Trick.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151910 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 14:37:41 +00:00
David Chisnall b4f0bd6864 Add the Solaris support directory to the header search when using libc++.
Unconditionally define __C99FEATURES__ when using C++ on Solaris.  This is a
(hopefully temporary) work around for libc++ exposing C99-but-not-C++98
features in C++98 mode.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151889 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 10:49:52 +00:00
Richard Smith 16581335fc Ensure that we instantiate static reference data members of class templates
early, since their values can be used in constant expressions in C++11. For
odr-use checking, the opposite change is required, since references are
odr-used whether or not they satisfy the requirements for appearing in a
constant expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151881 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 04:14:40 +00:00
Richard Smith a3cac5b76a PR12145: Avoid emitting loads of constexpr variables in contexts where there
is no odr-use of the variable. Go slightly beyond what the standard requires
for variables of reference type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151879 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 03:16:32 +00:00
Ted Kremenek 77d09441e5 [analyzer diagnostics] Change CompactPathDiagnostic to recursively compact diagnostics in calls into macro pieces.
Also fix handling of macros within calls in the HTMLDiagnostics.

This also adds a test case for r151774.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151872 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 01:27:31 +00:00
Fariborz Jahanian e853bb34ec c/objc: problem originally reported as an objective-c bug.
But it is in the underlying c part of clang. clang crashes
in IRGen when passing an incomplete type argument to 
variadic function (instead of diagnosing the bug).
// rdar://10961370


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151862 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 23:42:00 +00:00
Ted Kremenek cc2c4b293d Teach the analyzer to just ignore CXXBindTemporaryExpr. There's nothing special to do with it, since destructors are represented explicitly in the CFG.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151856 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 23:06:04 +00:00
Ted Kremenek f15e1143dc Moving tagging of '__experimental_modules_import' IdentifierInfo out of
IndentifierTable::get() and into IdentifierTable's constructor.

This gets a 0.7% reducing on lexing time for Cocoa.h, and
about the same for PCH generation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151854 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:53:32 +00:00
Eli Friedman 8c72a7db34 Make CodeGenFunction::EmitBlockCopyAndAutorelease actually do what its name says.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151853 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:52:28 +00:00
Anna Zaks 278f1f8d95 [analyzer] Turn inlining on by default for better testing exposure.
Fix a test, which was most likely an unintended recursive call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151848 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:37:46 +00:00
Kostya Serebryany 3c93122d31 Add a flag -fthread-sanitizer.
This flag enables ThreadSanitizer instrumentation committed to llvm as r150423.
The patch includes one test for -fthread-sanitizer and one similar test for -faddress-sanitizer.
This patch does not modify the linker flags (as we do it for -faddress-sanitizer) because the run-time library is not yet
committed and it's structure in compiler-rt is not 100% clear.
The users manual wil be changed in a separate commit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151846 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:27:08 +00:00
Ted Kremenek 32ad2ee261 Change @import to @__experimental_modules_import. We are not ready to commit to a particular syntax for modules,
and don't have time to push it forward in the near future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151841 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:07:04 +00:00
Anna Zaks b3d7275c1a [analyzer] Fix a regression introduced in malloc with
attributes, introduced in r151188.

+ the test to catch it.

Thanks to Ahmed Charles for pointing this out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151840 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:06:06 +00:00
Eric Christopher ad8de5142a Reapply r151702 with a small fix for a failure to cut and paste
correctly.

Still rdar://10900684

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151838 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 21:36:52 +00:00
Eli Friedman 88530d5e13 Fix the isReferenced bit on parameters in a couple of edge cases. PR12153.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151837 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 21:32:56 +00:00
Argyrios Kyrtzidis b2c60b04a5 Move llvm/ADT/SaveAndRestore.h -> llvm/Support/SaveAndRestore.h.
Needs llvm update.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151829 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 19:45:56 +00:00
Peter Collingbourne dca1761c9b StmtProfiler: Add a null check for child statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151812 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 16:34:31 +00:00
Jean-Daniel Dupas 8a5e7fdd2c Implement double underscore names support in __has_attribute
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151809 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 14:53:16 +00:00
Richard Smith f9b6f2c954 Avoid examining the AST from the parser, and simplify somewhat.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151805 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 07:10:06 +00:00
Richard Smith 10285d9113 Revert r151800, which was committed without review and has correctness issues.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151804 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 06:49:39 +00:00
Aaron Ballman 7abe1666f2 Implements support for #pragma include_alias in ms compatibility mode. Fixes PR10705.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151800 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 04:18:49 +00:00
Aaron Ballman 6454a02e7b Added support for parsing declspecs on enumerations. Fixes PR8783
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151798 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 04:09:28 +00:00
Eli Friedman 23f0267e2d Implement "optimization" for lambda-to-block conversion which inlines the generated block literal for lambdas which are immediately converted to block pointer type. This simplifies the AST, avoids an unnecessary copy of the lambda and makes it much easier to avoid copying the result onto the heap.
Note that this transformation has a substantial semantic effect outside of ARC: it gives the converted lambda lifetime semantics similar to a block literal.  With ARC, the effect is much less obvious because the lifetime of blocks is already managed.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151797 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 04:01:32 +00:00
Richard Smith 5e4e58b805 Reject 'a = {0} = {0}' rather than parsing it as '(a = {0}) = {0}'. Also
improve the diagnostics for some attempts to use initializer lists in
expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151794 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 02:59:17 +00:00
Ted Kremenek f6e88d7592 Fix regression from llvm-gcc where we should NOT emit a warning about __attribute__((NSObject)) on a property declaration. This is needed to have retain properties for non-object pointers. Fixes <rdar://problem/10930507>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151786 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 01:40:32 +00:00
Anna Zaks 3edf02f66d [analyzer] Diagnostics - do not try to cleanup the path with macros, it
will be done by the general cleanup later on.
A Patch by Ted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151784 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 01:30:58 +00:00
Eli Friedman 3f01c8a58b Tighten type-checking a bit to make it clearer how BuildCXXMemberCallExpr is used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151783 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 01:30:04 +00:00
Nico Weber 07a4b0488b Move suport for redefining operator keywords from -fms-extensions to -fms-compatibility.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151776 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 00:13:46 +00:00
Ted Kremenek 7251674438 Change if...else if...else if... to a switch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151775 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 00:05:06 +00:00
Ted Kremenek 62ff528689 [analyzer] when scanning FIDs in a PathDiagnostic, correctly recurse calls and macros.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151774 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 23:59:20 +00:00
Nico Weber f4fb07ed4d Allow operator keywords to be #defined in ms-ext mode.
Fixes PR10606.

I'm not sure if this is the best way to go about it, but
I locally enabled this code path without the msext conditional,
and all tests pass, except for test/Preprocessor/cxx_oper_keyword.cpp
which explicitly checks that operator keywords can't be redefined.

I also parsed chromium/win with a clang with and without this patch.
It introduced no new errors, but removes 43 existing errors.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151768 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 22:54:43 +00:00
Fariborz Jahanian 77bfb8b43e objective-c: provide fixit hint when atomic property does not
have matching user defined setter/getter and a warning is issued. 
In this case, a fixit note is displayed. // rdar://10267155


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151766 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 22:18:55 +00:00
Eli Friedman fd819783aa Fix a couple -Wuninitialized warnings from gcc. Reported by David Greene.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151754 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 20:59:56 +00:00
Daniel Dunbar 8d6ff02cb7 Serialization: Switch over to using the native SmallVector based BitstreamWriter
ctor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151752 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 20:31:23 +00:00
Chad Rosier 3f3335dbc3 Allocate TargetLibraryInfo for the CodeGen passes. Otherwise, it's instantiated
by the BAA pass, which uses the default TargetLibraryInfo constructor.
Unfortunately, the default TargetLibraryInfo constructor assumes all library
calls are available and thus ignores -fno-builtin.
rdar://10947759


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151745 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 20:14:59 +00:00
Anna Zaks ca23eb212c [analyzer] Malloc: A pointer might escape through CFContainers APIs,
funopen, setvbuf.

Teach the checker and the engine about these APIs to resolve malloc
false positives. As I am adding more of these APIs, it is clear that all
this should be factored out into a separate callback (for example,
region escapes). Malloc, KeyChainAPI and RetainRelease checkers could
all use it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151737 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 18:42:47 +00:00
Daniel Dunbar 956ecbd2c8 Revert r151702, "Add support for handling captured variables in lambda debug
info.", which broke some -O0 -g tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151730 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 16:28:29 +00:00
David Chisnall 41d476d307 Add -C when linking on Solaris so that the error messages are understandable by actual humans.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151726 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 15:06:12 +00:00
Sebastian Redl 51ad9cd064 Tentatively fix PR12117. The test case from the bug now passes, and all existing tests still pass, but there may still be corner cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151716 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 12:47:43 +00:00
James Molloy 16f1f717af Reapply r151638 and r151641.
The bug that was caught by Apple's internal buildbots was valid and also showed another bug in my implementation.

These are now fixed, with regression tests added to catch them both (not Darwin-specific).

Original log:
====================

Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h

Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.

This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
 return 0;
}

This finally fixes PR5464 and PR5477.
---------------------

I also reverted r151641 which was enhancement on top of r151638.

====================




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151712 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 10:24:19 +00:00