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

28226 Коммитов

Автор SHA1 Сообщение Дата
Richard Smith 7d04d3a685 Refactor to reduce duplication in handling of special member functions. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168977 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 05:11:39 +00:00
Douglas Gregor 463d90986e Keep track of modules that have failed to build. If we encounter an
import of that module elsewhere, don't try to build the module again:
it won't work, and the experience is quite dreadful. We track this
information somewhat globally, shared among all of the related
CompilerInvocations used to build modules on-the-fly, so that a
particular Clang instance will only try to build a given module once.

Fixes <rdar://problem/12552849>.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168961 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 23:55:25 +00:00
Eli Friedman db748a380a Fix a small calling-convention bug for x86-32. PR14453.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168959 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 23:21:04 +00:00
Quentin Colombet 74632aab3a Add ARM cortex-a5 subtarget
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168958 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 23:15:27 +00:00
Quentin Colombet 398b8e86ab Revert commit revision r168953, to change the commit message, which was empty
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168956 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 23:07:08 +00:00
Quentin Colombet b3233f5ed4 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168953 91177308-0d34-0410-b5e6-96231b3b80d8 2012-11-29 22:58:40 +00:00
Alexey Samsonov 4d1a6e41e1 This patch exposes to Clang users three more sanitizers are experimental features of ASan:
1) init-order sanitizer: initialization-order checker.
Status: usable, but may produce false positives w/o proper blacklisting.
2) use-after-return sanitizer
Status: implemented, but heavily understed.
Should be optional, as it significanlty slows program down.
3) use-after-scope sanitizer
Status: in progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168950 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 22:36:21 +00:00
Eric Christopher 6716d9443d Make sure that we put the rest of the sanitizer libraries on the link line
before libstdc++ like we do with ubsan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168918 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 18:51:05 +00:00
Rafael Espindola b282920338 Now that the underlying problem has been fixed, add r168411 back.
Original commit message:

Remove redundant code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168900 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 16:38:22 +00:00
Rafael Espindola 8b8a09e496 Merge function types in C.
Among other differences, GCC accepts

  typedef int IA[];
  typedef int A10[10];
  static A10 *f(void);
  static IA  *f(void);
  void g(void) {
    (void)sizeof(*f());
  }

but clang used to reject it with:

  invalid application of 'sizeof' to an incomplete type 'IA' (aka 'int []')

The intention of c99's 6.2.7 seems to be that we should use the composite type
and accept as gcc does.

Doing the type merging required some extra fixes:
  * Use the type from the function type in initializations, even if an parameter
    is available.
  * Fix the merging of the noreturn attribute in function types.
  * Make CodeGen  handle the fact that an parameter type can be different from
    the corresponding type in the function type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168895 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 16:09:03 +00:00
Timur Iskhodzhanov 53c61c5c0c [-cxx-abi microsoft] Also spill the argument-back-references context when mangling templates
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168862 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 08:58:47 +00:00
Richard Smith 8426890494 Reject uses of __int128 on platforms that don't support it. Also move the ugly
'getPointerWidth(0) >= 64' test to be a method on TargetInfo, ready to be
properly cleaned up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168856 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 05:41:51 +00:00
Nico Weber bba91b881c Fix sentence construction-o.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168855 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 05:29:23 +00:00
Eli Friedman a70779f6b9 Fix crash-on-invalid. <rdar://problem/12765391>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168851 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 03:13:49 +00:00
Richard Smith afb49189d6 The declaration of a special member can require overload resolution to be
performed, to determine whether that special member is deleted or constexpr.
That overload resolution process can in turn trigger the instantiation of a
template, which can do anything, including triggering the declaration of that
very same special member function. When this happens, do not try to recursively
declare the special member -- that's impossible. Instead, only try to realise
the truth. There is no special member.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168847 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 01:34:07 +00:00
Ted Kremenek 9c0466603f Correctly handle IntegralToBool casts in C++ in the static analyzer. Fixes <rdar://problem/12759044>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168843 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 00:50:20 +00:00
Chad Rosier 586a061ad9 [driver] -mkernel implies -mstrict-align; don't add the redundant option.
rdar://12771737

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168841 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 00:42:06 +00:00
Michael Han 52b501cd72 Implement C++11 [dcl.attr.grammar] p4: If an attribute-specifier-seq appertains to a friend declaration, that declaration shall be a definition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168826 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 23:17:40 +00:00
Fariborz Jahanian b15c8984ea objective-C blocks: Make sure that identical logic is used
in deciding a copy/dispose field is needed in a byref structure
and when generating the copy/dispose helpers. In certain
cases, these fields were being added but no copy/dispose was
being generated. This was uncovered in ARC, but not in MRR.
// rdar://12759433


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168825 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 23:12:17 +00:00
Richard Smith a70c3f8738 Per C++11 [except.spec]p2, rvalue references are not permitted in exception specifications.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168824 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 22:52:42 +00:00
Richard Smith 21173b1080 PR14388: An array or function type in an exception specification should be
decayed to a pointer type. Patch by WenHan Gu, with a little tweaking and
additional testcases by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168822 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 22:33:28 +00:00
Manman Ren 060f34d6d1 ABI: comments from Eli on r168820.
rdar://12723368


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168821 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 22:29:41 +00:00
Manman Ren f51c61c78e ABI: modify CreateCoercedLoad and CreateCoercedStore to not use load or store of
the original parameter or return type.

Since we do not accurately represent the data fields of a union, we should not
directly load or store a union type.

As an exmple, if we have i8,i8, i32, i32 as one field type and i32,i32 as
another field type, the first field type will be chosen to represent the union.
If we load with the union's type, the 3rd byte and the 4th byte will be skipped.

rdar://12723368


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168820 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 22:08:52 +00:00
Richard Smith f641166066 PR13098: If we're instantiating an overloaded binary operator and we could
determine which member function would be the callee from within the template
definition, don't pass that function as a "non-member function" to
CreateOverloadedBinOp. Instead, just rely on it to select the member function
for itself.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168818 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 21:47:39 +00:00
Alexey Samsonov 3325b1617f Refactor -fsanitize, -f*-sanitizer arguments parsing. Provide a more careful diagnostic for invalid sets of sanitizers
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168794 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 17:34:24 +00:00
Kostya Serebryany 11c9a6e8cb [asan] Split AddressSanitizer into two passes (FunctionPass, ModulePass), Clang part.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168782 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 10:32:11 +00:00
Andy Gibbs 037dbda821 Remove obsolete comment missed by r162937
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168778 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 08:14:36 +00:00
Richard Smith 30cddaec99 Teach Lexer::getSpelling about raw string literals. Specifically, if a raw
string literal needs cleaning (because it contains line-splicing in the
encoding prefix or in the ud-suffix), do not clean the section between the
double-quotes -- that's the "raw" bit!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168776 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 07:29:00 +00:00
Richard Smith acf796b479 Store on the CXXRecordDecl whether the class has, or would have, a copy
constructor/assignment operator with a const-qualified parameter type. The
prior method for determining this incorrectly used overload resolution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168775 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 06:23:12 +00:00
Ted Kremenek 3881866dc7 Remove workaround in RegionStore in r168741 since it is handled more generally by r168757.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168774 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 05:36:28 +00:00
Argyrios Kyrtzidis 2a82ca255b Introduce ASTUnresolvedSet, an UnresolvedSet-like class, whose contents are
allocated using the allocator associated with an ASTContext.

Use this inside CXXRecordDecl::DefinitionData instead of an UnresolvedSet to
avoid a potential memory leak.

rdar://12761275

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168771 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 03:56:16 +00:00
Argyrios Kyrtzidis 9d29543284 Don't return a pointer to an UnresolvedSetImpl in the CXXRecordDecl interface,
expose only the iterators instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168770 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 03:56:09 +00:00
Richard Smith b8abff66a8 C++ core issue 1344, PR10618: promote "addition of default argument makes this
a special member" diagnostic from warning to error, and fix the cases where it
produced diagnostics with incorrect wording.

We don't support this as an extension, and we ban it even in C++98 mode. This
breaks too much (for instance, the ABI-specified calling convention for a type
can change if it acquires a copy constructor through the addition of a default
argument).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168769 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 03:45:24 +00:00
Ted Kremenek 1994e3993e Fix another false positive due to a CXX temporary object appearing in a C initializer.
The stop-gap here is to just drop such objects when processing the InitListExpr.
We still need a better solution.

