Commit Graph

167 Commits

Author SHA1 Message Date
Nico Weber 2582895832 clang-cl: /showIncludes output should go to stdout, not stderr. Fixes PR20217.
llvm-svn: 212383
2014-07-06 03:04:24 +00:00
Alp Toker 1d1ac112f0 Account for differences in grep implementations
llvm-svn: 211856
2014-06-27 03:11:38 +00:00
Alp Toker 830c34e269 Restore test from r211844 skipping '.file' directives
At least this answers the question of whether .bc/.ll input processed by the
frontend produces identical output to the original compilation.

llvm-svn: 211853
2014-06-27 02:59:39 +00:00
Alp Toker 8e7e1b87c6 Partially disable test from r211844
ELF assembly contains .line directives that differ based on the input filename.
Weaken the test while considering options.

llvm-svn: 211849
2014-06-27 02:35:57 +00:00
Alp Toker 1a5a520d95 Add test coverage for .bc input in the frontend
Test that we can consume LLVM bitcode and additionally check that it produces
the same output as a direct compilation.

The feature is crashy and has gone untested until now, but we might as well
provide some coverage as long as it remains in tree.

Also test LL source input in the same way because the existing tests for that
don't look convincing.

llvm-svn: 211844
2014-06-27 02:04:28 +00:00
Alp Toker aab3a8f2fb Remove .bc from test config.suffixes
This was unused. Besides, a binary file can't really contain lit ShTests.

llvm-svn: 211843
2014-06-27 02:04:21 +00:00
Alp Toker 51dc8e9b53 Simplify optimization-remark.c test following r211610
With LocTrackingOnly there's no longer a user-facing distinction so the NDEBUG
checks can go away. (Except maybe column info, but -verify only checks line
numbers anyway.)

Also add a RUN line to validate the traditional !LocTrackingOnly case.

llvm-svn: 211622
2014-06-24 19:23:10 +00:00
David Blaikie bcc6004a0e Fix test added in r211610 so it doesn't race on output file creation.
llvm-svn: 211615
2014-06-24 17:31:05 +00:00
Diego Novillo 913690c7bc Add new debug kind LocTrackingOnly.
Summary:
This new debug emission kind supports emitting line location
information in all instructions, but stops code generation
from emitting debug info to the final output.

This mode is useful when the backend wants to track source
locations during code generation, but it does not want to
produce debug info. This is currently used by optimization
remarks (-Rpass, -Rpass-missed and -Rpass-analysis).

When one of the -Rpass flags is used, the front end will enable
location tracking, only if no other debug option is enabled.

To prevent debug information from being generated, a new debug
info kind LocTrackingOnly causes DIBuilder::createCompileUnit() to
not emit the llvm.dbg.cu annotation. This blocks final code generation
from generating debug info in the back end.

Depends on D4234.

Reviewers: echristo, dblaikie

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4235

llvm-svn: 211610
2014-06-24 17:02:17 +00:00
Hans Wennborg 35bbf1cf8a Do not predefine __EXCEPTIONS in clang-cl (PR19977)
Patch by Ehsan Akhgari! (Test tweak by me.)

Differential Revision: http://reviews.llvm.org/D4065

llvm-svn: 210582
2014-06-10 20:46:38 +00:00
Alp Toker d08473415f Make '-Werror=frame-larger-than=' and associated diagnostic pragmas GCC-compatible
It turns out the trailing '=' really is part of the option name spelling and
treating it as such gets us compatible with GCC's -Werror= and pragmas.

