Commit Graph

509 Commits

Author SHA1 Message Date
Justin Bogner fa9df7af07 test: Disable standard system includes in %clang_cc1
This adds -nostdsysteminc to the %clang_cc1 expansion, which should
make it harder to accidentally write tests that depend on headers in
/usr/include. It also updates a few tests that use -isysroot <x> and a
darwin triple to omit the triple and use -isystem <x>/usr/include
instead, making them a little bit more general.

Incidentally, this fixes a test failure I'm seeing on darwin in
Modules/stddef.c, that happens because my system finds a stddef.h in
/usr/include.

llvm-svn: 219030
2014-10-03 22:18:49 +00:00
Nico Weber b10c92001c Follow-up to r218292: Add more REVERTIBLE_TYPE_TRAITs.
r218292 reverted r197496 because it broke things. In addition to breaking
things, r197496 also made all traits starting with __is_ revertible.
Reinstantiate that part of r197496 because code out there (e.g. libc++) depends
on this behavior. Fixes PR21045.

llvm-svn: 218365
2014-09-24 03:28:54 +00:00
Nico Weber 7c3c5bec07 Revert r197496, as it broke REVERTIBLE_TYPE_TRAITs from PCH files.
Also add a test to make sure that this doesn't break again. Fixes PR21036.

llvm-svn: 218292
2014-09-23 04:09:56 +00:00
Richard Smith 35f986d3cd Modify behavior of -ast-dump-lookups: if -ast-dump is not also provided, dump
anyway. If -ast-dump *is* also provided, then dump the AST declarations as well
as the lookup results. This is invaluable for cross-correlating the lookup
information with the declarations actually found.

llvm-svn: 215393
2014-08-11 22:11:07 +00:00
Dario Domizioli 6260cceec7 [TEST] Improve tests for #pragma clang optimize off/on
Added coverage for:
* More than one "off region" in the same file
* An "off region" falling off the end of an included file

llvm-svn: 214086
2014-07-28 14:33:17 +00:00
Mark Heffernan c888e41c0c Add support for #pragma nounroll.
llvm-svn: 213885
2014-07-24 18:09:38 +00:00
Mark Heffernan 450c23843e In unroll pragma syntax and loop hint metadata, change "enable" forms to a new form using the string "full".
llvm-svn: 213771
2014-07-23 17:31:31 +00:00
Mark Heffernan bd26f5ea4d Add support for '#pragma unroll'.
llvm-svn: 213574
2014-07-21 18:08:34 +00:00
Richard Smith a9a1c68a1b Fix an iterator invalidation issue: deserializing a key function can write to
the key functions table. Don't hold references to anything within that table
across such an access.

llvm-svn: 212437
2014-07-07 06:38:20 +00:00
Eli Bendersky 86483b3a0c Add loop unroll pragma support
http://reviews.llvm.org/D4089

Patch by Mark Heffernan.

llvm-svn: 210667
2014-06-11 17:56:26 +00:00
Reid Kleckner 4173f6aff9 *Really* fix DOS newlines introduced in r210330
r210369 didn't quite catch all of them.

llvm-svn: 210593
2014-06-10 21:35:24 +00:00
Aaron Ballman b06b15aa28 Adding a new #pragma for the vectorize and interleave optimization hints.
Patch thanks to Tyler Nowicki!

llvm-svn: 210330
2014-06-06 12:40:24 +00:00
Dario Domizioli 13a0a38fe0 Implemented support for "pragma clang optimize on/off", based on attribute 'optnone'.
This patch implements support for selectively disabling optimizations on a
range of function definitions through a pragma. The implementation is that
all function definitions in the range are decorated with attribute
'optnone'.

    #pragma clang optimize off
    // All function definitions in here are decorated with 'optnone'.
    #pragma clang optimize on
    // Compilation resumes as normal.