Fixes <rdar://problem/12755044>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168757 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 01:49:01 +00:00
Fariborz Jahanian 84c7519a38 objective-C arc: Underline the selector when issuing
arc specific diagnostic on the selector. This is objc-arc
part of // rdar://11303469


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168756 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 01:27:44 +00:00
Ted Kremenek bd8a11e224 Provide stop-gap solution to crash reported in PR 14436.
This was also covered by <rdar://problem/12753384>.  The static analyzer
evaluates a CXXConstructExpr within an initializer expression and
RegionStore doesn't know how to handle the resulting CXXTempObjectRegion
that gets created.  We need a better solution than just dropping the
value, but we need to better understand how to implement the right
semantics here.

Thanks to Jordan for his help diagnosing the behavior here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168741 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 23:05:37 +00:00
Fariborz Jahanian 82c458ea76 objective-C arc: load of a __weak object happens via call to
objc_loadWeak. This retains and autorelease the weakly-refereced
object. This hidden autorelease sometimes makes __weak variable alive even
after the weak reference is erased, because the object is still referenced
by an autorelease pool. This patch overcomes this behavior by loading a 
weak object via call to objc_loadWeakRetained(), followng it by objc_release
at appropriate place, thereby removing the hidden autorelease. // rdar://10849570


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168740 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 23:02:53 +00:00
Nico Weber f88836d949 Move PrettyStackTraceParserEntry to ParseAST.cpp
r128056 moved PrettyStackTraceParserEntry construction from Parser.h
to ParseAST.cpp, so there's no need to keep this class in a header.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168731 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 21:57:34 +00:00
Richard Smith d1bac8d467 Allow an ASTConsumer to selectively skip function bodies while parsing. Patch
by Olivier Goffart!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168726 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 21:31:01 +00:00
Richard Smith d0adeb65c7 Simplify checking for whether we should implicitly declare special members and
add some assertions. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168725 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 21:20:31 +00:00
Chad Rosier f8fc6273ed Remove an extra semicolon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168707 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 17:31:26 +00:00
Rafael Espindola 17c874a944 Remove some dead code. CLANG_IS_PRODUCTION is now just a build flag and
is not used in any #ifdef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168703 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 16:10:37 +00:00
Will Dietz b85403658a Add -fsanitize=integer for reporting suspicious integer behaviors.
Introduces new sanitizer "unsigned-integer-overflow".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168701 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 15:01:55 +00:00
Eli Friedman 6902e4146d Fix the definition of the vfork() builtin on Haiku. PR14378.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168674 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 02:58:24 +00:00
Bill Schmidt c9715fc7c3 This patch addresses an incompatibility relative to the 64-bit PowerPC
ELF ABI.

Complex values are to be passed in registers as though the real and
imaginary parts were passed as separate parameters.  Prior to this
patch, complex values were passed as byval aggregates.  It turns out
that specifying getDirect() for all complex types when classifying the
argument type results in the desired behavior.

The new Clang test case verifies that the correct LLVM IR is generated
for caller and callee for each of the underlying types for _Complex.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168673 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 02:46:43 +00:00
Rafael Espindola 8272be5ed3 Revert r168411 for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168667 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 01:44:24 +00:00
Daniel Dunbar acf36129fa Frontend: Create a virtual file for named pipe inputs.
- This ensures we see the right buffer size for the file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168636 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 00:04:16 +00:00
Michael Han 2e39713a3d Improve diagnostic on C++11 attribute specifiers that appear at wrong syntactic locations around class specifiers.
This change list implemented logic that explicitly detects several combinations of locations where C++11 attribute
specifiers might be incorrectly placed within a class specifier. Previously we emit generic diagnostics like 
"expected identifier" for such cases; now we emit specific diagnostic against the misplaced attributes, this also 
fixed a bug in old code where attributes appear at legitimate locations were incorrectly rejected.

Thanks to Richard Smith for reviewing!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168626 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 22:54:45 +00:00
Eli Friedman f582499870 Add missing "break". Thanks to Craig for spotting it.
I'm looking at ways to fix the relevant test so it can catch this sort of mistake.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168618 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 21:57:28 +00:00
Anna Zaks dac6cd533d [analyzer] Fix a crash reported in PR 14400.
The AllocaRegion did not have the superRegion (based on LocationContext)
as part of it's hash. As a consequence, the AllocaRegions from
different frames were uniqued to be the same region.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168599 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 19:11:46 +00:00
Anton Korobeynikov f419a856b5 MSPGCC renamed ISR vectors from vector_<address> to __isr_<number>. This patch makes Clang reflect this scheme.
Patch by Job Noorman!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168598 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 18:59:10 +00:00
Timur Iskhodzhanov 79b7cc5965 Fix PR14413 - incorrect mangling of anonymous namespaces with -cxx-abi microsoft
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168583 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 08:55:48 +00:00
Richard Smith 73ed67cc36 PR14428: When instantiating a 'new' expression, if we had a non-dependent
initialization, don't rebuild it. Remove a couple of hacks which were trying to
work around this. Fix the special case for one-argument CXXConstructExprs to
not apply if the one argument is a default argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168582 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 08:32:48 +00:00
Rafael Espindola 8dbf697cf5 Add r168519 back, but with a fix to also merge the used flag in variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168564 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-25 14:07:59 +00:00
NAKAMURA Takumi 6df81a94fc Revert r168519, "Merge used flags so that we don't have to iterate on isUsed. With this change"
It brought bunch of (possibly false) warnings.

llvm/unittests/VMCore/PassManagerTest.cpp:60:22: warning: variable 'ID' is not needed and will not be emitted [-Wunneeded-internal-declaration]
    char ModuleNDNM::ID=0;
                     ^
llvm/unittests/VMCore/PassManagerTest.cpp:86:22: warning: variable 'ID' is not needed and will not be emitted [-Wunneeded-internal-declaration]
    char ModuleNDM2::ID=0;
                     ^
llvm/unittests/VMCore/PassManagerTest.cpp:106:21: warning: variable 'ID' is not needed and will not be emitted [-Wunneeded-internal-declaration]
    char ModuleDNM::ID=0;
                    ^
llvm/unittests/VMCore/PassManagerTest.cpp:217:16: warning: variable 'initcount' is not needed and will not be emitted [-Wunneeded-internal-declaration]
    int LPass::initcount=0;
               ^
llvm/unittests/VMCore/PassManagerTest.cpp:218:16: warning: variable 'fincount' is not needed and will not be emitted [-Wunneeded-internal-declaration]
    int LPass::fincount=0;
               ^
llvm/unittests/VMCore/PassManagerTest.cpp:259:16: warning: variable 'inited' is not needed and will not be emitted [-Wunneeded-internal-declaration]
    int BPass::inited=0;
               ^
llvm/unittests/VMCore/PassManagerTest.cpp:260:16: warning: variable 'fin' is not needed and will not be emitted [-Wunneeded-internal-declaration]
    int BPass::fin=0;
               ^
llvm/unittests/VMCore/PassManagerTest.cpp:283:24: warning: variable 'ID' is not needed and will not be emitted [-Wunneeded-internal-declaration]
    char OnTheFlyTest::ID=0;
                       ^
8 warnings generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168549 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-24 23:17:09 +00:00
Benjamin Kramer 63b6ebe4e7 Sema: Provide a valid source location when instantiating templates based on a CXXDefaultArgExpr.
Fixes PR13758.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168521 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-23 17:04:52 +00:00
Rafael Espindola 919b7e6978 Merge used flags so that we don't have to iterate on isUsed. With this change
"clang -cc1 -fsyntax-only" on the preprocessed output of

#define M extern int a;
#define M2 M M
#define M4 M2 M2
#define M8 M4 M4
#define M16 M8 M8
#define M32 M16 M16
#define M64 M32 M32
#define M128 M64 M64
#define M256 M128 M128
#define M512 M256 M256
#define M1024 M512 M512
#define M2048 M1024 M1024
#define M4096 M2048 M2048
#define M8192 M4096 M4096
#define M16384 M8192 M8192
M16384

goes from 2.994s to 1.416s. GCC is at 0.022s, so we still have a long way to go.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168519 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-23 16:26:30 +00:00
Rafael Espindola 385e1d9fd0 Remove redundant check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168515 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-23 14:29:54 +00:00
Joey Gouly 8548908080 PR14306: Move -fbounds-checking to -fsanitize=bounds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168510 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-23 10:39:49 +00:00
Bob Wilson 66b8a6671b Reapply a subset of r167567 to clean up Darwin-specific code for invoking gcc.
Unlike my previous attempt at this, this patch leaves intact the check for
whether clang can handle the input file type, and for non-Darwin toolchains it
will invoke gcc for things it cannot handle. For Darwin toolchains, the
behavior reported in pr14338 still occurs with this patch, but that is a
definite improvement from what happens currently, where it just crashes with
an assertion failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168505 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-23 06:14:39 +00:00
Benjamin Kramer 4d9f4e5bfa Make helpers static/anonymous.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168500 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-22 15:02:44 +00:00
Richard Smith 746619a5ac Fix regression in r168477. Use canonical decl when looking for base class
specified as a qualified name.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168479 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-22 00:40:54 +00:00
Richard Smith f62c690c55 Fix CXXRecordDecl::forallBases to not look through bases which are dependent
and defined within the current instantiation, but which are not part of the
current instantiation. Previously, it would look at bases which could be
specialized separately from the current template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168477 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-22 00:24:47 +00:00
Chandler Carruth a6b2581f95 Fix the '-fuse-init-array' option to actually be an option.
Previously, this flag to CC1 was never exposed at the clang driver
layer, and if you happened to enable it (by being on Android or GCC 4.7
platform), you couldn't *disable* it, because there was no 'no' variant.
The whole thing was confusingly implemented.

