Commit Graph

41808 Commits

Author SHA1 Message Date
Richard Smith 9219d1b764 Allow an ASTConsumer to selectively skip function bodies while parsing. Patch
by Olivier Goffart!

llvm-svn: 168726
2012-11-27 21:31:01 +00:00
Richard Smith 7d125a11f1 Simplify checking for whether we should implicitly declare special members and
add some assertions. No functionality change.

llvm-svn: 168725
2012-11-27 21:20:31 +00:00
Chad Rosier 546c261e7e Remove an extra semicolon.
llvm-svn: 168707
2012-11-27 17:31:26 +00:00
Rafael Espindola e3cfca7aa2 Fix examples.
llvm-svn: 168705
2012-11-27 16:16:02 +00:00
Rafael Espindola b0448cd52a Remove some dead code. CLANG_IS_PRODUCTION is now just a build flag and
is not used in any #ifdef.

llvm-svn: 168703
2012-11-27 16:10:37 +00:00
Will Dietz 1897cb3b9c Add -fsanitize=integer for reporting suspicious integer behaviors.
Introduces new sanitizer "unsigned-integer-overflow".

llvm-svn: 168701
2012-11-27 15:01:55 +00:00
Timur Iskhodzhanov b7029398f3 Remove outdated FIXME; should have removed that in r160782
llvm-svn: 168698
2012-11-27 12:55:47 +00:00
NAKAMURA Takumi eb360a0d4f clang/test/lit.cfg: Disable dev-fd-fs on cygwin for now.
open("/dev/fd/1-foobar") fails with EEXIST on cygwin.

llvm-svn: 168676
2012-11-27 05:25:41 +00:00
Eli Friedman 6fdc1221c7 Test for r168674.
llvm-svn: 168675
2012-11-27 02:58:49 +00:00
Eli Friedman 4e91899e7b Fix the definition of the vfork() builtin on Haiku. PR14378.
llvm-svn: 168674
2012-11-27 02:58:24 +00:00
Bill Schmidt 90b22c9de6 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.

llvm-svn: 168673
2012-11-27 02:46:43 +00:00
Jordan Rose a333f3fba1 scan-build: Respect TMPDIR on all platforms, not just Darwin (PR14438).
llvm-svn: 168672
2012-11-27 02:37:59 +00:00
Jordan Rose 3ba8c792e5 [analyzer] Fix test to work on non-LP64 systems.
Thanks for the original catch in r168303, Takumi.

llvm-svn: 168671
2012-11-27 02:37:49 +00:00
Rafael Espindola 9c235640e1 Add a testcase that r168411 would break.
llvm-svn: 168669
2012-11-27 01:56:54 +00:00
Rafael Espindola 7dc71d03b9 Revert r168411 for now.
llvm-svn: 168667
2012-11-27 01:44:24 +00:00
Richard Smith f2294a1f03 Duplicate some common owners between Clang and LLVM.
llvm-svn: 168650
2012-11-27 00:48:12 +00:00
Richard Smith 2e723f5807 Move Clang code owners list from llvm/ to cfe/.
llvm-svn: 168639
2012-11-27 00:39:30 +00:00
Daniel Dunbar db0745ab86 Frontend: Create a virtual file for named pipe inputs.
- This ensures we see the right buffer size for the file.

llvm-svn: 168636
2012-11-27 00:04:16 +00:00
Michael Han 9407e50b04 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!

llvm-svn: 168626
2012-11-26 22:54:45 +00:00
Eli Friedman 102dc4e30d 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.

llvm-svn: 168618
2012-11-26 21:57:28 +00:00
Sebastian Pop 3ff4416458 check that always_inline attribute works with -fno-inline
Clean up the existing test to use FileCheck.

llvm-svn: 168607
2012-11-26 20:44:46 +00:00
Jordan Rose 64e4cf001b [analyzer] SATestBuild.py: allow make builds to disable parallelization
Before, SATestBuild unilaterally added '-j<n>' to every project built with
'make'. Now, we check and see if there's a -j option already specified, which
allows a project to explicitly be marked '-j1'.