llvm-svn: 209510
2014-05-23 12:13:25 +00:00
Aaron Ballman 194cfa9b21 Removing an XFAIL which shouldn't apply. We no longer care about MSVC 9, and this test probably should not have been XFAILed everywhere regardless. The test passes on Windows with MSVC 12.
llvm-svn: 209148
2014-05-19 17:58:28 +00:00
Aaron Ballman 8063c3b80c Fix the AST printer for attributed statements so that it does not print duplicate attribute introducers. Eg) [[clang::fallthrough]] instead of [[[[clang::fallthrough]]]]
llvm-svn: 208706
2014-05-13 16:12:14 +00:00
Aaron Ballman fd7da7690b Updated the test case to show that no diagnostics are expected, and not require emitting the AST until after the AST printing for statement attributes is updated.
llvm-svn: 208703
2014-05-13 15:14:59 +00:00
Aaron Ballman f3d9b09dea No longer triggering a checked iterator assert on Windows when using std::copy while deserializing attributed statements with more than one attribute.
llvm-svn: 208702
2014-05-13 14:55:01 +00:00
Fariborz Jahanian 65a78b5d9b Objective-C. Reduce false positive warnings with -Wselector by issuing warning
only when named selector is declared in TU and it is not declared in a system
header. rdar://16600230

llvm-svn: 208443
2014-05-09 19:51:39 +00:00
Alp Toker a01285c4b3 Split out header integration tests
These are somewhat arbitrary tests that check if "thing goes fine" when
processing various platform-specific headers.

Also move warn-sysheader.cpp to Misc where the other diagnostics infrastructure
tests live.

File moves only.

llvm-svn: 207936
2014-05-04 13:00:32 +00:00
Argyrios Kyrtzidis fe6b880de5 [PCH/Modules] Don't tie TargetOptions::LinkerVersion to a module/PCH, it's a driver only thing and doesn't affect any language/preprocessor/etc. semantics.
rdar://16714526

llvm-svn: 207570
2014-04-29 18:45:01 +00:00
Eli Bendersky 3468d9d929 Move all CUDA testing inputs to Inputs/ subdirectory inside the tests.
llvm-svn: 207453
2014-04-28 22:21:28 +00:00
NAKAMURA Takumi 1fce16934f Update clang/test/PCH/single-token-macro.c corresponding to r206791.
__stdcall is defined as __attribute__((__stdcall__)) for targeting mingw32.

llvm-svn: 206870
2014-04-22 08:16:58 +00:00
Ben Langmuir beee15e721 Allow multiple modules with the same name to coexist in the module cache
To differentiate between two modules with the same name, we will
consider the path the module map file that they are defined by* part of
the ‘key’ for looking up the precompiled module (pcm file).
Specifically, this patch renames the precompiled module (pcm) files from
  cache-path/<module hash>/Foo.pcm
to
  cache-path/<module hash>/Foo-<hash of module map path>.pcm

In addition, I’ve taught the ASTReader to re-resolve the names of
imported modules during module loading so that if the header search
context changes between when a module was originally built and when it
is loaded we can rebuild it if necessary.  For example, if module A
imports module B

first time:
clang -I /path/to/A -I /path/to/B ...

second time:
clang -I /path/to/A -I /different/path/to/B ...

will now rebuild A as expected.

* in the case of inferred modules, we use the module map file that
allowed the inference, not the __inferred_module.map file, since the
inferred file path is the same for every inferred module.

llvm-svn: 206201
2014-04-14 18:00:01 +00:00
Aaron Ballman e044904301 Updating the capability attribute diagnostics to be more capability-neutral. Instead of using terminology such as "lock", "unlock" and "locked", the new terminology is "acquire", "release" and "held". Additionally, the capability attribute's name argument is now reported as part of the diagnostic, instead of hard coding as "mutex."
llvm-svn: 205359
2014-04-01 21:43:23 +00:00
Stephan Tolksdorf a6a0863470 Fix PR18307: Properly (de)serialize inherited constructors and their using declarations
Reviewed in http://llvm-reviews.chandlerc.com/D3102

llvm-svn: 204951
2014-03-27 19:22:19 +00:00
Richard Smith 5652c0f448 Serialize and deserialize mangling numbers.
llvm-svn: 204423
2014-03-21 01:48:23 +00:00
Richard Smith 564417a071 When the exception specification for a function in an imported PCH or module is
resolved, emit an update record.

llvm-svn: 204403
2014-03-20 21:47:22 +00:00
Stephan Tolksdorf e96f8b3774 Fix PR18806: Canonicalize the replacement type when deserializing a SubstTemplateTypeParmType
What's going on in the test case (without the patch applied) is this:

When the header is parsed, decltype(B()) is canonicalized to decltype(Y()),
because that was the first parsed equivalent decltype expression. Hence, the
TemplateSpecializationType for Id<decltype(B())> ends up with
SubstTemplateTypeParmType(T, decltype(Y())) as the AliasedType member.

When the PCH file is included and the AST reader reads Id<decltype(B())>, it
sees decltype(B()) before decltype(Y()). So, this time decltype(B()) ends up
being the canonical type for both decltypes, which leads to an assert violation
when the reader calls getSubstTemplateTypeParmType with the non-canonical
decltype(Y()) as the replacement type.

Reviewers: rsmith

Reviewed By: rsmith

CC: cfe-commits, aemerson

Differential Revision: http://llvm-reviews.chandlerc.com/D3073

llvm-svn: 204005
2014-03-15 10:23:27 +00:00
Richard Smith 49f906a36f If a module A exports a macro M, and a module B imports that macro and #undef's
it, importers of B should not see the macro. This is complicated by the fact
that A's macro could also be visible through a different path. The rules (as
hashed out on cfe-commits) are included as a documentation update in this
change.

With this, the number of regressions in libc++'s testsuite when modules are
enabled drops from 47 to 7. Those remaining 7 are also macro-related, and are
due to remaining bugs in this change (in particular, the handling of submodules
is imperfect).

llvm-svn: 202560
2014-03-01 00:08:04 +00:00
Nico Rieck e6a1582595 Fix broken CHECK lines
llvm-svn: 201477
2014-02-16 07:29:41 +00:00
Ted Kremenek a683f639c7 Fix PCH deserialization bug with local static symbols being treated as local extern.
This triggered a miscompilation of code using Boost's function_template.hpp
when it was included inside a PCH file.  A local static within
that header would be treated as local extern, resulting in the wrong
mangling.  This only occurred during PCH deserialization.

Fixes <rdar://problem/15975816> and <rdar://problem/15926311>.

llvm-svn: 201130
2014-02-11 06:29:29 +00:00
Ben Langmuir a16a001b72 Fix test from r200979 on Windows
Hopefully the last tweak needed to get this test working everywhere.

Remove matching of the prefix of sys_header.h, which was never the point
of the test anyway.  This avoids dealing with path separators.

llvm-svn: 200987
2014-02-07 19:39:50 +00:00
Ben Langmuir 7985adf5e6 Fix test from r200979 on non-Darwin systems
Add a darwin triple to get the behaviour from isysroot that the test
expects.

llvm-svn: 200982
2014-02-07 17:56:29 +00:00
Ben Langmuir 3d4417c7fd Stat system dependencies when using -verify-pch
We don't stat the system headers to check for stalenes during regular
PCH loading for performance reasons.  When explicitly saying
-verify-pch, we want to check all the dependencies - user or system.

llvm-svn: 200979
2014-02-07 17:31:11 +00:00
Argyrios Kyrtzidis 25f2afdee0 Revert r194097: "With this patch -Wwrite-strings is still implemented with the terrible
hack of passing -fconst-strings to -cc1"

Passing or not a language option based on diagnostic settings is a bad idea, it breaks
using a PCH that was compiled with different diagnostic settings.

Also add a test case to make sure we don't regress.

llvm-svn: 200964
2014-02-07 08:33:28 +00:00
Ben Langmuir 2cb4a78f93 Add a CC1 option -verify-pch
This option will:
- load the given pch file
- verify it is not out of date by stat'ing dependencies, and
- return 0 on success and non-zero on error

llvm-svn: 200884
2014-02-05 22:21:15 +00:00
NAKAMURA Takumi 4ec59174fd Tweak clang/test/PCH/modified-module-dependency.m for win32 hosts.
llvm-svn: 199469
2014-01-17 07:04:17 +00:00
Ben Langmuir e82630d5d5 Improve the error message when a PCH dependency is modified
Show the top-level pch file as the culprit, rather than the immediate
dependency when a pch file imports a pcm from a module. To clarify the
relationship, the pch import stack is printed as notes. The old behaviour was
misleading when a pch imported a pcm (from a module), since removing the pcm
would not fix the problem, whereas rebuilding the pch would.