Now, the target-specific flag processing gets the driver arg list, and
we use standard hasFlag with a default based on the GCC version and/or
Android platform. The user can still pass the 'no-' variant to forcibly
disable the flag, or pass the positive variant to clang itself to enable
the flag.

The test has also been substantially cleaned up and extended to cover
these use cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168473 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-21 23:40:23 +00:00
Benjamin Kramer 39ad0f03d5 SemaCXX: an enumeral type can be of character or boolean type in a C++11 enum class. Make sure we create a literal of the right type.
Fixes PR14386.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168441 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-21 17:42:47 +00:00
Joey Gouly 21261f4f97 Test commit: Remove blank line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168436 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-21 16:54:35 +00:00
Alexey Samsonov 69b77d7fb3 [Sanitizer] force linking with static sanitizer runtimes on Darwin even if they are not found in resource directory. Add test checking sanitizer linker flags on Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168428 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-21 14:17:42 +00:00
Dmitri Gribenko 0061fe4094 Use color for -ast-dump-filter only when it is supported
Patch by Philip Craig.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168420 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-21 10:54:55 +00:00
Rafael Espindola 16c8cf1c3c Remove redundant code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168411 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-21 02:53:22 +00:00
Rafael Espindola 5175861336 Remove redundant code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168410 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-21 02:47:19 +00:00
Bill Wendling dd851595cb Update method calls to the new interface re r168354.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168355 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-20 05:09:43 +00:00
David Blaikie 0c5d005cd3 Fix some trailing whitespace (on a blank line) to cycle/test bots.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168340 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-19 23:12:51 +00:00
Richard Smith 1a5bd5d680 PR14381: Never skip constexpr function bodies when code-completing. We may need
them in order to parse the rest of the file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168327 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-19 21:13:18 +00:00
Kaelyn Uhrain 728948fba8 When adding a NamedDecl to a correction, add the underlying Decl (via
getUnderlyingDecl()) so that derivatives of
CorrectionCandidateCallback::ValidateCandidate(...) don't have to worry
about being thrown by UsingDecls and such.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168317 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-19 18:49:53 +00:00
Logan Chien 529a73de04 Add -ldl for non-static libgcc in Android.
According to Android ABI, we have to link with
libdl.so, if we are linking with non-static libgcc.

Besides, this also fixes MIPS link error of
undefined references to `_Unwind_Find_FDE' and
`dl_iterate_phdr'.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168310 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-19 12:04:11 +00:00
Logan Chien 18c2842b01 Enable -fuse-init-array for Android X86/MIPS.
The dynamic linker of Android does not support .ctors/.dtors.
We should emit .init_array and .fini_array regardless the
gcc version.

NOTE: This patch does not affect the ARM backend, because
it is required to generate .init_array and .fini_array
for program targeting ARM AAPCS and AEABI.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168309 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-19 11:45:31 +00:00
Chandler Carruth 7ce816a77d Completely re-work how the Clang driver interprets PIC and PIE options.
There were numerous issues here that were all entangled, and so I've
tried to do a general simplification of the logic.
1) The logic was mimicing actual GCC bugs, rather than "features". These
   have been fixed in trunk GCC, and this fixes Clang as well. Notably,
   the logic was always intended to be last-match-wins like any other
   flag.
2) The logic for handling '-mdynamic-no-pic' was preposterously unclear.
   It also allowed the use of this flag on non-Darwin platforms where it
   has no actual meaning. Now this option is handled directly based on
   tests of how llvm-gcc behaves, and it is only supported on Darwin.
3) The APIs for the Driver's ToolChains had the implementation ugliness
   of dynamic-no-pic leaking through them. They also had the
   implementation details of the LLVM relocation model flag names
   leaking through.
4) The actual results of passing these flags was incorrect on Darwin in
   many cases. For example, Darwin *always* uses PIC level 2 if it uses
   in PIC level, and Darwin *always* uses PIC on 64-bit regardless of
   the flags specified, including -fPIE. Darwin never compiles in PIE
   mode, but it can *link* in PIE mode.
5) Also, PIC was not always being enabled even when PIE was. This isn't
   a supported mode at all and may have caused some fallout in builds
   with complex PIC and PIE interactions.

The result is (I hope) cleaner and clearer for readers. I've also left
comments and tests about some of the truly strage behavior that is
observed on Darwin platforms. We have no real testing of Windows
platforms and PIC, but I don't have the tools handy to figure that out.
Hopefully others can beef up our testing here.

Unfortunately, I can't test this for every platform. =/ If folks have
dependencies on these flags that aren't covered by tests, they may
break. I've audited and ensured that all the changes in behavior of the
existing tests are intentional and good. In particular I've tried to
make sure the Darwin behavior (which is more suprising than the Linux
behavior) also matches that of 'gcc' on my mac.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168297 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-19 03:52:03 +00:00
Dmitri Gribenko 898a7a2981 Remove redundant (duplicated) check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168293 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-18 22:28:42 +00:00
Dmitri Gribenko 36cbbe916f Documentation parsing: propely handle a lone '\endverbatim' and emit a warning.
We actually used to assert on this.

Thanks to NAKAMURA Takumi for noticing this!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168277 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-18 00:30:31 +00:00
Andy Gibbs 6d534d45a5 Clean up code according to coding standards
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168274 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 22:17:28 +00:00
Fariborz Jahanian 5fa667612e objective-C: Do not issue deprecated warning about implementation
of a deprecated method in original class (or category), only
in overrides. // rdar://12717705


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168270 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 20:53:53 +00:00
Nico Weber 6d926ae667 Fix crash on end-of-file after \ in a char literal, fixes PR14369.
This makes LexCharConstant() look more like LexStringLiteral(), which doesn't
have this bug. Add tests for eof after \ for several other cases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168269 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 20:25:54 +00:00
Andy Gibbs 3f03b58635 Prevent premature macro expansion in __has_builtin, __has_feature,
__has_attribute, __has_extension, making them behave more akin to
conventional macros.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168268 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 19:18:27 +00:00
Andy Gibbs 97f8461a2c Made the "expected string literal" diagnostic more expressive
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168267 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 19:16:52 +00:00
Andy Gibbs 02a176871d Refactored duplicate string literal lexing code within Preprocessor, into a
common LexStringLiteral function.  In doing so, some consistency problems have
been ironed out (e.g. where the first token in the string literal was lexed
with macro expansion, but subsequent ones were not) and also an erroneous
diagnostic has been corrected.

LexStringLiteral is complemented by a FinishLexStringLiteral function which
can be used in the situation where the first token of the string literal has
already been lexed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168266 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 19:15:38 +00:00
Andy Gibbs b9971bada4 Fix handling of invalid uses of the __has_warning builtin macro
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168265 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 19:14:53 +00:00
Benjamin Kramer 7baa711e61 Enable inlining of 4 byte atomic ops on ppc32, 8 byte atomic ops on ppc64.
Also fixes a bit/byte mismatch when checking if a target supports atomic ops of a certain size.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168260 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 17:30:55 +00:00
Ted Kremenek eba76a4379 Further reduce "-fsyntax-only -Wuninitialized" time on sqlite3.c by another 2.5% using intelligent pruning of blocks during the final reporting pass.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168257 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 07:18:30 +00:00
Ted Kremenek c1602581f7 Switch -Wuninitialized to use a reverse-post order traversal as
an initial baseline for enqueued blocks, but use a simple DFS stack
for propagating changes quickly up back edges.

