Commit Graph

316 Commits

Author SHA1 Message Date
Rafael Espindola 6f2564cb36 Revert "Cmake: add compiler option in a more idiomatic way"
This reverts commit 183995.

It broke the bots:
http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/9730/steps/build_clang/logs/stdio

llvm-svn: 183997
2013-06-14 19:41:05 +00:00
Arnaud A. de Grandmaison ba0d5424e1 Cmake: add compiler option in a more idiomatic way
llvm-svn: 183995
2013-06-14 19:26:57 +00:00
Arnaud A. de Grandmaison 916f3ccacf Add colored diagnostics when building LLVM with cmake + ninja + clang
When invoked from Ninja, clang does not detect that it can use colors : see https://github.com/martine/ninja/issues/174

llvm-svn: 182878
2013-05-29 20:41:35 +00:00
Alexey Samsonov 2fb337e77a Add basic zlib support to LLVM. This would allow to use compression/uncompression in selected LLVM tools.
llvm-svn: 180083
2013-04-23 08:28:39 +00:00
Sylvestre Ledru cd4cd6ecc5 Remove the executable bit on cmake files
llvm-svn: 179976
2013-04-21 09:04:59 +00:00
Alexey Samsonov e10c151be5 Don't explicitly provide -pie in MSan bootstrap of LLVM, as it's now implied by the driver
llvm-svn: 179367
2013-04-12 07:18:55 +00:00
Reid Kleckner c1c01d5313 [cmake] Avoid rel+asserts warnings when passing -UNDEBUG
MSVC 2012 gives warning D9025, "overriding /D NDEBUG with -UNDEBUG".
Removing the original definition of NDEBUG silences this.

llvm-svn: 178967
2013-04-07 01:45:01 +00:00
Alexey Samsonov 75789a2133 Add CMake option LLVM_USE_SANITIZER={Address,Memory,MemoryWithOrigins} to simplify bootstrap of LLVM/Clang under ASan/MSan
llvm-svn: 177992
2013-03-26 07:49:46 +00:00
Douglas Gregor 96fa0fcff1 Introduce a tiny CMake project to gather Subversion revision information and place it into a header.
llvm-svn: 177938
2013-03-25 23:14:19 +00:00
Duncan Sands 71de6dcb38 Don't use add_llvm_definitions for adding warning flags. It makes it too hard
to have them appear in the right order.  Instead append all warnings explicitly
to the language flags.  This was already the case for many warnings.  Fixes the
issue of -Wno-maybe-uninitialized not being effective because -Wall was being
placed after it rather than before.

llvm-svn: 177866
2013-03-25 13:25:34 +00:00
Alexey Samsonov ffb4ca8bb4 Enable -Wnon-virtual-dtor build warning
llvm-svn: 177385
2013-03-19 10:10:03 +00:00
Eric Christopher 31f4354c75 Turn anonymous type in anonymous union warning back on after cleaning up
issues.

llvm-svn: 177136
2013-03-15 00:43:00 +00:00
Alexey Samsonov 6706578ff1 Simplify CMake rules in HandleLLVMOptions module.
Summary: No functionality change.

Reviewers: Bigcheese

Reviewed By: Bigcheese

CC: llvm-commits

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

llvm-svn: 176973
2013-03-13 20:50:23 +00:00
Jordan Rose 643aa0e0dc CMake: Always include the CheckCXXCompilerFlag in HandleLLVMOptions.cmake.
Previously we relied on it being included by config-ix.cmake.

llvm-svn: 176396
2013-03-02 01:00:40 +00:00
Tim Northover bfe8468502 Use correct host/target CMake variables to define lit variables.
CMake and autotools disagree on what "host" means in a cross-compilation
context. Autotools (and lit) take it to be the machine the binaries being
compiled now will run on. CMake takes it to be the machine actually compiling
the binaries now.

This change makes lit.site-cfg more consistent between autotools and CMake,
allowing lit tests (particularly in ExecutionEngine) to run correctly when
cross-compiled with CMake

llvm-svn: 175179
2013-02-14 16:49:32 +00:00
Edwin Vane a9c5bb3ff3 Turn off uninitialized-use warnings for gcc in cmake build
Added support to the cmake build to turn off uninitialized use warnings
for gcc. This cleans the build up somewhat.