llvm-svn: 199446
2014-01-17 00:19:09 +00:00
Fariborz Jahanian bae1bcb6bf ObjectiveC. Improve on diagnostics per Jordan's feedback.
llvm-svn: 199278
2014-01-15 00:59:25 +00:00
Fariborz Jahanian 2ea30fb9b0 ObjectiveC. produce more expressive warning when
-Wselector detects an unimplemented method used
in an @selector expression. // rdar://15781538

llvm-svn: 199255
2014-01-14 20:35:13 +00:00
Hans Wennborg c9bd88e681 Remove the -cxx-abi command-line flag.
This makes the C++ ABI depend entirely on the target: MS ABI for -win32 triples,
Itanium otherwise. It's no longer possible to do weird combinations.

To be able to run a test with a specific ABI without constraining it to a
specific triple, new substitutions are added to lit: %itanium_abi_triple and
%ms_abi_triple can be used to get the current target triple adjusted to the
desired ABI. For example, if the test suite is running with the i686-pc-win32
target, %itanium_abi_triple will expand to i686-pc-mingw32.

Differential Revision: http://llvm-reviews.chandlerc.com/D2545

llvm-svn: 199250
2014-01-14 19:35:09 +00:00
Hans Wennborg 9125b08b52 Update tests in preparation for using the MS ABI for Win32 targets
In preparation for making the Win32 triple imply MS ABI mode,
make all tests pass in this mode, or make them use the Itanium
mode explicitly.

Differential Revision: http://llvm-reviews.chandlerc.com/D2401

llvm-svn: 199130
2014-01-13 19:48:13 +00:00
Dmitri Gribenko b353ee1808 PCH: fix a crash caused by a circular deserialization dependency
We started by trying to deserialize decltype(func-param) in a trailing return
type, which causes the function parameter decl to be deserialized, which pulls
in the function decl, which pulls the function type, which pulls the same
decltype() in the return type, and then we crashed.

llvm-svn: 197644
2013-12-19 02:05:20 +00:00
Rafael Espindola 7abb2f9ea6 Make this test pass on Release builds.
On Assert builds the "call" was matching the variable name in
%call = call ...

llvm-svn: 197167
2013-12-12 16:15:25 +00:00
Rafael Espindola 3497069784 Switch to the new MingW ABI.
GCC 4.7 changed the MingW ABI. On the clang side this means that methods now
have the thiscall calling convention by default.

llvm-svn: 197164
2013-12-12 16:07:11 +00:00
Alp Toker cfea74944a Make the -Wkeyword-compat diag message more accurate
Changed from:

  keyword '__is_empty' will be treated as an identifier for the remainder of the translation unit

To:

  keyword '__is_empty' will be made available as an identifier for the remainder of the translation unit

This is a more accurate description of clang's keyword compatibility feature,
given that some of the keywords are turned into context-sensitive keywords
(e.g. REVERTIBLE_TYPE_TRAIT) rather than being fully disabled.

llvm-svn: 196776
2013-12-09 12:41:02 +00:00
Alp Toker 544bd43624 Remove duplicated -cc1 in tests
llvm-svn: 196728
2013-12-08 18:06:52 +00:00
Alp Toker 47642d2b7e Emit an extension warning when changing system header tokens
clang converts keywords to identifiers for compatibility with various system
headers such as GNU libc.

Implement a -Wkeyword-compat extension warning to diagnose those cases. The
warning is on by default but will generally be ignored in system headers. It
can however be enabled globally to aid standards conformance testing.

This also changes the __uptr keyword avoidance from r195710 to no longer
special-case system headers, bringing it in line with other similar workarounds
in clang.

Implementation returns bool for symmetry with token annotation functions.

Some examples:

warning: keyword '__is_pod' will be treated as an identifier for the remainder of the translation unit [-Wkeyword-compat]
struct __is_pod

warning: keyword '__uptr' will be treated as an identifier here [-Wkeyword-compat]
union w *__uptr;

llvm-svn: 196212
2013-12-03 06:13:01 +00:00
Bob Wilson 0f7445b615 Default to use libc++ on OS X 10.9+ and iOS 7+.
llvm-svn: 193934
2013-11-02 23:19:53 +00:00
Richard Trieu 30bfa3623b Change the other -Wtautological-compare warnings to not trigger in template
specializations.  Also switch to -Wuninitialized for a test case that depended
on a warning firing in template specializations.

llvm-svn: 193906
2013-11-02 02:11:23 +00:00