This provides a 3.5% reduction in -fsyntax-only time on sqlite3.c.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168241 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 02:00:00 +00:00
Eli Friedman faf3538605 Add missing features for misc x86 CPUs to CPU feature translation. Patch by Jung-uk Kim.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168239 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 01:43:10 +00:00
Eli Friedman 612db2aa10 Clean up X86 target feature translation code slightly. No intended functional change. Patch by Jung-uk Kim.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168237 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 01:16:19 +00:00
Bill Wendling c35f908d81 Revert r167799. It's not really correct, and it doesn't fix the problem that it was intended to fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168217 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 23:03:00 +00:00
Chad Rosier ecf1626540 [driver] Add the missing TY_PP_ObjCXX_Alias case to the isCXX function.
This was causing different behavior when using -x objective-c++-cpp-output as
compared to -x objc++-cpp-output.  Specifically, the driver was not adding the
-fcxx-exceptions flag in the latter case.
rdar://12680312

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168212 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 22:31:39 +00:00
Dmitri Gribenko 95f6190acb StmtDumper: remove incomplete support for limiting the maximum dump depth.
There are better ways of limiting the amount of information if there is a need
for that.

Patch by Philip Craig.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168206 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 21:43:31 +00:00
Daniel Jasper 5f684e90c2 Fix partial-match-bind-behavior with forEachDescendant() matchers.
The problem is that a partial match of an (explicit or implicit) allOf matcher
binds results, i.e.

recordDecl(decl().bind("x"), hasName("A"))

can very well bind a record that is not named "A". With this fix, the common
cases of stumbling over this bug are fixed by the BoundNodesMap overwriting the
results of a partial match. An error can still be created with a weird
combination of anyOf and allOf (see inactive test). We need to decide whether
this is worth fixing, as the fix will have performance impact.

Review: http://llvm-reviews.chandlerc.com/D124

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168177 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 18:39:22 +00:00
Benjamin Kramer 9ecf6428ac Make libASTMatchers link its dependencies. libRewriteFrontend depends on libRewriteCore.
LLVM_USED_LIBS does nothing here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168172 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 17:30:58 +00:00
Alexey Samsonov 75fcb193ae UBSan: enable proper linking with UBsan runtime on Darwin. Turn on building ubsan on OS X in 'make' build system. Patch by Jean-Daniel Dupas.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168168 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 12:53:14 +00:00
Nick Lewycky 4a9e60fc7c Store this Decl* as a Decl* instead of a uintptr_t. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168145 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 08:40:59 +00:00
Douglas Gregor 49a87549f4 Since CreateTargetInfo is taking ownership of the target options, pass
it as a pointer. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168136 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 04:24:59 +00:00
Argyrios Kyrtzidis 7fdc8fdbfe [libclang] When caching code-completion results, pass the CachedCompletionAllocator
to the CodeCompletionTUInfo that is going to be used to get the results.

Previously we would use ASTUnit's CodeCompletionTUInfo which has its own allocator
that will go away when we reparse. That could result in a use-after-free bug when
getting the parent context name from a CodeCompletionString.

Addresses rdar://12568377.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168133 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 03:34:57 +00:00
Daniel Dunbar 2a9be3e5b0 CPP Output: Do not emit an enter file marker for the main file.
- This diverges from gcc, and confuses tools (like dtrace) which track # line
   markers as a way to determine which content is in the context of the main
   file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168128 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 01:51:11 +00:00
Richard Trieu 8f50b24c8b Take into account the zero sign bit for positive numbers when computing the bit
width of an enum with negative values in IntRange.  Include a test for
-Wtautological-constant-out-of-range-compare where this had manifested.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168126 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 01:32:40 +00:00
Matt Beaumont-Gay 0bbf1c668e Fix PR14321, a crash when Clang is built with GCC 4.7 at -O1 or greater.
GCC 4.7 reuses stack slots fairly aggressively, which exposes more temporary
lifetime bugs.

No new test, this was caught by the existing CodeGenCXX/mangle-ms-templates.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168124 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 01:14:52 +00:00
Richard Smith 426391cd51 A step towards sorting out handling of triviality of special members in C++11.
Separate out the notions of 'has a trivial special member' and 'has a
non-trivial special member', and use them appropriately. These are not
opposites of one another (there might be no special member, or in C++11 there
might be a trivial one and a non-trivial one). The CXXRecordDecl predicates
continue to produce incorrect results, but do so in fewer cases now, and
they document the cases where they might be wrong.

No functionality changes are intended here (they will come when the predicates
start producing the right answers...).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168119 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-16 00:53:38 +00:00
Eli Friedman 84fd6df966 Make sure CodeGenTypes correctly reconverts function types. Fixes PR14355, a crash in IR generation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168112 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 23:40:48 +00:00
Richard Smith 6f9a445760 PR9903: Recover from a member functon declared with the 'typedef' specifier by
dropping the specifier, just like we do for non-member functions and function
templates declared 'typedef'. Patch by Brian Brooks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168108 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 22:54:20 +00:00
Jordan Rose 84e1513beb [analyzer] Fix a use-after-free introduced in r168019.
In code like this:

void foo() {
     bar();
     baz();
}

...the location for the call to 'bar()' was being used as a backup location
for the call to 'baz()'. This is fine unless the call to 'bar()' is deemed
uninteresting and that part of the path deleted.

(This looks like a logic error as well, but in practice the only way 'baz()'
could have an invalid location is if the entire body of 'foo()' is
synthesized, meaning the call to 'bar()' will be using the location of the
call to 'foo()' anyway. Nevertheless, the new version better matches the
intent of the code.)

Found by Matt Beaumont-Gay using ASan. Thanks, Matt!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168080 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 20:10:05 +00:00
Douglas Gregor 71f49f5d8f If an excluded header does not exist, just ignore it
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168077 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 19:47:16 +00:00
Jordan Rose 63bc186d6a [analyzer] Report leaks at the closing brace of a function body.
This fixes a few cases where we'd emit path notes like this:

  +---+
 1|   v
  p = malloc(len);
  ^   |2
  +---+

In general this should make path notes more consistent and more correct,
especially in cases where the leak happens on the false branch of an if
that jumps directly to the end of the function. There are a couple places
where the leak is reported farther away from the cause; these are usually
cases where there are several levels of nested braces before the end of
the function. This still matches our current behavior for when there /is/
a statement after all the braces, though.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168070 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 19:11:43 +00:00
Jordan Rose f34a5791c5 [analyzer] StreamChecker: Remove now-unnecessary check::EndPath callback.
Also, don't bother to stop tracking symbols in the return value, either.
They are now properly considered live during checkDeadSymbols.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168069 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 19:11:38 +00:00
Jordan Rose 7f82bc87c9 [analyzer] MacOSKeychainAPIChecker: Remove now-unnecessary check::EndPath.
Also, don't bother to stop tracking symbols in the return value, either.
They are now properly considered live during checkDeadSymbols.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168068 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 19:11:35 +00:00
Jordan Rose 65d4bd60ec [analyzer] MallocChecker: Remove now-unnecessary check::EndPath callback.
Also, don't bother to stop tracking symbols in the return value, either.
They are now properly considered live during checkDeadSymbols.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168067 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 19:11:33 +00:00
Jordan Rose 84c484545c [analyzer] Mark symbol values as dead in the environment.
This allows us to properly remove dead bindings at the end of the top-level
stack frame, using the ReturnStmt, if there is one, to keep the return value
live. This in turn removes the need for a check::EndPath callback in leak
checkers.

This does cause some changes in the path notes for leak checkers. Previously,
a leak would be reported at the location of the closing brace in a function.
Now, it gets reported at the last statement. This matches the way leaks are
currently reported for inlined functions, but is less than ideal for both.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168066 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 19:11:27 +00:00
Fariborz Jahanian 3d145f660a block extended signatur option. Change previous option
to a cc1 -fencode-extended-block-signature and pass it
to cc1 and recognize this option to produce extended block
type signature. // rdar://12109031 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168063 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 19:02:45 +00:00
Argyrios Kyrtzidis 992d917421 [modules] Use a memory buffer directly as input for the module includes,
instead of messing with virtual files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168062 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 18:57:27 +00:00
Argyrios Kyrtzidis 958bcaf3d4 [modules] Setup the import location of a module file and use it
as the include location of the main file of an imported module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168061 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 18:57:22 +00:00
Benjamin Kramer 8fd8ee9b71 Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168047 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 16:40:35 +00:00
Benjamin Kramer 1b48633d30 Do not cache a pointer to ExprEvalContexts.back().
It may become a dangling pointer if the underlying SmallVector reallocates.
Sadly the testcase is really large and doesn't reduce well because of
SmallVector's reallocation patterns.