Used logic simpler than found in autoconf by making use of the fact that
although gcc won't complain about unsupported -Wno-* flags it *will*
complain about unsupported -W flags.

Reviewers: gribozavr, doug.gregor, chandlerc
llvm-svn: 174299
2013-02-04 02:32:44 +00:00
Richard Smith 6c26e74781 Add -Wno-nested-anon-types to -pedantic builds of LLVM. This Clang warning
catches uses of an extremely minor and widely-available C++ extension (which
every C++ compiler I could find supports, but EDG and Clang reject in strict
mode).

The diagnosed code pattern looks like this:

struct X {
  union {
    struct {
      int a;
      int b;
    } S;
  };
};

llvm-svn: 174103
2013-01-31 22:19:12 +00:00
Edwin Vane c64108430f Turn off missing field initializer warnings for gcc
gcc produces false positives for empty braces so turning the warning off.
Instead, turning the warning on for clang so proper warnings aren't missed.
    
Reviewers: dblaikie, chandlerc

llvm-svn: 174073
2013-01-31 18:05:54 +00:00
NAKAMURA Takumi c42bdfcc05 [CMake][Lit][unittests] Cleanup in AddLLVM.cmake.
llvm-svn: 173617
2013-01-27 12:46:53 +00:00
NAKAMURA Takumi 61a8f974a7 [CMake][Lit][unittests] Deprecate CMAKE_BUILD_TYPE in each build directory for unittests.
For example,
cur) unittests/ADT/Release/ADTTests
new) unittests/ADT/ADTTests

RUNTIME_BUILD_MODE can be substituted to CMAKE_CFG_INTDIR.

With Make and Ninja, the tree is not built with multiple configurations.
Then, including the build type in target directory doesn't make sense.
See also "How can I build multiple modes without switching?"
http://www.cmake.org/Wiki/CMake_FAQ
CMAKE_CFG_INTDIR is set to "."

With multiple-configuration-aware build system, like Visual Studio, each unittest is built on appropriate directory, for example,
unittests/ADT/Release/ADTTests.exe
CMAKE_CFG_INTDIR is set to build system's variable, like "$(Configuration)" or "$(OutDir)".

Thus, "--param build_config" is also deprecated.

llvm-svn: 173616
2013-01-27 12:20:50 +00:00
Reid Kleckner cd947f9764 Disable MSVC's warning about noreturn destructors
This warning fires on:
  Operator::~Operator() {
    llvm_unreachable("should never destroy an Operator");
  }

That seems like a false positive.  I don't see any good way to silence
the warning here, so I'm disabling it.

llvm-svn: 173455
2013-01-25 15:36:13 +00:00
Chandler Carruth ef7f968e09 Add time getters to the process interface for requesting the elapsed
wall time, user time, and system time since a process started.

For walltime, we currently use TimeValue's interface and a global
initializer to compute a close approximation of total process runtime.

For user time, this adds support for an somewhat more precise timing
mechanism -- clock_gettime with the CLOCK_PROCESS_CPUTIME_ID clock
selected.

For system time, we have to do a full getrusage call to extract the
system time from the OS. This is expensive but unavoidable.

In passing, clean up the implementation of the old APIs and fix some
latent bugs in the Windows code. This might have manifested on Windows
ARM systems or other systems with strange 64-bit integer behavior.

The old API for this both user time and system time simultaneously from
a single getrusage call. While this results in fewer system calls, it
also results in a lower precision user time and if only user time is
desired, it introduces a higher overhead. It may be worthwhile to switch
some of the pass timers to not track system time and directly track user
and wall time. The old API also tracked walltime in a confusing way --
it just set it to the current walltime rather than providing any measure
of wall time since the process started the way buth user and system time
are tracked. The new API is more consistent here.

The plan is to eventually implement these methods for a *child* process
by using the wait3(2) system call to populate an rusage struct
representing the whole subprocess execution. That way, after waiting on
a child process its stats will become accurate and cheap to query.

llvm-svn: 171551
2013-01-04 23:19:55 +00:00
Michael J. Spencer 895809159a [CMake] MSVC is incorrectly emitting C4239 in some cases. Disable it.
llvm-svn: 171430
2013-01-03 00:00:40 +00:00
NAKAMURA Takumi 04a664e92e [CMake] AddLLVM.cmake: Tweak the corner case that "check-all" doesn't have any tests.
"check-all" can be executed with 0 status, "check-all does nothing, no tools built."

