r201225 - 'svn add' files I forgot for r201224 (Add an option to allow Clang verify

Dmitri Gribenko gribozavr at gmail.com
Wed Feb 12 02:40:07 PST 2014


Author: gribozavr
Date: Wed Feb 12 04:40:07 2014
New Revision: 201225

URL: http://llvm.org/viewvc/llvm-project?rev=201225&view=rev
Log:
'svn add' files I forgot for r201224 (Add an option to allow Clang verify
source files for a module only once during)

Added:
    cfe/trunk/include/clang-c/BuildSystem.h
    cfe/trunk/test/Modules/fmodules-validate-once-per-build-session.c
    cfe/trunk/tools/libclang/BuildSystem.cpp

Added: cfe/trunk/include/clang-c/BuildSystem.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/BuildSystem.h?rev=201225&view=auto
==============================================================================
--- cfe/trunk/include/clang-c/BuildSystem.h (added)
+++ cfe/trunk/include/clang-c/BuildSystem.h Wed Feb 12 04:40:07 2014
@@ -0,0 +1,44 @@
+/*==-- clang-c/BuildSysetm.h - Utilities for use by build systems -*- C -*-===*\
+|*                                                                            *|
+|*                     The LLVM Compiler Infrastructure                       *|
+|*                                                                            *|
+|* This file is distributed under the University of Illinois Open Source      *|
+|* License. See LICENSE.TXT for details.                                      *|
+|*                                                                            *|
+|*===----------------------------------------------------------------------===*|
+|*                                                                            *|
+|* This header provides various utilities for use by build systems.           *|
+|*                                                                            *|
+\*===----------------------------------------------------------------------===*/
+
+#ifndef CLANG_BUILD_SYSTEM_H
+#define CLANG_BUILD_SYSTEM_H
+
+#include "clang-c/Platform.h"
+#include "clang-c/CXString.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup BUILD_SYSTEM Build system utilities
+ * @{
+ */
+
+/**
+ * \brief Return the timestamp for use with Clang's
+ * \c -fbuild-session-timestamp= option.
+ */
+CINDEX_LINKAGE unsigned long long clang_getBuildSessionTimestamp(void);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // CLANG_BUILD_SYSTEM_H
+

Added: cfe/trunk/test/Modules/fmodules-validate-once-per-build-session.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/fmodules-validate-once-per-build-session.c?rev=201225&view=auto
==============================================================================
--- cfe/trunk/test/Modules/fmodules-validate-once-per-build-session.c (added)
+++ cfe/trunk/test/Modules/fmodules-validate-once-per-build-session.c Wed Feb 12 04:40:07 2014
@@ -0,0 +1,45 @@
+#include "foo.h"
+
+// Clear the module cache.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/Inputs
+// RUN: mkdir -p %t/modules-to-compare
+
+// ===
+// Create a module with system headers.
+// RUN: echo 'void meow(void);' > %t/Inputs/foo.h
+// RUN: echo 'module Foo [system] { header "foo.h" }' > %t/Inputs/module.map
+
+// ===
+// Compile the module.
+// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s
+// RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp
+// RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-before.pcm
+
+// ===
+// Use it, and make sure that we did not recompile it.
+// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s
+// RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp
+// RUN: find %t/modules-cache -name Foo.pcm | xargs -I {} cp {} %t/modules-to-compare/Foo-after.pcm
+
+// RUN: diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm
+
+// ===
+// Change the sources.
+// RUN: echo 'void meow2(void);' > %t/Inputs/foo.h
+
+// ===
+// Use the module, and make sure that we did not recompile it, even though the sources changed.
+// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s
+// RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp
+// RUN: find %t/modules-cache -name Foo.pcm | xargs -I {} cp {} %t/modules-to-compare/Foo-after.pcm
+
+// RUN: diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm
+
+// ===
+// Recompile the module if the today's date is before 01 January 2030.
+// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1893456000 -fmodules-validate-once-per-build-session %s
+// RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp
+// RUN: find %t/modules-cache -name Foo.pcm | xargs -I {} cp {} %t/modules-to-compare/Foo-after.pcm
+
+// RUN: not diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm

Added: cfe/trunk/tools/libclang/BuildSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/BuildSystem.cpp?rev=201225&view=auto
==============================================================================
--- cfe/trunk/tools/libclang/BuildSystem.cpp (added)
+++ cfe/trunk/tools/libclang/BuildSystem.cpp Wed Feb 12 04:40:07 2014
@@ -0,0 +1,22 @@
+//===- BuildSystem.cpp - Utilities for use by build systems ---------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements various utilities for use by build systems.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang-c/BuildSystem.h"
+#include "llvm/Support/TimeValue.h"
+
+extern "C" {
+unsigned long long clang_getBuildSessionTimestamp(void) {
+  return llvm::sys::TimeValue::now().toEpochTime();
+}
+} // extern "C"
+





More information about the cfe-commits mailing list