Fixes PR14336.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168045 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 15:18:42 +00:00
Dmitri Gribenko c4a77906c2 Use empty parens for empty function parameter list instead of '(void)'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168041 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 14:28:07 +00:00
Nick Lewycky 621ba4f0db Teach the uninitialized field warning about anonymous structs and union members.
Fixes PR14073!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168031 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 08:19:20 +00:00
Lang Hames 931c083381 Make -ffp-contract a codegen option, rather than a laguage option. This makes
more sense anyway - it determines how expressions are codegen'd. It also ensures
that -ffp-contract=fast has the intended effect when compiling LLVM IR.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168027 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 07:51:26 +00:00
Nick Lewycky 5bab9ae87c Revert r167567, restoring the ability of clang to run gcc in cases where it
can't handle the input file type. This resulted in PR14338.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168024 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 05:36:36 +00:00
Richard Trieu 5d1cf4f292 Fix an off-by-one error by switching < to <= in -Wtautological-constant-out-of-range-compare and added test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168023 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 03:43:50 +00:00
Daniel Jasper 278057fd9f Do not use data recursion in ASTMatchFinder.
The matchers rely on the complete AST being traversed as shown by the new test cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168022 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 03:29:05 +00:00
Jordan Rose 368f3b070e [analyzer] Make sure calls in synthesized functions have valid path locations.
We do this by using the "most recent" good location: if a synthesized
function 'A' calls another function 'B', the path notes for the call to 'B'
will be placed at the same location as the path note for calling 'A'.

Similarly, the call to 'A' will have a note saying "Entered call from...",
and now we just don't emit that (since the user doesn't have a body to look
at anyway).

Previously, we were doing this for the "Calling..." notes, but not for the
"Entered call from..." or "Returning to caller". This caused a crash when
the path entered and then exiting a call within a synthesized body.

<rdar://problem/12657843>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168019 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 02:07:23 +00:00
Eli Friedman 5b64e77c2d Fix a trivial bool-related bug I spotted while skimming David Fang's
current list of powerpc-darwin8 failures.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168016 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 01:21:59 +00:00
Richard Smith d653701574 Per [basic.lookup.classref]p3, in an expression of the form p->~type-name, the
type-name is looked up in the context of the complete postfix-expression. Don't
forget to pass the scope into this lookup when the type-name is a template-id;
it might name an alias template which can't be found within the class itself.

Bug spotted by Johannes Schaub on #llvm.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168011 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 00:31:27 +00:00
Eli Friedman ebbcd1de4f Fix DiagnoseBitwisePrecedence so it doesn't cast "-1" to the type
BinaryOperator::Opcode.  This is bad form, and the behavior of the static_cast
in this case is unspecified according to the standard.

Fixes a warning that showed up from r167992 on self-host.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168010 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 00:29:07 +00:00
Eli Friedman 924d5c9853 Make template diffing handle integral expressions of various widths correctly.
PR14342.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168005 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 23:57:08 +00:00
Richard Smith 62221b17c9 Add -cc1 option -fno-diagnostics-use-presumed-location, a handy mode for
working with preprocessed testcases. This causes source locations in
diagnostics to point at the spelling location instead of the presumed location,
while still keeping the semantic effects of the line directives (entering and
leaving system-header mode, primarily).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168004 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 23:55:25 +00:00
Fariborz Jahanian 06cffc0511 objective-C blocks: under cc1 flag -encode-extended-block-signature,
generate expanded signature encoding to include types as we
already do this for protocol method lists.
// rdar://12109031


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167997 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 23:11:38 +00:00
Richard Trieu 526e627d2b Improve -Wtautological-constant-out-of-range-compare by taking into account
type conversion between integers.  This allows the warning to be more accurate.

Also, turned the warning off in an analyzer test.  The relavent test cases
are covered by the tests in Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167992 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 22:50:24 +00:00
Douglas Gregor 1cef45955d Teach the AST importer to merge enumerator constants. Fixes
<rdar://problem/12676166>, and tested on the LLDB side of the world.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167990 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 22:29:20 +00:00
Eli Friedman f5bf912767 When evaluating variably modified types for function parameters, dig out the
type as written from the ParmVarDecl; it's unclear whether the standard
(C99 6.9.1p10) requires this, but we're following the precedent set by gcc,
and hopefully nobody will ever ask about this again.

PR9559 / <rdar://problem/12621983>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167985 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 22:09:59 +00:00
Eric Christopher 825d386c1d Remove the cellspu port.
Approved by Chris Lattner.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167983 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 22:08:59 +00:00
NAKAMURA Takumi 5a95d46029 ParseTemplate.cpp: Prune obsolete descriptions in ParseSingleDeclarationAfterTemplate(), for now. [-Wdocumentation]
/// \param TemplateParams if non-NULL, the template parameter lists
/// that preceded this declaration. In this case, the declaration is a
/// template declaration, out-of-line definition of a template, or an
/// explicit template specialization. When NULL, the declaration is an
/// explicit template instantiation.
///
/// \param TemplateLoc when TemplateParams is NULL, the location of
/// the 'template' keyword that indicates that we have an explicit
/// template instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167982 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 21:45:43 +00:00
John McCall 70cd619e74 The ObjC++-to-C++ personality trick is only necessary on NeXT runtimes,
which is not coincidentally the only place it works, either (because
of how it tests for EH_TYPE symbols).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167935 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 17:48:31 +00:00
Fariborz Jahanian 7d4b9fabf3 fixes a buildbot failure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167934 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 17:43:08 +00:00
Fariborz Jahanian ccf57eab4e Fix 80-column violation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167932 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 17:27:27 +00:00
Fariborz Jahanian 3ca23d7dc6 objective-C blocks: Provide layout map for byref
variables captured in a block. // rdar://12184410



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167931 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 17:15:51 +00:00
Benjamin Kramer accaf19bc1 s/tranform/transform/
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167929 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 15:08:31 +00:00
John McCall 2b07dd350a Move some GNUStep-specific code out of CGObjCGNU.
Patch by Jonathan Schleifer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167925 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 09:08:34 +00:00
Richard Smith 93af2b8392 PR14279: Work around this major miscompilation by treating move operations as
non-trivial if they would not call a move operation, even if they would in fact
call a trivial copy operation. A proper fix is to follow, but this small
directed fix is intended for porting to the 3.2 release branch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167920 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 07:36:28 +00:00
Richard Smith 4a030228d1 When we have a MemberExpr referring to an overloaded static member function,
and we resolve it to a specific function based on the type which it's used as,
don't forget to mark it as referenced.

Fixes a regression introduced in r167514.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167918 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 07:06:31 +00:00
Logan Chien 38c5d0a8f3 Code cleanup: Remove trailing whitespace in unwind.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167915 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 06:33:58 +00:00
David Blaikie 08db94f58e Remove debugging assert.
Found by Richard Smith in post-commit review of r167906.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167911 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 04:41:34 +00:00
NAKAMURA Takumi 49193c7b0a SemaTemplateDeduction.cpp: Prune two obsolete descriptions. [-Wdocumentation]
* getMostSpecialized()

/// \param Index if non-NULL and the result of this function is non-nULL,
/// receives the index corresponding to the resulting function template
/// specialization.

* DeduceTemplateArguments()

/// \param Name the name of the function being called. This is only significant
/// when the function template is a conversion function template, in which
/// case this routine will also perform template argument deduction based on
/// the function to which

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167909 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 02:21:48 +00:00
NAKAMURA Takumi 384d3fc80f ParseTemplate.cpp: Doxygen fix in AnnotateTemplateIdToken(). [-Wdocumentation]
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167908 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 02:21:42 +00:00
Eli Friedman 4fa4b48027 Suppress elided variadic macro argument extension diagnostic for macros using
the related comma pasting extension.

In certain cases, we used to get two diagnostics for what is essentially one
extension.  This change suppresses the first diagnostic in certain cases
where we know we're going to print the second diagnostic.  The
diagnostic is redundant, and it can't be suppressed in the definition
of the macro because it points at the use of the macro, so we want to
avoid printing it if possible.

The implementation works by detecting constructs which look like comma
pasting at the time of the definition of the macro; this information
is then used when the macro is used.  (We can't actually detect
whether we're using the comma pasting extension until the macro is
actually used, but we can detecting constructs which will be comma
pasting if the varargs argument is elided.)

<rdar://problem/12292192>



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167907 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 02:18:46 +00:00
David Blaikie 66cff72576 Provide the correct mangling and linkage for certain unnamed nested classes.
This corrects the mangling and linkage of classes (& their member functions) in
cases like this:

  struct foo {
    struct {
      void func() { ... }
    } x;
  };

we were accidentally giving this nested unnamed struct 'no' linkage where it
should've had the linkage of the outer class. The mangling was incorrecty too,
mangling as TU-wide unnamed type mangling of $_X rather than class-scoped
mangling of UtX_.

This also fixes -Wunused-member-function which would incorrectly diagnose
'func' as unused due to it having no linkage & thus appearing to be TU-local
when in fact it might be correctly used in another TU.

Similar mangling should be applied to function local classes in similar cases
but I've deferred that for a subsequent patch.