(GCC doesn't appear to support any -Wno- form for this diagnostic but we do.)

llvm-svn: 210503
2014-06-09 23:59:38 +00:00
Alp Toker 7ce5f025a3 Don't generate assembly in backend diagnostic tests
A leftover -S was generating unwanted output in the source tree overriding
-only flags that normally disable output.

This reverts commit r210323 and implements the proper fix.

Reported by Timur Iskhodzhanov!

llvm-svn: 210326
2014-06-06 11:20:58 +00:00
Timur Iskhodzhanov 27700e28de Add -o /dev/null to one of the tests as it fails when run from a read-only checkout
llvm-svn: 210323
2014-06-06 10:58:21 +00:00
Alp Toker 27506271b4 Provide fallback locations for backend remarks
Instead of disembodied diagnostics when debug info is disabled it's now
possible to identify the associated function's location in order to provide
some amount of of context.

We use the definition's body right brace location to differentiate the fallback
from diagnostics that genuinely relate to the function declaration itself (a
convention also used by gcc).

llvm-svn: 210294
2014-06-05 22:11:12 +00:00
Alp Toker fb8d02b179 Implement -Wframe-larger-than backend diagnostic
Add driver and frontend support for the GCC -Wframe-larger-than=bytes warning.
This is the first GCC-compatible backend diagnostic built around LLVM's
reporting feature.

This commit adds infrastructure to perform reverse lookup from mangled names
emitted after LLVM IR generation. We use that to resolve precise locations and
originating AST functions, lambdas or block declarations to produce seamless
codegen-guided diagnostics.

An associated change, StringMap now maintains unique mangled name strings
instead of allocating copies. This is a net memory saving in C++ and a small
hit for C where we no longer reuse IdentifierInfo storage, pending further
optimisation.

llvm-svn: 210293
2014-06-05 22:10:59 +00:00
Alp Toker ea04672c82 Fix leak from r210059
Also revert r210096 which temporarily disabled the test while this was being
investigated.

llvm-svn: 210115
2014-06-03 17:23:34 +00:00
Kostya Serebryany be6d91f1ba temporary disable part of a test because it causes clang to leak memory (want to have the sanitizer bot green)
llvm-svn: 210096
2014-06-03 11:45:37 +00:00
Alp Toker cf2048bbb3 Fix -emit-codegen-only to not generate binaries
llvm-svn: 210059
2014-06-03 02:14:20 +00:00
Diego Novillo 6bfdaf5a20 Remove unnecessary test.
llvm-svn: 209893
2014-05-30 13:19:28 +00:00
NAKAMURA Takumi 2a07bf4ef7 clang/test/Frontend/Weverything-and-remarks.cpp: Add explicit -target.
You could see unexpected result (*.tmp.err) with "-target x86_64-win32".

  Weverything-and-remarks.cpp:11:9: warning: 'char32_t' type specifier is incompatible with C++98 [-Wc++98-compat]
  typedef __char32_t char32_t;
          ^
  Weverything-and-remarks.cpp:12:27: error: typedef redefinition with different types ('unsigned long' vs 'unsigned long long')
  typedef long unsigned int size_t;
                            ^
  Weverything-and-remarks.cpp:19:62: warning: dynamic exception specifications are deprecated [-Wdeprecated]
    static void assign(char_type& __c1, const char_type& __c2) throw() {
                                                               ^~~~~~~
  Weverything-and-remarks.cpp:19:62: note: use 'noexcept' instead
    static void assign(char_type& __c1, const char_type& __c2) throw() {
                                                               ^~~~~~~
                                                               noexcept
  Weverything-and-remarks.cpp:25:46: warning: unused parameter '__n' [-Wunused-parameter]
                                        size_t __n) {
                                               ^
  3 warnings and 1 error generated.

llvm-svn: 209878
2014-05-30 07:03:16 +00:00
Diego Novillo d23ec94393 Add flags -Rpass-missed and -Rpass-analysis.
Summary:
These two flags are in the same family as -Rpass, but are used in
different situations.

-Rpass-missed is used by optimizers to inform the user when they tried
to apply an optimization but couldn't (or wouldn't).

-Rpass-analysis is used by optimizers to report analysis results back
to the user (e.g., why the transformation could not be applied).

Depends on D3682.

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D3683

llvm-svn: 209839
2014-05-29 19:55:06 +00:00
Diego Novillo 30531eff57 Add missing -S to avoid invoking assembler unnecessarily.
llvm-svn: 209828
2014-05-29 16:52:06 +00:00
Aaron Ballman a670c20894 No longer allow the -std options to entirely override the -x language option. This allows -x cuda -std=c++11, for instance.
llvm-svn: 209824
2014-05-29 16:39:42 +00:00
Diego Novillo 9c89ff1945 Fix spurious remarks when -Weverything is used.
With -Weverything, the backend remarks are enabled. This was
causing spurious diagnostics for remarks that we don't yet
handle (cf http://reviews.llvm.org/D3683).

This will stop being a problem once http://reviews.llvm.org/D3683
is committed.

llvm-svn: 209823
2014-05-29 16:19:27 +00:00
Diego Novillo 6dc9c4814f Fix segmentation fault when mixing -Rpass with #line.
Summary:
When using #line directives, FileManager::getFile() will return a nil
entry. This triggers an assert in translateFileLineCol().

This patch handles nil FileEntry instances by emitting a note that the
location could not be translated back to a SourceLocation. I don't
really like this solution, but we are translating presumed locations,
so some information has already been lost.

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D3625

llvm-svn: 208315
2014-05-08 13:49:54 +00:00
Lubos Lunak d9070c5ee7 -fsyntax-only for a test
llvm-svn: 207814
2014-05-01 23:58:20 +00:00
Reid Kleckner c9bb8b5af4 Use %clang_cc1 in rewrite-includes-messages.c test and drop REQUIRES: shell
This test passes on Windows with lit's shell interpreter.

llvm-svn: 207810
2014-05-01 22:45:16 +00:00
Lubos Lunak 1f03d08a8c do not hide clang stderr output during a test
I don't know why this fails on the buildbot.

llvm-svn: 207808
2014-05-01 22:40:00 +00:00
Lubos Lunak adc2fde016 use 'diff' rather than 'cmp -s' in a test
That's what all tests use, no idea where I got the latter from.

llvm-svn: 207797
2014-05-01 21:36:08 +00:00
Lubos Lunak 4526b46ee6 write a line marker right before adding included file
Enclosing the original #include directive inside #if 0 adds lines,
so warning/errors messages would have the line number off in
"In file included from <file>:<line>:", so add line marker to fix this.

llvm-svn: 207795
2014-05-01 21:11:57 +00:00
Lubos Lunak 72cad68b30 do not use "1" for line marker for the predefines "file" either
Similar to r207764.

llvm-svn: 207794
2014-05-01 21:10:08 +00:00
Tobias Grosser 86a85678f2 Support 'remark' in VerifyDiagnosticConsumer
After Diego added support for -Rpass=inliner we have now in-tree remarks which
we can use to properly test this feature.

llvm-svn: 207765
2014-05-01 14:06:01 +00:00
Lubos Lunak 10961c0eab do not use "1" for line marker for the main file
"1" means entering a new file (from a different one), but the main
file is not included from anything (and this would e.g. confuse -Wunused-macros
to not report unused macros in the main file, see pr15610, or also see pr18948).
The line marker is still useful e.g. if the resulting file is renamed or used
via a pipe.

llvm-svn: 207764
2014-05-01 13:50:44 +00:00
Lubos Lunak 64568ca18a revert r207756
There's nothing wrong with the change itself, but
test/Frontend/rewrite-includes-messages.c fails without another
not-yet-committed fix.

llvm-svn: 207762
2014-05-01 13:37:55 +00:00
Lubos Lunak c5f2bca866 write a line marker right before adding included file
Enclosing the original #include directive inside #if 0 adds lines,
so warning/errors messages would have the line number off in
"In file included from <file>:<line>:", so add line marker to fix this.

llvm-svn: 207756
2014-05-01 12:45:08 +00:00
Andrea Di Biagio c7ce72c9f2 Simplify test. No functional change intended.
llvm-svn: 207623
2014-04-30 10:04:58 +00:00
Andrea Di Biagio e653811af2 Add test case for revision 207575 to verify that on Windows, clang doesn't
crash with an assertion failure when 'nul' is passed in input.

Modified clang/test/lit.py to add feature 'system-windows' if
`platform.system()` returns 'Windows'.

llvm-svn: 207576
2014-04-29 20:19:13 +00:00
Diego Novillo 9f23997732 Allow adding a value to a flag in diagnostics.
Summary:
This allows callers of Diags.Report() to append a value to the name of
the flag associated with the diagnostic. This is useful in cases like
the -Rpass flag, where we want the diagnostic to show the name of the
pass that matched the pattern. Instead of showing "... [-Rpass]", this
allows us to show "... [-Rpass=passname]".

Reviewers: rsmith

CC: cfe-commits

Differential Revision: http://reviews.llvm.org/D3441

llvm-svn: 206826
2014-04-21 23:16:03 +00:00
Diego Novillo 17b2a1b4b0 Fix check failure on hexagon targets.
This test was failing because there is no assembler for hexagon-elf on
this buildbot:

http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/10470

Fixed by adding -S to the driver invocation.

llvm-svn: 206412
2014-04-16 19:02:35 +00:00
Diego Novillo 829b170048 Add support for optimization reports.
Summary:
This patch adds a new flag -Rpass=. The flag indicates the name
of the optimization pass that should emit remarks stating when it
made a transformation to the code.

This implements the design I proposed in:

https://docs.google.com/document/d/1FYUatSjZZO-zmFBxjOiuOzAy9mhHA8hqdvklZv68WuQ/edit?usp=sharing

Other changes:
- Add DiagnosticIDs::isRemark(). Use it in printDiagnosticOptions to
  print "-R" instead of "-W" in the diagnostic message.

- In BackendConsumer::OptimizationRemarkHandler, get a SourceLocation
  object out of the file name, line and column number. Use that location
  in the call to Diags.Report().

- When -Rpass is used without debug info a note is emitted alerting
  the user that they need to use -gline-tables-only -gcolumn-info to
  get this information.

CC: llvm-commits

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

llvm-svn: 206401
2014-04-16 16:54:24 +00:00
Alexander Kornienko 18fa48c9f9 Move the -i[no-]system-prefix options from CC1Options.td to Options.td.
Summary:
This allows them to be used without -cc1 the same way as -I and -isystem.
Renamed the options to --system-header-prefix=/--no-system-header-prefix to avoid interference with -isystem and make the intent of the option cleaner.

Reviewers: rsmith

Reviewed By: rsmith

CC: cfe-commits

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

llvm-svn: 204775
2014-03-26 01:39:59 +00:00
Rafael Espindola 33ebd2171e Accept -no-integrated-as in -cc1 and forward it to llvm.
llvm-svn: 201837
2014-02-21 03:14:07 +00:00
Daniel Sanders 753e17629d Re-commit: Demote EmitRawText call in AsmPrinter::EmitInlineAsm() and remove hasRawTextSupport() call
Summary:
AsmPrinter::EmitInlineAsm() will no longer use the EmitRawText() call for
targets with mature MC support. Such targets will always parse the inline
assembly (even when emitting assembly). Targets without mature MC support
continue to use EmitRawText() for assembly output.

The hasRawTextSupport() check in AsmPrinter::EmitInlineAsm() has been replaced
with MCAsmInfo::UseIntegratedAs which when true, causes the integrated assembler
to parse inline assembly (even when emitting assembly output). UseIntegratedAs
is set to true for targets that consider any failure to parse valid assembly
to be a bug. Target specific subclasses generally enable the integrated
assembler in their constructor. The default value can be overridden with
-no-integrated-as.

All tests that rely on inline assembly supporting invalid assembly (for example,
those that use mnemonics such as 'foo' or 'hello world') have been updated to
disable the integrated assembler.

Changes since review (and last commit attempt):
- Fixed test failures that were missed due to configuration of local build.
  (fixes crash.ll and a couple others).
- Fixed tests that happened to pass because the local build was on X86
  (should fix 2007-12-17-InvokeAsm.ll)
- mature-mc-support.ll's should no longer require all targets to be compiled.
  (should fix ARM and PPC buildbots)
- Object output (-filetype=obj and similar) now forces the integrated assembler
  to be enabled regardless of default setting or -no-integrated-as.
  (should fix SystemZ buildbots)

Reviewers: rafael

Reviewed By: rafael

CC: llvm-commits

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

llvm-svn: 201333
2014-02-13 14:44:26 +00:00
Daniel Sanders abe212a3b8 Revert r201237+r201238: Demote EmitRawText call in AsmPrinter::EmitInlineAsm() and remove hasRawTextSupport() call
It introduced multiple test failures in the buildbots.

llvm-svn: 201241
2014-02-12 15:39:20 +00:00
Daniel Sanders 2f235aebdb Arcanist failed to commit the two clang test corrections that should have been in r201237.
llvm-svn: 201238
2014-02-12 14:46:15 +00:00
Quentin Colombet 728c5540ee Wired-up the new LLVM diagnostic system into clang diagnostic system.
The approach is similar to the existing inline-asm reporting, just more
general.

<rdar://problem/15886278>

llvm-svn: 200931
2014-02-06 18:30:43 +00:00
Evan Cheng 31dd9a6cc1 Fix r195149. Triple should correctly reflect that target. If it contains ios,
e.g. thumbv7m-apple-ios3.0.0-eabi, then it should mean it's an iOS target. For
embedded targets, the OS should be unknown, e.g. thumbv7m-apple-unknown-macho.
Since Tim has recently fixed the triple, r195149 is no longer needed.
rdar://15911035

llvm-svn: 200164
2014-01-26 23:12:43 +00:00
Alp Toker 120dd1afaf Add tests for clang plugins
Somehow the entire plugin infrastructure went wholly untested until now.

The only plugins available for use in testing are the examples, so plugin tests
will only be run if CLANG_BUILD_EXAMPLES is enabled in the build.

(The examples should really be enabled by default, not just to aid testing but
also to prevent bitrot in some key user-facing code. I'll propose that
shortly.)

Requires supporting changes in LLVM r198746.

llvm-svn: 198747
2014-01-08 11:38:47 +00:00
Rafael Espindola d5e81e59b5 Override the datalayout in a module with -triple.
This matches llc's behavior.

Before this patch clang would create a TargetInfo base on -triple but a llvm
CodeGen based on the triple in the module.

llvm-svn: 197837
2013-12-20 22:01:25 +00:00
Alp Toker 08c2500f9c Fix raw lex crash and -frewrite-includes noeol-at-eof failure
Raw lexers don't have a preprocessor so we need to null check.

llvm-svn: 197245
2013-12-13 17:04:55 +00:00