2013-12-10 03:04:43 +08:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
2014-10-16 08:12:02 +08:00
|
|
|
Core
|
2013-12-10 03:04:43 +08:00
|
|
|
MC
|
|
|
|
Support
|
|
|
|
)
|
2011-02-12 07:46:38 +08:00
|
|
|
|
2014-11-20 11:57:45 +08:00
|
|
|
find_first_existing_vc_file(llvm_vc "${LLVM_MAIN_SRC_DIR}")
|
|
|
|
find_first_existing_vc_file(clang_vc "${CLANG_SOURCE_DIR}")
|
2014-11-20 06:03:48 +08:00
|
|
|
|
2014-12-06 06:32:49 +08:00
|
|
|
# The VC revision include that we want to generate.
|
|
|
|
set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc")
|
|
|
|
|
2016-10-19 20:21:39 +08:00
|
|
|
set(get_svn_script "${LLVM_CMAKE_PATH}/GetSVN.cmake")
|
2014-12-10 08:03:37 +08:00
|
|
|
|
2014-11-20 06:03:48 +08:00
|
|
|
if(DEFINED llvm_vc AND DEFINED clang_vc)
|
|
|
|
# Create custom target to generate the VC revision include.
|
2014-12-06 06:32:49 +08:00
|
|
|
add_custom_command(OUTPUT "${version_inc}"
|
2014-12-10 08:03:37 +08:00
|
|
|
DEPENDS "${llvm_vc}" "${clang_vc}" "${get_svn_script}"
|
2014-11-20 06:03:48 +08:00
|
|
|
COMMAND
|
|
|
|
${CMAKE_COMMAND} "-DFIRST_SOURCE_DIR=${LLVM_MAIN_SRC_DIR}"
|
|
|
|
"-DFIRST_NAME=LLVM"
|
|
|
|
"-DSECOND_SOURCE_DIR=${CLANG_SOURCE_DIR}"
|
2014-12-11 07:49:03 +08:00
|
|
|
"-DSECOND_NAME=SVN"
|
2014-12-06 06:32:49 +08:00
|
|
|
"-DHEADER_FILE=${version_inc}"
|
2014-12-10 08:03:37 +08:00
|
|
|
-P "${get_svn_script}")
|
2014-11-20 06:03:48 +08:00
|
|
|
|
|
|
|
# Mark the generated header as being generated.
|
2014-12-06 06:32:49 +08:00
|
|
|
set_source_files_properties("${version_inc}"
|
2014-11-20 06:03:48 +08:00
|
|
|
PROPERTIES GENERATED TRUE
|
|
|
|
HEADER_FILE_ONLY TRUE)
|
|
|
|
|
|
|
|
# Tell Version.cpp that it needs to build with -DHAVE_SVN_VERSION_INC.
|
|
|
|
set_source_files_properties(Version.cpp
|
|
|
|
PROPERTIES COMPILE_DEFINITIONS "HAVE_SVN_VERSION_INC")
|
|
|
|
else()
|
2014-12-06 06:32:49 +08:00
|
|
|
# Not producing a VC revision include.
|
2014-11-20 06:03:48 +08:00
|
|
|
set(version_inc)
|
2016-06-25 04:21:12 +08:00
|
|
|
|
|
|
|
# Being able to force-set the SVN revision in cases where it isn't available
|
|
|
|
# is useful for performance tracking, and matches compatibility from autoconf.
|
|
|
|
if(SVN_REVISION)
|
|
|
|
set_source_files_properties(Version.cpp
|
|
|
|
PROPERTIES COMPILE_DEFINITIONS "SVN_REVISION=\"${SVN_REVISION}\"")
|
|
|
|
endif()
|
2014-11-20 06:03:48 +08:00
|
|
|
endif()
|
|
|
|
|
2008-10-26 08:56:18 +08:00
|
|
|
add_clang_library(clangBasic
|
2014-03-31 21:14:44 +08:00
|
|
|
Attributes.cpp
|
2009-06-14 09:05:48 +08:00
|
|
|
Builtins.cpp
|
2013-02-09 06:30:22 +08:00
|
|
|
CharInfo.cpp
|
2016-07-07 05:21:39 +08:00
|
|
|
Cuda.cpp
|
2008-10-26 08:56:18 +08:00
|
|
|
Diagnostic.cpp
|
2010-11-19 05:19:52 +08:00
|
|
|
DiagnosticIDs.cpp
|
2015-06-13 15:11:40 +08:00
|
|
|
DiagnosticOptions.cpp
|
2008-10-26 08:56:18 +08:00
|
|
|
FileManager.cpp
|
2010-11-24 03:19:34 +08:00
|
|
|
FileSystemStatCache.cpp
|
2008-10-26 08:56:18 +08:00
|
|
|
IdentifierTable.cpp
|
2011-09-14 01:21:33 +08:00
|
|
|
LangOptions.cpp
|
Reapply "Modules: Cache PCMs in memory and avoid a use-after-free"
This reverts commit r298185, effectively reapplying r298165, after fixing the
new unit tests (PR32338). The memory buffer generator doesn't null-terminate
the MemoryBuffer it creates; this version of the commit informs getMemBuffer
about that to avoid the assert.
Original commit message follows:
----
Clang's internal build system for implicit modules uses lock files to
ensure that after a process writes a PCM it will read the same one back
in (without contention from other -cc1 commands). Since PCMs are read
from disk repeatedly while invalidating, building, and importing, the
lock is not released quickly. Furthermore, the LockFileManager is not
robust in every environment. Other -cc1 commands can stall until
timeout (after about eight minutes).
This commit changes the lock file from being necessary for correctness
to a (possibly dubious) performance hack. The remaining benefit is to
reduce duplicate work in competing -cc1 commands which depend on the
same module. Follow-up commits will change the internal build system to
continue after a timeout, and reduce the timeout. Perhaps we should
reconsider blocking at all.
This also fixes a use-after-free, when one part of a compilation
validates a PCM and starts using it, and another tries to swap out the
PCM for something new.
The PCMCache is a new type called MemoryBufferCache, which saves memory
buffers based on their filename. Its ownership is shared by the
CompilerInstance and ModuleManager.
- The ModuleManager stores PCMs there that it loads from disk, never
touching the disk if the cache is hot.
- When modules fail to validate, they're removed from the cache.
- When a CompilerInstance is spawned to build a new module, each
already-loaded PCM is assumed to be valid, and is frozen to avoid
the use-after-free.
- Any newly-built module is written directly to the cache to avoid the
round-trip to the filesystem, making lock files unnecessary for
correctness.
Original patch by Manman Ren; most testcases by Adrian Prantl!
llvm-svn: 298278
2017-03-21 01:58:26 +08:00
|
|
|
MemoryBufferCache.cpp
|
2011-12-01 07:21:26 +08:00
|
|
|
Module.cpp
|
2012-06-20 14:18:46 +08:00
|
|
|
ObjCRuntime.cpp
|
2013-03-22 14:34:35 +08:00
|
|
|
OpenMPKinds.cpp
|
2012-12-21 04:25:19 +08:00
|
|
|
OperatorPrecedence.cpp
|
2014-10-16 03:57:45 +08:00
|
|
|
SanitizerBlacklist.cpp
|
2017-09-26 06:11:12 +08:00
|
|
|
SanitizerSpecialCaseList.cpp
|
2014-11-11 09:26:14 +08:00
|
|
|
Sanitizers.cpp
|
2008-10-26 08:56:18 +08:00
|
|
|
SourceLocation.cpp
|
|
|
|
SourceManager.cpp
|
|
|
|
TargetInfo.cpp
|
|
|
|
Targets.cpp
|
2017-07-22 06:37:03 +08:00
|
|
|
Targets/AArch64.cpp
|
|
|
|
Targets/AMDGPU.cpp
|
|
|
|
Targets/ARM.cpp
|
|
|
|
Targets/AVR.cpp
|
|
|
|
Targets/BPF.cpp
|
|
|
|
Targets/Hexagon.cpp
|
|
|
|
Targets/Lanai.cpp
|
|
|
|
Targets/Le64.cpp
|
|
|
|
Targets/MSP430.cpp
|
|
|
|
Targets/Mips.cpp
|
|
|
|
Targets/NVPTX.cpp
|
|
|
|
Targets/Nios2.cpp
|
|
|
|
Targets/OSTargets.cpp
|
|
|
|
Targets/PNaCl.cpp
|
|
|
|
Targets/PPC.cpp
|
2018-01-11 21:36:56 +08:00
|
|
|
Targets/RISCV.cpp
|
2017-07-22 06:37:03 +08:00
|
|
|
Targets/SPIR.cpp
|
|
|
|
Targets/Sparc.cpp
|
|
|
|
Targets/SystemZ.cpp
|
|
|
|
Targets/TCE.cpp
|
|
|
|
Targets/WebAssembly.cpp
|
|
|
|
Targets/X86.cpp
|
|
|
|
Targets/XCore.cpp
|
2008-10-26 08:56:18 +08:00
|
|
|
TokenKinds.cpp
|
2009-10-06 04:33:49 +08:00
|
|
|
Version.cpp
|
Implement a new 'availability' attribute, that allows one to specify
which versions of an OS provide a certain facility. For example,
void foo()
__attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));
says that the function "foo" was introduced in 10.2, deprecated in
10.4, and completely obsoleted in 10.6. This attribute ties in with
the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that
we want to deploy back to Mac OS X 10.1). There are several concrete
behaviors that this attribute enables, as illustrated with the
function foo() above:
- If we choose a deployment target >= Mac OS X 10.4, uses of "foo"
will result in a deprecation warning, as if we had placed
attribute((deprecated)) on it (but with a better diagnostic)
- If we choose a deployment target >= Mac OS X 10.6, uses of "foo"
will result in an "unavailable" warning (in C)/error (in C++), as
if we had placed attribute((unavailable)) on it
- If we choose a deployment target prior to 10.2, foo() is
weak-imported (if it is a kind of entity that can be weak
imported), as if we had placed the weak_import attribute on it.
Naturally, there can be multiple availability attributes on a
declaration, for different platforms; only the current platform
matters when checking availability attributes.
The only platforms this attribute currently works for are "ios" and
"macosx", since we already have -mxxxx-version-min flags for them and we
have experience there with macro tricks translating down to the
deprecated/unavailable/weak_import attributes. The end goal is to open
this up to other platforms, and even extension to other "platforms"
that are really libraries (say, through a #pragma clang
define_system), but that hasn't yet been designed and we may want to
shake out more issues with this narrower problem first.
Addresses <rdar://problem/6690412>.
As a drive-by bug-fix, if an entity is both deprecated and
unavailable, we only emit the "unavailable" diagnostic.
llvm-svn: 128127
2011-03-23 08:50:03 +08:00
|
|
|
VersionTuple.cpp
|
2014-02-21 05:59:23 +08:00
|
|
|
VirtualFileSystem.cpp
|
2014-04-30 00:25:26 +08:00
|
|
|
Warnings.cpp
|
2017-03-30 08:29:36 +08:00
|
|
|
XRayLists.cpp
|
2014-11-20 06:03:48 +08:00
|
|
|
${version_inc}
|
2008-10-26 08:56:18 +08:00
|
|
|
)
|
2009-03-17 07:06:59 +08:00
|
|
|
|