Review/discussion by Richard Smith, John McCall, & especially Eli Friedman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167906 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 01:52:05 +00:00
Eli Friedman 35a2b798ef Fix an assertion failure printing the unused-label fixit in files using CRLF line endings. <rdar://problem/12639047>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167900 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 01:28:38 +00:00
Richard Smith 8c88953ff0 Remove another questionable use of hasTrivial*. The relevant thing for this
test was whether the /selected/ operator= was trivial, not whether the class
had any trivial (or any non-trivial) operator=s.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167897 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 00:50:40 +00:00
John McCall b8a8de316d Accept and pass arguments to __unknown_anytype in argument
positions of Objective-C methods.

It is possible to recover a lot of type information about
Objective-C methods from the reflective metadata for their
implementations.  This information is not rich when it
comes to struct types, however, and it is not possible to
produce a type in the debugger's round-tripped AST which
will really do anything useful during type-checking.
Therefore we allow __unknown_anytype in these positions,
which essentially disables type-checking for that argument.
We infer the parameter type to be the unqualified type of
the argument expression unless that expression is an
explicit cast, in which case it becomes the type-as-written
of that cast.

rdar://problem/12565338

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167896 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 00:49:39 +00:00
Eric Christopher 0c949efad5 Revert "Use the 'count' attribute instead of the 'upper_bound' attribute."
temporarily since it breaks the gdb bots.

This reverts commit r167807/30305bec25cac981c6d4a3b8be004401310a82a7.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167887 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 23:30:57 +00:00
Eli Friedman 25f071eedf Don't try to save the assigned value in a Objective-C property assignment
if the type of the value is a non-trivial class type.  Fixes PR14318.