llvm-svn: 168603
2012-11-26 19:59:57 +00:00
Anna Zaks e3beeaa5e7 [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.

llvm-svn: 168599
2012-11-26 19:11:46 +00:00
Anton Korobeynikov c5a7f92854 MSPGCC renamed ISR vectors from vector_<address> to __isr_<number>. This patch makes Clang reflect this scheme.
Patch by Job Noorman!

llvm-svn: 168598
2012-11-26 18:59:10 +00:00
Timur Iskhodzhanov 09848e709c Fix PR14413 - incorrect mangling of anonymous namespaces with -cxx-abi microsoft
llvm-svn: 168583
2012-11-26 08:55:48 +00:00
Richard Smith dd2ca571ae 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.

llvm-svn: 168582
2012-11-26 08:32:48 +00:00
Rafael Espindola befe130dd2 Add r168519 back, but with a fix to also merge the used flag in variables.
llvm-svn: 168564
2012-11-25 14:07:59 +00:00
Rafael Espindola 48cf0dc360 Add a basic testcase for the "variable is not needed" warning and one that
regressed in r168519.

llvm-svn: 168563
2012-11-25 14:00:51 +00:00
Alexey Samsonov e0619f5241 Fix test case for linking with sanitizer opts added in r168428.
llvm-svn: 168562
2012-11-25 13:40:21 +00:00
NAKAMURA Takumi c232cb8542 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.

llvm-svn: 168549
2012-11-24 23:17:09 +00:00
Nico Weber 6c92b89a9c Make err_module_expected_semi consistent with all the other expected_semi diags.
llvm-svn: 168535
2012-11-24 03:20:20 +00:00
Benjamin Kramer 90633e39fc Sema: Provide a valid source location when instantiating templates based on a CXXDefaultArgExpr.
Fixes PR13758.

llvm-svn: 168521
2012-11-23 17:04:52 +00:00
Rafael Espindola 99e3bfbd17 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.

llvm-svn: 168519
2012-11-23 16:26:30 +00:00
Rafael Espindola 88806c2865 Remove redundant check.
llvm-svn: 168515
2012-11-23 14:29:54 +00:00
Rafael Espindola 53192e7d93 Check that we don't warn on this testcase. This is basically a test that
Decl::isUsed checks the attribute. If the function had a body just the check
is DeclMustBeEmitted would be sufficient.

llvm-svn: 168514
2012-11-23 13:54:40 +00:00
Joey Gouly ebc59d5eb4 PR14306: Move -fbounds-checking to -fsanitize=bounds.
llvm-svn: 168510
2012-11-23 10:39:49 +00:00
Bob Wilson decc03efe8 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.

llvm-svn: 168505
2012-11-23 06:14:39 +00:00
Benjamin Kramer ba4c85e51d Make helpers static/anonymous.
llvm-svn: 168500
2012-11-22 15:02:44 +00:00
Richard Smith b2c5f963d6 Fix regression in r168477. Use canonical decl when looking for base class
specified as a qualified name.

llvm-svn: 168479
2012-11-22 00:40:54 +00:00
Richard Smith d80b2d57cf 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.

llvm-svn: 168477
2012-11-22 00:24:47 +00:00
Richard Smith 56cb16dd92 Test that we correctly deal with multiple copy constructors when detecting
non-trivial special members for varargs calls.

llvm-svn: 168476
2012-11-22 00:21:13 +00:00
Chandler Carruth 05fb585a36 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.

llvm-svn: 168473
2012-11-21 23:40:23 +00:00
Benjamin Kramer 3d3ddcec70 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.

llvm-svn: 168441
2012-11-21 17:42:47 +00:00
Joey Gouly f3c186861f Test commit: Remove blank line.
llvm-svn: 168436
2012-11-21 16:54:35 +00:00
Alexey Samsonov 062441b8d4 Try to fix test from r168428 on mingw bot
llvm-svn: 168431
2012-11-21 15:52:36 +00:00
NAKAMURA Takumi 0597d355a2 clang/test/Driver/x86_64-nacl-defines.cpp: Specify filename generated.
FIXME: It could be /dev/null.
llvm-svn: 168429
2012-11-21 14:45:57 +00:00
Alexey Samsonov 8368b376ad [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.
llvm-svn: 168428
2012-11-21 14:17:42 +00:00
Dmitri Gribenko 3233391b50 Use color for -ast-dump-filter only when it is supported
Patch by Philip Craig.

llvm-svn: 168420
2012-11-21 10:54:55 +00:00
Rafael Espindola 6dcddfb852 Remove redundant code.
llvm-svn: 168411
2012-11-21 02:53:22 +00:00
Rafael Espindola a508c5de58 Remove redundant code.
llvm-svn: 168410
2012-11-21 02:47:19 +00:00
Rafael Espindola cd7720a03f Don't walk a linked list twice in the same function. On my machine this takes
"clang -cc1" on a file with 10k repetitions of
extern int no_such_variable;
from 1.434s to 1.133s.

llvm-svn: 168394
2012-11-20 23:23:57 +00:00
Bill Wendling 0a154d0490 Update method calls to the new interface re r168354.
llvm-svn: 168355
2012-11-20 05:09:43 +00:00
David Blaikie 3c0c536300 Fix some trailing whitespace (on a blank line) to cycle/test bots.
llvm-svn: 168340
2012-11-19 23:12:51 +00:00
Richard Smith 1ab34b3ad5 PR14381: Never skip constexpr function bodies when code-completing. We may need
them in order to parse the rest of the file.

llvm-svn: 168327
2012-11-19 21:13:18 +00:00
Kaelyn Uhrain f60b55ae49 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.

llvm-svn: 168317
2012-11-19 18:49:53 +00:00
Logan Chien 3d3373ceb6 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'.

llvm-svn: 168310
2012-11-19 12:04:11 +00:00
Logan Chien 1d8cc65a9b 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.

llvm-svn: 168309
2012-11-19 11:45:31 +00:00
NAKAMURA Takumi d05b01a8df clang/test: Suppress two tests on LLP64 target, Windows x64.
llvm-svn: 168303
2012-11-19 10:00:59 +00:00
Chandler Carruth 76a943be7b 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.

llvm-svn: 168297
2012-11-19 03:52:03 +00:00
Chandler Carruth d6f93cbe7c Remove a no-op 'const' from a by-value return type.
llvm-svn: 168296
2012-11-19 03:52:00 +00:00
NAKAMURA Takumi c59776d1fe RecursiveASTVisitor.h: Rework Doug's r160404, "Eliminating the GCC_CAST hack, take two."
With this, ARCMT tests would not crash on certain hosts with g++ -O2, eg. cygwin g++-4.5.3.

r160404 crashed mingw32-g++-4.4.0. I guess method's pointer in conditional expression could not be handled.

llvm-svn: 168295
2012-11-19 00:51:37 +00:00
Dmitri Gribenko d4bc5ac69d Remove redundant (duplicated) check.
llvm-svn: 168293
2012-11-18 22:28:42 +00:00
NAKAMURA Takumi 3424550294 clang/test/Sema/warn-documentation.cpp: Try to fix up the testcase in r168277.
llvm-svn: 168278
2012-11-18 02:34:33 +00:00
Dmitri Gribenko 76b91c3431 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!

llvm-svn: 168277
2012-11-18 00:30:31 +00:00
Dmitri Gribenko a01d4cfff2 Fix Doxygen comment start sequence.
llvm-svn: 168276
2012-11-17 23:53:22 +00:00
Andy Gibbs b5b30c43d0 Clean up code according to coding standards
llvm-svn: 168274
2012-11-17 22:17:28 +00:00
Fariborz Jahanian d91d21cc33 objective-C: Do not issue deprecated warning about implementation
of a deprecated method in original class (or category), only
in overrides. // rdar://12717705

llvm-svn: 168270
2012-11-17 20:53:53 +00:00
Nico Weber 4e270380c1 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.

llvm-svn: 168269
2012-11-17 20:25:54 +00:00
Andy Gibbs d41d094244 Prevent premature macro expansion in __has_builtin, __has_feature,
__has_attribute, __has_extension, making them behave more akin to
conventional macros.

llvm-svn: 168268
2012-11-17 19:18:27 +00:00
Andy Gibbs a8df57a962 Made the "expected string literal" diagnostic more expressive
llvm-svn: 168267
2012-11-17 19:16:52 +00:00
Andy Gibbs 58905d251b 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.

llvm-svn: 168266
2012-11-17 19:15:38 +00:00
Andy Gibbs f591982bb2 Fix handling of invalid uses of the __has_warning builtin macro
llvm-svn: 168265
2012-11-17 19:14:53 +00:00
Benjamin Kramer 37196de31e 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.

llvm-svn: 168260
2012-11-17 17:30:55 +00:00
Benjamin Kramer dca1ff8909 Remove copy ctor that provides no value over the default.
It's also simpler to just copy the words than mangling bits like this ctor did.

llvm-svn: 168258
2012-11-17 09:14:31 +00:00
Ted Kremenek 778a6ed358 Further reduce "-fsyntax-only -Wuninitialized" time on sqlite3.c by another 2.5% using intelligent pruning of blocks during the final reporting pass.
llvm-svn: 168257
2012-11-17 07:18:30 +00:00
Ted Kremenek 4431a03928 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.

llvm-svn: 168241
2012-11-17 02:00:00 +00:00
Eli Friedman 3e94f57a0f Add missing features for misc x86 CPUs to CPU feature translation. Patch by Jung-uk Kim.
llvm-svn: 168239
2012-11-17 01:43:10 +00:00
Eli Friedman 1beddcffc3 Clean up X86 target feature translation code slightly. No intended functional change. Patch by Jung-uk Kim.
llvm-svn: 168237
2012-11-17 01:16:19 +00:00
Chad Rosier 1ccfff111d Typo.
llvm-svn: 168222
2012-11-16 23:41:41 +00:00
Bill Wendling 313b6bfbe7 Revert r167799. It's not really correct, and it doesn't fix the problem that it was intended to fix.
llvm-svn: 168217
2012-11-16 23:03:00 +00:00
Dmitri Gribenko 44ae282c6e Testcase overriding-ftemplate-comments.cpp: use [[@LINE]] to make it less fragile.
llvm-svn: 168213
2012-11-16 22:34:07 +00:00
Chad Rosier 808baaf232 [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

llvm-svn: 168212
2012-11-16 22:31:39 +00:00
Dmitri Gribenko dddfc51397 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.

llvm-svn: 168206
2012-11-16 21:43:31 +00:00
Daniel Jasper 94a56856d2 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
llvm-svn: 168177
2012-11-16 18:39:22 +00:00
Jordan Rose 8832924acb [analyzer] SATestBuild.py: fix broken string concatenation
This has been broken for a while, but the branch was never being taken.
(We were trying to do 'str + floatVal'; now we do 'str % intVal' and use
the '%d' format.)

llvm-svn: 168174
2012-11-16 17:41:21 +00:00
Benjamin Kramer d6e8a7964d Make libASTMatchers link its dependencies. libRewriteFrontend depends on libRewriteCore.
LLVM_USED_LIBS does nothing here.

llvm-svn: 168172
2012-11-16 17:30:58 +00:00
Alexey Samsonov cc42980335 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.
llvm-svn: 168168
2012-11-16 12:53:14 +00:00
Nick Lewycky cc8990f629 Store this Decl* as a Decl* instead of a uintptr_t. No functionality change.
llvm-svn: 168145
2012-11-16 08:40:59 +00:00
NAKAMURA Takumi fe40a35075 clang/unittests: Fixup corresponding to Doug's r168136.
llvm-svn: 168137
2012-11-16 04:40:11 +00:00
Douglas Gregor f8715de599 Since CreateTargetInfo is taking ownership of the target options, pass
it as a pointer. 

llvm-svn: 168136
2012-11-16 04:24:59 +00:00
Douglas Gregor 106d7a2704 Remove unused diagnostics
llvm-svn: 168135
2012-11-16 04:10:20 +00:00
NAKAMURA Takumi a95099ebd3 Revert r168132, "clang/test/lit.cfg: Suppress the feature 'dev-fd-fs' for now." I missed Daniel's r168095 by my accident.
llvm-svn: 168134
2012-11-16 03:50:55 +00:00
Argyrios Kyrtzidis 2bafa0076d [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.

llvm-svn: 168133
2012-11-16 03:34:57 +00:00
NAKAMURA Takumi 0e551c191c clang/test/lit.cfg: Suppress the feature 'dev-fd-fs' for now.
None of my buildhost (centos6 x86-64 and cygwin) is passing. Investigating.

llvm-svn: 168132
2012-11-16 03:28:51 +00:00
Daniel Dunbar 5d38875d81 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.

llvm-svn: 168128
2012-11-16 01:51:11 +00:00
Richard Trieu 08b5fef122 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.

llvm-svn: 168126
2012-11-16 01:32:40 +00:00
Matt Beaumont-Gay c08fa18596 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.

llvm-svn: 168124
2012-11-16 01:14:52 +00:00
Richard Smith 1648847248 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...).

llvm-svn: 168119
2012-11-16 00:53:38 +00:00
Argyrios Kyrtzidis 28b907dcfa Mention the lldb formatters in the clang wiki under debugging.
llvm-svn: 168118
2012-11-16 00:25:28 +00:00
Argyrios Kyrtzidis 71c81b63bc [ClangDataFormat.py] Add summary for QualType.
llvm-svn: 168117
2012-11-16 00:25:26 +00:00
Eli Friedman ab19712823 Make sure CodeGenTypes correctly reconverts function types. Fixes PR14355, a crash in IR generation.
llvm-svn: 168112
2012-11-15 23:40:48 +00:00
Richard Smith 2603b096df 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!

llvm-svn: 168108
2012-11-15 22:54:20 +00:00
Anna Zaks fab9bb6890 [analyzer] CmpRuns: move the clang_version info into the run (out of
report)

llvm-svn: 168105
2012-11-15 22:42:44 +00:00
Dmitri Gribenko abbb210b6b Comment to XML conversion test: correct filename.
llvm-svn: 168101
2012-11-15 22:21:42 +00:00
Jordan Rose f477505d03 [analyzer] SATestBuild.py: correctly add -j option for projects using make.
llvm-svn: 168099
2012-11-15 22:03:53 +00:00
Dmitri Gribenko d947a66c13 Split annotate-comments.cpp into a fragile (that uses hardcoded line numbers)
and a non-fragile (that uses [[@LINE]]) parts.

llvm-svn: 168098
2012-11-15 22:03:13 +00:00
Daniel Dunbar c61fae4205 tests: Mark the /dev/fd test as requiring Darwin until I can test on other OSes.
llvm-svn: 168095
2012-11-15 21:31:13 +00:00
Argyrios Kyrtzidis ec1594a7b5 [utils/ClangDataFormat.py] For invalid source locations just return
"<invalid loc>" for summary.

llvm-svn: 168087
2012-11-15 20:59:00 +00:00
Daniel Dunbar d9cb0ba660 tests: Check that we can output to /dev/fd filesystem.
- An LLVM unique_file() bug could cause us to infinite loop on the later test
   case.

llvm-svn: 168082
2012-11-15 20:24:58 +00:00
Jordan Rose 19bc88c3d4 [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!

llvm-svn: 168080
2012-11-15 20:10:05 +00:00
Daniel Dunbar 523855929b tests: Add a test for reading from named pipes.
- Realized I could use the /dev/fd filesystem to make a simple portable test.

llvm-svn: 168079
2012-11-15 20:06:10 +00:00
Douglas Gregor 4b27a64b92 If an excluded header does not exist, just ignore it
llvm-svn: 168077
2012-11-15 19:47:16 +00:00
Jordan Rose e37ab50a6e [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.

llvm-svn: 168070
2012-11-15 19:11:43 +00:00
Jordan Rose b9263cf112 [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.

llvm-svn: 168069
2012-11-15 19:11:38 +00:00
Jordan Rose 7489ba5e0c [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.

llvm-svn: 168068
2012-11-15 19:11:35 +00:00
Jordan Rose f1f2614017 [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.

llvm-svn: 168067
2012-11-15 19:11:33 +00:00
Jordan Rose b5b0fc196e [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.

llvm-svn: 168066
2012-11-15 19:11:27 +00:00
Fariborz Jahanian 0e3043b2ed 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 

llvm-svn: 168063
2012-11-15 19:02:45 +00:00
Argyrios Kyrtzidis 5259524b2f [modules] Use a memory buffer directly as input for the module includes,
instead of messing with virtual files.

llvm-svn: 168062
2012-11-15 18:57:27 +00:00
Argyrios Kyrtzidis 2ec2936778 [modules] Setup the import location of a module file and use it
as the include location of the main file of an imported module.

llvm-svn: 168061
2012-11-15 18:57:22 +00:00
Dmitri Gribenko 60d4b99693 Comment to XML conversion: convert some tests to use the new [[@LINE]]
FileCheck feature.  This will hopefully make tests less fragile.

llvm-svn: 168056
2012-11-15 18:37:27 +00:00
Dmitri Gribenko 707cb04a9f Remove unused diagnostics from TableGen files.
llvm-svn: 168055
2012-11-15 18:32:56 +00:00
Benjamin Kramer c1b7841960 Simplify code. No functionality change.
llvm-svn: 168047
2012-11-15 16:40:35 +00:00
Benjamin Kramer 671f4c0ce1 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.

llvm-svn: 168045
2012-11-15 15:18:42 +00:00
Dmitri Gribenko b2aa9234b6 Use empty parens for empty function parameter list instead of '(void)'.
llvm-svn: 168041
2012-11-15 14:28:07 +00:00
Alexey Samsonov cc9ffd1f8a [UBSan] Add support for building ubsan runtime library on Linux with 'make'. Clang part.
llvm-svn: 168039
2012-11-15 12:40:37 +00:00
Nick Lewycky c363afb19e Teach the uninitialized field warning about anonymous structs and union members.
Fixes PR14073!

llvm-svn: 168031
2012-11-15 08:19:20 +00:00
Lang Hames 65992f454c 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.

llvm-svn: 168027
2012-11-15 07:51:26 +00:00
Nick Lewycky 5cc9ebb723 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.

llvm-svn: 168024
2012-11-15 05:36:36 +00:00
Richard Trieu 03c3a2f5bb Fix an off-by-one error by switching < to <= in -Wtautological-constant-out-of-range-compare and added test case.
llvm-svn: 168023
2012-11-15 03:43:50 +00:00
Daniel Jasper 0f9f019ff8 Do not use data recursion in ASTMatchFinder.
The matchers rely on the complete AST being traversed as shown by the new test cases.

llvm-svn: 168022
2012-11-15 03:29:05 +00:00
Jordan Rose 90ba0218e2 [analyzer] Fix test case broken by previous commit.
llvm-svn: 168020
2012-11-15 02:17:09 +00:00
Jordan Rose 2d98b97e10 [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>

llvm-svn: 168019
2012-11-15 02:07:23 +00:00
Argyrios Kyrtzidis a660ae4421 [PCH] Reading expressions from attributes should be done using ReadExpr(),
not ReadExpr().

Also add a test case making sure the thread safety attributes work as expected
when they come from a PCH.

Fixes rdar://12584141 & http://llvm.org/PR13982

llvm-svn: 168017
2012-11-15 01:31:39 +00:00
Eli Friedman 6745c3b732 Fix a trivial bool-related bug I spotted while skimming David Fang's
current list of powerpc-darwin8 failures.

llvm-svn: 168016
2012-11-15 01:21:59 +00:00
Tanya Lattner b634bc91b4 Add link to cfe-users mailing list.
llvm-svn: 168015
2012-11-15 01:13:31 +00:00
Richard Smith af41696bc4 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.

llvm-svn: 168011
2012-11-15 00:31:27 +00:00
Eli Friedman 37feb2d6a6 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.

llvm-svn: 168010
2012-11-15 00:29:07 +00:00
Fariborz Jahanian a4ca19694e objective-C blocks: make cc1 flag -encode-extended-block-signature
the default. // rdar://12109031

llvm-svn: 168007
2012-11-15 00:01:28 +00:00
Eli Friedman c2c982c78b Make template diffing handle integral expressions of various widths correctly.
PR14342.

llvm-svn: 168005
2012-11-14 23:57:08 +00:00
Richard Smith 0b50cb79ad 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).

llvm-svn: 168004
2012-11-14 23:55:25 +00:00
Argyrios Kyrtzidis a19a126ee3 [utils/ClangDataFormat.py] Add data formatter for StringRef.
llvm-svn: 168003
2012-11-14 23:52:19 +00:00
Argyrios Kyrtzidis a3caaf3a05 [utils/ClangDataFormat.py] In the summary of SourceLocation, include whether it is
local or loaded.

llvm-svn: 168002
2012-11-14 23:52:11 +00:00
Fariborz Jahanian 64223e6db1 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

llvm-svn: 167997
2012-11-14 23:11:38 +00:00
Jordan Rose 27d126f97b [analyzer] Fix test in previous commit.
llvm-svn: 167995
2012-11-14 23:09:52 +00:00
Jordan Rose 5a29f3c05e [analyzer] Add a test case for printing a path note at a PreStmt point.
This is also a false-positive test case for <rdar://problem/12415065>.

<rdar://problem/12687586>

llvm-svn: 167994
2012-11-14 23:03:55 +00:00
Richard Trieu 560910c9b8 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.

llvm-svn: 167992
2012-11-14 22:50:24 +00:00
Douglas Gregor 91155087e9 Teach the AST importer to merge enumerator constants. Fixes
<rdar://problem/12676166>, and tested on the LLDB side of the world.

llvm-svn: 167990
2012-11-14 22:29:20 +00:00
Eli Friedman 1f576831c9 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>.

llvm-svn: 167985
2012-11-14 22:09:59 +00:00
Eric Christopher fd081ca50a Remove the cellspu port.
Approved by Chris Lattner.

llvm-svn: 167983
2012-11-14 22:08:59 +00:00