LLVM_EXTERNAL_CLANG_BUILD=OFF LLVM_BUILD_TOOLS=OFF can reproduce this.
Oscar Fuentes reported this. Thank you.

llvm-svn: 171046
2012-12-24 22:43:59 +00:00
Dmitri Gribenko 06b84eb414 Fix a typo introduced in r168577: FlAGS -> FLAGS (note the lowercase ell)
Now we really pass -Wcovered-switch-default if the compiler supports it.

llvm-svn: 171040
2012-12-24 17:52:48 +00:00
Alexey Samsonov e6ddb98565 CMake: factor out a function that returns the expected directory for unit test
llvm-svn: 170539
2012-12-19 12:30:33 +00:00
Jim Grosbach f7cbcf2648 CMake: Don't run 'git svn' if there is no .git/svn directory.
If the local checkout does not have 'git svn' references set up, don't try
to use 'git svn' for version information.

llvm-svn: 169749
2012-12-10 19:03:37 +00:00
Joe Abbey 15d9834df9 Removing SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
Adding CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
       C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG

This is to handle the wackiness on a Mac host where cmake detects:

CMAKE_CXX_COMPILER == "/usr/bin/c++"
CMAKE_C_COMPILER == "/usr/bin/gcc"

llvm-svn: 168577
2012-11-26 02:02:08 +00:00
Jordan Rose c7b09dd1d1 CMake: Include private headers / tablegen files in generated Xcode projects.
llvm-svn: 166503
2012-10-23 21:36:55 +00:00
NAKAMURA Takumi 54d2274914 [CMake] add_lit_testsuite: EXCLUDE_FROM_ALL excludes the test ${target} out of check-all.
llvm-svn: 165618
2012-10-10 13:32:55 +00:00
NAKAMURA Takumi 700cd4053a [CMake] Enhance add_llvm_external_project.
- Substitute hyphen to underscore, s/-/_/g, as the variable name.
  - Additional parameter can be specified as the name of directory.

e.g.) add_llvm_external_project(clang-tools-extra extra)

  - LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=/path/to/llvm-srcroot/tools/clang/tools/extra, by default.
  - Build directory is in ${CMAKE_CURRENT_BINARY_DIR}/extra

llvm-svn: 165311
2012-10-05 14:10:17 +00:00
NAKAMURA Takumi aa63610b09 [CMake] add_lit_target: Remove comments about add_dependencies. It is not a bug in cmake that add_custom_target(DEPENDS) would not accept targets but file-level dependencies.
llvm-svn: 161295
2012-08-04 02:14:44 +00:00
Gabor Greif c6c28ff8e6 detabify
llvm-svn: 160128
2012-07-12 13:18:13 +00:00
NAKAMURA Takumi 80eb0c502d LLVMConfig.cmake.in: Quote around @LLVM_INSTALL_PREFIX@, or it would not accept whitespace paths.
Thanks to Kai.

llvm-svn: 159887
2012-07-07 03:12:28 +00:00
Chandler Carruth aec961811b Revert r159588, and apply a more principled fix. Place the fix for this
in the abstraction for lit test suites so that the various other layers
of abstraction pick up the same behavioral fix, and so that we still get
a complete list of dependencies for the 'check-all' target.

This should fix the follow-on issues of the same nature with various
other build targets, including Clang targets. Sorry for the churn, and
again thanks to Matt for testing and breaking this more thoroughly.

llvm-svn: 159593
2012-07-02 21:31:03 +00:00
Chandler Carruth cfa4652d3a Switch from using a lit.cfg-generator variable that happens to be found
due to strange scoping rules to the actual canonical variable name
within the LLVM CMake build.

No functionality changed.

llvm-svn: 159575
2012-07-02 20:14:54 +00:00
Chandler Carruth 69ce6652b8 Hoist LLVM's lit testsuite infrastructure into module so that it can be
re-used. Also, build in direct support for accumulating a set of lit
parameters, arguments, and testsuites to run as part of a 'check-all'
rule. This sinks 'check-all' from a Clang-specific construct to
a generic construct of the project.

llvm-svn: 159482
2012-06-30 10:14:14 +00:00
Chandler Carruth 87dfb1d3fe Add a missing common variable to the lit.site.cfg generation. This was
only used in the Clang tree, but it seems reasonable to support.