(There's a minor ObjC++ language change here: given that we can't save the
value, the type of the assignment expression is void in such cases.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167884 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 23:16:33 +00:00
Nico Weber 0a26d7680d [ms] Make mangleIntegerLiteral less aware of exact type of the literal.
Integer literal mangling does not actually depend on exact type of the literal.
This will simplify calling mangleIntegerLiteral when literal type is not known,
for example, when sizes or offsets are mangled as integer literals.

Also, call mangleNumber instead of directly printing mangled values of 0/1, to
avoid this knowledge from being in multiple places.

Patch from Evgeny Eltsin!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167878 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 22:09:44 +00:00
Kaelyn Uhrain 97c81bfaf0 For classes that have the warn_unused_result attribute, don't apply the
attribute to the class' methods even when they return an instance of the
class (e.g. assignment operators).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167873 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 21:23:31 +00:00
Anna Zaks 2ccecfaa48 [analyzer] Address Jordan's code review for r167813.
This simplifies logic, fixes a bug, and adds a test case.
Thanks Jordan!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167868 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 19:47:40 +00:00
Daniel Dunbar 6e64973789 Revert r167801, "[preprocessor] When #including something that contributes no
tokens at all,". This change broke External/Nurbs in LLVM test-suite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167858 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 19:12:37 +00:00
David Blaikie e5afdcfd6a Simplify function try/catch scope handling.
Based on post-commit review feedback for r167766 by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167856 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 18:51:45 +00:00
Daniel Jasper b55c67d5e3 Fix AST-matcher descendant visiting for Types, TypeLocs and NestedNamespecifierLocs.
The RecursiveASTVisitor assumes that any given Traverse-method can be called with a NULL-node. So the subclass needs to handle these appropriately.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167850 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 17:14:11 +00:00
Benjamin Kramer b12ecd3a3e This patch makes the behavior of clang consistent with the behavior of gcc 4.6 in cases where both -fPIC and -fPIE is used.
- Separately check if -fPIE was specified in the command line and define both __PIC__ and __PIE__ when -fPIE is used. We need to check this separately because -fPIE will infer -fPIC even if its not explicitly used.
- Fixed existing tests.
- Added new tests for cases where both -fPIC and -fPIE is used.

Author: Tareq A. Siraj <tareq.a.siraj@intel.com>
Fixes: PR13221
Review: http://llvm-reviews.chandlerc.com/D94

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167846 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 15:32:35 +00:00
Nico Weber dd81731d82 UCNs in char literals are done (in LiteralSupport), remove FIXME. Expand UCN FIXME in LexNumericConstant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167818 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 06:25:15 +00:00
Argyrios Kyrtzidis 8682b93b34 Copy the decls returned by DeclContext::lookup_result to a
new container so we can safely iterate over them.

The container holding the lookup decls can under certain conditions
be changed while iterating (e.g. because of deserialization).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167816 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 05:07:23 +00:00
Anna Zaks 4141e4dcab Fix a Malloc Checker FP by tracking return values from initWithCharacter
and other functions.

When these functions return null, the pointer is not freed by
them/ownership is not transfered. So we should allow the user to free
the pointer by calling another function when the return value is NULL.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167813 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 03:18:01 +00:00
Bill Wendling 30305bec25 Use the 'count' attribute instead of the 'upper_bound' attribute.
If we have a type 'int a[1]' and a type 'int b[0]', the generated DWARF is the
same for both of them because we use the 'upper_bound' attribute. Instead use
the 'count' attrbute, which gives the correct number of elements in the array.
<rdar://problem/12566646>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167807 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 02:31:58 +00:00
Eli Friedman 8187c7e488 Fix IR generation for bool on PPC (and any other target where bool is not 8 bits in memory).
PR11777.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167802 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 02:05:15 +00:00
Argyrios Kyrtzidis 4d10b40ea8 [preprocessor] When #including something that contributes no tokens at all,
don't recursively continue lexing.

This avoids a stack overflow with a sequence of many empty #includes.
rdar://11988695

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167801 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 01:03:15 +00:00
Argyrios Kyrtzidis 3185d4ac30 In Lexer::LexTokenInternal, avoid code duplication; no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167800 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 01:02:40 +00:00
Bill Wendling a50059e343 Disable accelerator tables when compiling with LTO.
LTO doesn't generate correct accelerator tables. This is due to the general lack
correct of debug info for LTO. Disable it when using LTO.
<rdar://problem/12401423>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167799 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 00:54:24 +00:00
Richard Smith 044c8aa39d Fix some wrong-code bugs in implicitly-defined assignment operators:
- In C++11, perform overload resolution over all assignment operators, rather than just looking for copy/move assignment operators.
 - Clean up after temporaries produced by operator= immediately, rather than accumulating them until the end of the function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167798 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 00:54:12 +00:00
Kaelyn Uhrain d449c792d9 A couple of small fixes to r167783
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167791 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 00:18:47 +00:00
Anna Zaks bae930d4c6 [analyzer] Address Jordan's feedback for r167780.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167790 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 00:13:44 +00:00
Ted Kremenek 8f81acfa95 Fix bad CFG construction bug when handling C++ 'try' statements.
This code assigned the last created CFGBlock* to the variable 'Block',
which is a scratch variable which is null'ed out after a block is
completed.  By assigning the last created block to 'Block', we start
editing a completed block, inserting CFGStmts that should be in
another block.  This was the case with 'try'.  The test case that
showed this had a while loop inside a 'try', and the logic before
the while loop was being included as part of the "condition block"
for the loop.  This showed up as a bogus dead store, but could
have lots of implications.

Turns out this bug was replicated a few times within CFG.cpp, so
I went and fixed up those as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167788 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 00:12:13 +00:00
Nick Lewycky d05df512cd When filtering the list of associated namespaces so that we don't suggest people
add functions to namespace 'std', also filter out namespaces with '__' anywhere
in the name.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167786 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 00:08:34 +00:00
Kaelyn Uhrain 51ceb7bab5 Enable C++11 attribute syntax for warn_unused_result and allow it to be
applied to CXXRecordDecls, where functions with that return type will
inherit the warn_unused_result attribute.

Also includes a tiny fix (with no discernable behavior change for
existing code) to re-sync AttributeDeclKind enum and
err_attribute_wrong_decl_type with warn_attribute_wrong_decl_type since
the enum is used with both diagnostic messages to chose the correct
description.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167783 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 23:48:05 +00:00
Anna Zaks d51db49357 [analyzer] Follow up to r167762 - precisely determine the adjustment
conditions.

The adjustment is needed only in case of dynamic dispatch performed by
the analyzer - when the runtime declaration is different from the static
one.

Document this explicitly in the code (by adding a helper). Also, use
canonical Decls to avoid matching against the case where the definition
is different from found declaration.

This fix suppresses the testcase I added in r167762, so add another
testcase to make sure we do test commit r167762.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167780 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 23:40:29 +00:00
Richard Smith e7ce709460 Factor duplicated implicit memcpy call generation code out of copy/move
assignment generation. This incidentally avoids reusing the same Expr* across
multiple statements in the same object; that was generating slightly broken
ASTs, but I couldn't trigger any observable bad behavior, so no test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167779 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 23:33:00 +00:00
Eric Christopher 6ceb377ae4 Finish reverting r167761, it's causing test failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167777 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 23:13:34 +00:00
David Blaikie 3a9fefed07 Fix more try scoping bugs introduced by r167650.
Introduces more clear scoping flags & flag combinations which should hopefully
be more understandable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167766 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 22:25:41 +00:00
Anna Zaks e7ad14e182 [analyzer] Fix a regression (from r 165079): compare canonical types.
Suppresses a leak false positive (radar://12663777).

In addition, we'll need to rewrite the adjustReturnValue() method not to
return UnknownVal by default, but rather assert in cases we cannot
handle. To make it possible, we need to correctly handle some of the
edge cases we already know about.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167762 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 22:06:24 +00:00
Bill Wendling 5ece32e335 Don't test for incomplete types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167761 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 22:01:56 +00:00
Richard Smith 5f9a7e31d0 Remove abuse of hasTrivial*, and fix miscompile wherein global arrays with
internal linkage, no uses, trivial construction, and nontrivial destruction
were not emitted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167756 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 21:38:00 +00:00
Ted Kremenek 3078353fb5 Per discussion on cfe-dev, re-enable suppression of -Wimplicit-fallthrough on C, but also include dialects of C++ earlier than C++11.
There was enough consensus that we *can* get a good language solution
to have an annotation outside of C++11, and without this annotation
this warning doesn't quite mean's completeness criteria for this
kind of warning.  For now, restrict this warning to C++11 (where an
annotation exists), and make this the behavior for the LLVM 3.2 release.
Afterwards, we will hammer out a language solution that we are all
happy with.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167749 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 21:20:48 +00:00
David Blaikie 731de313f7 80 cols & unnecessary braces from r167736.
Post-commit review feedback by Eli Friedman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167739 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 19:32:32 +00:00
David Blaikie 383ec17eca Correct printing of nested anonymous type member accesses.
Patch by Florent Bruneau!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167736 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 19:12:12 +00:00
Bill Wendling f634bdfbf4 The register constraint could mean a 16- or 8-bit register.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167735 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 18:52:32 +00:00
Bill Wendling 68fd608c2c Check that the input size is correct for the given constraint.
The 'a', 'c', and 'd' constraints on i386 mean a 32-bit register. We cannot
place a 64-bit value into the 32-bit register. Error out instead of causing the
compiler to spew general badness.
<rdar://problem/12415959>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167717 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 06:42:51 +00:00
Rafael Espindola c6b82c353b Remove calls to getMostRecentDecl. The case they were added for in r117526 are
now covered by attribute merging.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167714 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 04:32:23 +00:00
Rafael Espindola 538fb98685 In Sema::MergeVarDecl we handle merging of storage classes and visibility
attributes. In cases where the merged declaration is fully equivalent to the
two original ones, some of the code was getLVForDecl was duplicated.

Cases that are still handled in getLVForDecl are things like

__private_extern__ int N;
int N;

For which we cannot produce a single merged decl with all the information.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167703 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 04:10:23 +00:00
Daniel Jasper 11c98771ba Fix binding of nodes in case of forEach..() matchers.
When recursively visiting the generated matches, the aggregated bindings need
to be copied during the recursion. Otherwise, we they might not be properly
overwritten (which is shown by the test), or there might be bound nodes present
that were bound on a different matching branch.

Review: http://llvm-reviews.chandlerc.com/D112

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167695 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-11 22:14:55 +00:00
Nico Weber 18f236886b Remove unneeded includes from IdentifierTable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167694 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-11 21:39:39 +00:00
Nico Weber bb23628148 s/BCPLComment/LineComment/
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167690 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-11 07:02:14 +00:00
Fariborz Jahanian a97d2ecca7 objective-C blocks: Change BLOCK_HAS_EXTENDED_LAYOUT to be 1<<31.
lower 24bit is currently being used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167678 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10 18:30:40 +00:00
Douglas Gregor 229d47aef2 Rework my implementation of circular-reference finding to not use
CXXRecordDecl::forallBases, which does *not* do what I need. Fixes the
failure introduced in r167651.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167668 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10 07:24:09 +00:00
Michael Liao 463eb89d5e Add clang support of RTM from TSX
- New options '-mrtm'/'-mno-rtm' are added to enable/disable RTM feature
- Builtin macro '__RTM__' is defined if RTM feature is enabled
- RTM intrinsic header is added and introduces 3 new intrinsics, namely
  '_xbegin', '_xend', and '_xabort'.
- 3 new builtins are added to keep compatible with gcc, namely
  '__builtin_ia32_xbegin', '__builtin_ia32_xend', and '__builtin_ia32_xabort'.
- Test cases for pre-defined macro and new intrinsic codegen are added.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167665 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10 05:17:46 +00:00
Ted Kremenek 3e7735183b Revert "Disable -Wimplicit-fallthrough when not using C++.", pending further discussion on cfe-dev.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167662 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10 04:03:41 +00:00
Ted Kremenek 6e3ceb54a0 Disable -Wimplicit-fallthrough when not using C++.
The rationale is that there is no good workflow to silence the warning
for specific cases, other than using pragmas.  This is because the
attribute to decorate an explicit fall through is only available
in C++11.

By that argument, this should probably also be disabled unless one
is using C++11, but apparently there is an explicit test case for
this warning when using C++98.  This will require further discussion
on cfe-commits.

Fixes:  <rdar://problem/12584746>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167655 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10 01:47:40 +00:00
Jordan Rose 4e674f7715 [analyzer] When invalidating symbolic offset regions, take fields into account.
Previously, RegionStore was being VERY conservative in saying that because
p[i].x and p[i].y have a concrete base region of 'p', they might overlap.
Now, we check the chain of fields back up to the base object and check if
they match.

This only kicks in when dealing with symbolic offset regions because
RegionStore's "base+offset" representation of concrete offset regions loses
all information about fields. In cases where all offsets are concrete
(s.x and s.y), RegionStore will already do the right thing, but mixing
concrete and symbolic offsets can cause bindings to be invalidated that
are known to not overlap (e.g. p[0].x and p[i].y).
This additional refinement is tracked by <rdar://problem/12676180>.

<rdar://problem/12530149>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167654 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10 01:40:08 +00:00
David Blaikie 3d512d8a75 Handle redeclarations of catch variables in catch blocks.
Fix to regression caused by r167650, caught by Richard Smith in code review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167653 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10 01:38:24 +00:00
Douglas Gregor d777e28451 Diagnostic circular inheritance involving dependent base classes. We
would have diagnosed this at instantiation time anyway, if only we
didn't hang on all of these test cases. Fixes <rdar://problem/12629723>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167651 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10 01:18:17 +00:00
David Blaikie c4027c82ad PR14296: function parameter name collisions in function try/catch
C++11 3.3.3/2 "A parameter name shall not be redeclared in the outermost block
of the function definition nor in the outermost block of any handler associated
with a function-try-block."

It's not totally clear to me whether the "FIXME" case is covered by this, but
Richard Smith thinks it probably should be. It's just a bit more involved to
fix that case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167650 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10 01:04:23 +00:00
Eli Friedman 75e8efef96 Make __LDBL_MAX__ etc. have the correct type on targets where long double/double/etc. have the same format. PR14285.
Based on patch by Jeroen Dobbelaere.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167649 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10 00:20:38 +00:00
Jordan Rose 87da0b7576 -Wobjc-literal-compare: look through implicit casts.
This warning was failing to fire under ARC because of the implicit
lifetime casts added around the object literal expression.

<rdar://problem/11300873>, again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167648 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 23:55:21 +00:00
Richard Smith a67d503aa1 PR13788: Don't perform checks on the initializer of a dependently-typed
variable. Previously we didn't notice the type was dependent if the only
dependence came from an array bound.

Patch by Brian Brooks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167642 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 23:03:14 +00:00
Richard Smith f1eaab1229 PR14303: Add a NoDriverOption flag to those options which are not accepted by
the driver (the options defined in CC1Options.td) and exclude their help from
"clang --help".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167638 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 22:36:44 +00:00
Argyrios Kyrtzidis 9410928fb8 Add a SourceLocation::printToString() that returns in a std::string what dump()
writes to stderr; for debugging purposes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167629 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 19:40:48 +00:00
Argyrios Kyrtzidis ecd27bf256 Add a FileCharacteristic parameter to SourceManager::createFileIDForMemBuffer
for completeness and use it in CompilerInstance::InitializeSourceManager if
the input is a memory buffer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167628 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 19:40:45 +00:00
Argyrios Kyrtzidis 8616f9af65 Turn FrontendInputFile into an immutable class and have it also accept
a memory buffer instead of only a filename.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167627 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 19:40:39 +00:00
Argyrios Kyrtzidis 8e1fbbc492 Make CompilerInstance::InitializeSourceManager accept a FrontendInputFile,
no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167626 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 19:40:33 +00:00
Chad Rosier 485577dcac Implement -mstrict-align using '-backend-option -arm-strict-align' as this saves
us from having to make any backend changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167623 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 18:27:01 +00:00
Chad Rosier 7e29327628 [driver] Add a -mstrict-align compiler option for ARM targets.
rdar://12340498

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167619 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 17:29:19 +00:00
Andy Gibbs 02f0022dfc Improved support for removing the comma preceding __VA_ARGS__ where __VA_ARGS__
is empty in a variadic macro expansion.  This fixes a divergence in support for
the ", ## __VA_ARGS__" GCC extension which differed in behaviour when in strict
C99 mode (note: there is no change in behaviour has been made in the gnu99 mode
that clang uses by default).  In addition, there is improved support for the
Microsoft alternative extension ", __VA_ARGS__".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167613 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 13:24:30 +00:00
Nico Weber 1a52a4d36c Use isInvalidDecl() instead of isStatic() as suggested by dblaikie.
I couldn't think of a way to make an operator() invalid without returning
earlier from this function other than making it static, so no new test.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167609 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 08:38:04 +00:00
Nico Weber e0ff690900 Don't crash on calling static member overloaded operator, PR14120
Patch from Brian Brooks!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167604 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 06:06:14 +00:00
Bob Wilson 377e5c108b Remove old driver code to grab the iOS simulator version from the -D option.
We can now rely on the -mios-simulator-version-min command line option
and remove the awful hack. <rdar://problem/10304510>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167603 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 01:59:30 +00:00
Nico Weber c8e78b2c8e [ms] Implement int64_t version of mangleNumber() in terms of the APSInt version.
No intended functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167602 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09 00:05:56 +00:00
Nico Weber e95b46bf50 [Windows] Fix mangling of number literal '0'
Do this by making the mangleNumber(APSInt) overload look like
the int64_t version. (The latter should probably just delegate
to the former).

Test from Evgeny Eltsin!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167599 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 23:38:59 +00:00
Bob Wilson 458871a13c Remove more code related to invoking llvm-gcc. <rdar://problem/11991320>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167598 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 23:21:22 +00:00
David Blaikie c2fc67e0cf Fix a source range regression in C++ new expressions with call initializers.
Introduced in r167507, discovered in review by Abramo Bagnara.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167597 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 22:53:48 +00:00
Matt Beaumont-Gay 45a37da030 Fix a bug I found while preparing my devmtg talk: When passing NULL to a
function that takes a const Foo&, where Foo is convertible from a large number
of pointer types, we print ALL the overloads, no matter the setting of
-fshow-overloads.

There is potential follow-on work in unifying the "print candidates, but not
too many" logic between OverloadCandidateSet::NoteCandidates and
ImplicitConversionSequence::DiagnoseAmbiguousConversion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167596 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 20:50:02 +00:00
Benjamin Kramer 4f056ac7f8 LiteralSupport: Don't overflow the temporary buffer when decoding invalid string parts.
Instead just use a dummy buffer, we're not going to use the decoded string anyways.
Fixes PR14292.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167594 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 19:22:31 +00:00
Benjamin Kramer 5d704fef6e LiteralSupport: Clean up style violations. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167593 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 19:22:26 +00:00
Abramo Bagnara 23700f083f Allow to pass from syntactic form of InitListExpr to semantic form (just as viceversa). No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167591 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 18:41:43 +00:00
Abramo Bagnara 88adb9863b Avoid to write function name in comment. Thanks to Dmitri Gribenko.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167588 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 16:27:30 +00:00
Abramo Bagnara eae859a61f Readded line removed by mistake.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167587 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 16:01:51 +00:00
Abramo Bagnara 4c5750e0d1 Fixed converted ConstantArrayTypeLoc range. Added a missing testcase for ConstructorDecl source range.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167583 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 14:44:42 +00:00
Abramo Bagnara 13fd684ee2 Fixed range of implicit MemberExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167581 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 13:52:58 +00:00
Benjamin Kramer ef7bceadf4 Set TLSSupported to false on Haiku.
Haiku does not support this (yet). Leaving it set to true leads to
configure scripts detecting __thread being available and Clang emitting
code for it, resulting in binaries the runtime_loader will refuse to
load.

Patch by Jonathan Schleifer!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167576 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 12:59:15 +00:00
Daniel Dunbar d2a527eae6 Driver/Darwin: The -arch argument values aren't exactly the arch names from a
triple.

 - Translate the special case of powerpc to its expected -arch name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167571 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 03:38:26 +00:00
Bob Wilson 85b7f7ddf2 Rip out a bunch of code for invoking gcc from clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167567 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 01:03:34 +00:00
Bob Wilson 64c4f29ff3 Remove code to fall back to llvm-gcc for i386 kexts.
More cleanups to follow in separate commits....

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167566 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 01:03:29 +00:00
David Blaikie e81b43bc30 PR14284: crash on ext-valid returning NULL from a void function
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167565 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 00:41:20 +00:00
Richard Smith e938536306 When deciding whether to convert an array construction loop into a memcpy, look
at whether the *selected* constructor would be trivial rather than considering
whether the array's element type has *any* non-trivial constructors of the
relevant kind.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167562 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 23:56:21 +00:00
Michael J. Spencer da05df7ac9 [Driver] Fix -Wp,-MMD pr13959
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167559 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 23:37:14 +00:00
Nico Weber 7b89ab735e Reduce nesting. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167551 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 21:31:36 +00:00
Richard Trieu 910515bc02 When template deduction fails on a derived class, try a template deduction on
the base class.  If the base class deduction succeeds, use those results.  If
it fails, keep using the results from the derived class template deduction.

This prevents an assertion later where the type of deduction failure doesn't
match up with the template deduction info.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167550 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 21:17:13 +00:00
Fariborz Jahanian 1da01d6908 objective-C blocks: bring back the CharUnit patch for
captured block variable layout meta-data. No intended change
in functionality.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167549 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 20:00:32 +00:00
David Blaikie b578aee665 PR12713 - crash on invalid due to unmatched parens in decltype
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167547 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 19:08:05 +00:00
Fariborz Jahanian 3b45ca9e62 objective-C modern translator. Start the line
directive on a new line.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167542 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 18:15:53 +00:00
Douglas Gregor 7cdd28162d When loading a module fails because it is out of date, rebuild that
module in place. <rdar://problem/10138913>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167539 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 17:46:15 +00:00
Jordan Rose 0fe4d400ab [analyzer] Check that the argument to CFMakeCollectable is non-NULL.
Patch by Sean McBride!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167537 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 17:12:37 +00:00
David Chisnall c686004145 Fix the Objective-C exception rethrow from cleanups (GNU runtimes). Note that
a bug in the inliner still causes the wrong thing to happen at -O2 and above
(PR14116).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167534 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 16:50:40 +00:00
Jordan Rose 65bc653750 [analyzer] Enhance docs for checker callbacks (esp. processRegionChanges).
No functionality change; this checker is only used for documentation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167522 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 02:35:02 +00:00
Richard Smith ce2661f9cc PR11851 (and duplicates): Whenever a constexpr function is referenced,
instantiate it if it can be instantiated and implicitly define it if it can be
implicitly defined. This matches g++'s approach. Remove some cases from
SemaOverload which were marking functions as referenced when just planning how
overload resolution would proceed; such cases are not actually references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167514 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 01:14:25 +00:00
Fariborz Jahanian 43f4f1e92b modern ObjC translator. Insert line number for @synchronized statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167511 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 00:43:05 +00:00
Eli Friedman b68ec6b7ff Add missing check to warning for packed attribute. PR14259.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167510 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 00:35:20 +00:00
Manuel Klimek cb7b45e6d8 Create helper functions in StmtDumper for outputting the indentation, newlines, and brackets.
This is preparation for adding Decl dumping.

Patch by Philip Craig.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167509 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 00:33:12 +00:00
David Blaikie 530564196f PR13552: Fix the end location of a CXXNewExpr.
Spent longer than reasonable looking for a nice way to test this & decided to
give up for now. Open to suggestions/requests. Richard Smith suggested adding
something to ASTMatchers but it wasn't readily apparent how to test this with
that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167507 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-07 00:12:38 +00:00
Eli Friedman 70a0189800 Fix assertion failure with auto and nested initializer list; PR14272.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167506 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-06 23:56:42 +00:00