llvm-svn: 159399
2012-06-29 00:40:15 +00:00
Chandler Carruth 3511dd30c8 Move the setup for variables that are expanded in the lit.site.cfg into
a dedicated helper function. This will enable re-using the same logic
for Clang's lit setup, etc.

llvm-svn: 159333
2012-06-28 06:36:24 +00:00
NAKAMURA Takumi 1171e816ba LLVMProcessSources.cmake: [MSVC] Don't add "PROPERTIES HEADER_FILE_ONLY" to *.def.
FIXME: Shall we put *.def(s) to the folder?
llvm-svn: 159102
2012-06-24 03:50:58 +00:00
Chandler Carruth 582e8a5d42 Avoid using the recently added APPEND_STRING feature. This should
restore support for CMake versions before 2.8.6 -- sorry for the
trouble!

llvm-svn: 158930
2012-06-21 18:44:24 +00:00
Chandler Carruth 94d0251824 Completely refactor the structuring of unittest CMake files to match the
Makefiles, the CMake files in every other part of the LLVM tree, and
sanity.

This should also restore the output tree structure of all the unit
tests, sorry for breaking that, and thanks for letting me know.

The fundamental change is to put a CMakeLists.txt file in the unittest
directory, with a single test binary produced from it. This has several
advantages:

- No more weird directory stripping in the unittest macro, allowing it
  to be used more readily in other projects.
- No more directory prefixes on all the source files.
- Allows correct and precise use of LLVM's per-directory dependency
  system.
- Allows use of the checking logic for source files that have not been
  added to the CMake build. This uncovered a file being skipped with
  CMake in LLVM and one in Clang's unit tests.
- Makes Specifying conditional compilation or other custom logic for JIT
  tests easier.

It did require adding the concept of an explicit 'optional' source file
to the CMake build so that the missing-file check can skip cases where
the file is *supposed* to be missing. =]

This is another chunk of refactoring the CMake build in order to make it
usable for other clients like CompilerRT / ASan / TSan.

Note that this is interdependent with a Clang CMake change.

llvm-svn: 158909
2012-06-21 09:51:26 +00:00
Chandler Carruth a5d42f83f9 Factor the logic for setting up a GoogleTest unit test executable into
a helper function in CMake. This will allow us to share all of this
logic with Clang, and eventually CompilerRT.

llvm-svn: 158896
2012-06-21 05:16:58 +00:00
Chandler Carruth e530d2ba4d Remove one of the LLVM-specific CMake hacks in favor of standard CMake
facilities.

This was only used in one place in LLVM, and was used pervasively (but
with different code!) in Clang. It has no advantages over the standard
CMake facilities and in some cases disadvantages.

llvm-svn: 158889
2012-06-21 01:35:09 +00:00
NAKAMURA Takumi e0d4a7c5be TableGen.cmake: Fix to work without LLVM_COMMON_DEPENDS.
llvm-svn: 158650
2012-06-17 15:41:56 +00:00
Tobias Grosser b32ad40188 cmake: Pass the -m32 flag to modules if LLVM_BUILD_32_BITS is enabled
This was previously only done for executables and shared libraries, but not
for modules. As modules are essentially shared libraries (that need to be
dlopened explicitly), threating them the same as shared libraries seems
reasonable. This fixes the LLVM_BUILD_32_BITS build of Polly.

Contributed by: Ondra Hosek  <ondra.hosek@gmail.com>

llvm-svn: 158195
2012-06-08 09:41:23 +00:00
Michael J. Spencer aeb59e1d0d [CMake] Promote extension warnings to errors.
llvm-svn: 158176
2012-06-07 23:33:56 +00:00
Michael J. Spencer 08180c325f [CMake] Order MSVC warnings numerically.
llvm-svn: 158171
2012-06-07 21:34:31 +00:00
Michael J. Spencer 6d45d834a7 [CMake] Adjust MSVC warnings.
Remove /Wall from LLVM_ENABLE_WARNINGS (it's useless) and promote 4239
to a level 1 warning.

llvm-svn: 158170
2012-06-07 21:34:15 +00:00
Tim Northover f6e29c4771 Fix how CMake appends -m32 to linker command-lines
llvm-svn: 157337
2012-05-23 18:42:02 +00:00