[llvm] r332368 - Rename three cxx files in unittests to cpp.
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Tue May 15 09:30:30 PDT 2018
Author: nico
Date: Tue May 15 09:30:30 2018
New Revision: 332368
URL: http://llvm.org/viewvc/llvm-project?rev=332368&view=rev
Log:
Rename three cxx files in unittests to cpp.
LLVM uses cpp as its C++ file extension, these are the only three cxx file in
the monorepo. These files apparently were called to escape a CMake check -- use
the LLVM_OPTIONAL_SOURCES mechanism that's meant as an escape for this case
instead.
No intended behavior change.
https://reviews.llvm.org/D46843
Added:
llvm/trunk/unittests/Passes/TestPlugin.cpp
- copied, changed from r332367, llvm/trunk/unittests/Passes/TestPlugin.cxx
llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cpp
- copied, changed from r332367, llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx
llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cpp
- copied, changed from r332367, llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx
Removed:
llvm/trunk/unittests/Passes/TestPlugin.cxx
llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx
llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx
Modified:
llvm/trunk/unittests/Passes/CMakeLists.txt
llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt
Modified: llvm/trunk/unittests/Passes/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Passes/CMakeLists.txt?rev=332368&r1=332367&r2=332368&view=diff
==============================================================================
--- llvm/trunk/unittests/Passes/CMakeLists.txt (original)
+++ llvm/trunk/unittests/Passes/CMakeLists.txt Tue May 15 09:30:30 2018
@@ -1,3 +1,6 @@
+# Needed by LLVM's CMake checks because this file defines multiple targets.
+set(LLVM_OPTIONAL_SOURCES TestPlugin.cpp)
+
set(LLVM_LINK_COMPONENTS Support Passes Core)
# If plugins are disabled, this test will disable itself at runtime. Otherwise,
@@ -9,7 +12,7 @@ endif()
add_llvm_unittest(PluginsTests PluginsTest.cpp)
export_executable_symbols(PluginsTests)
-add_library(TestPlugin MODULE TestPlugin.cxx)
+add_library(TestPlugin MODULE TestPlugin.cpp)
set_output_directory(TestPlugin
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
Copied: llvm/trunk/unittests/Passes/TestPlugin.cpp (from r332367, llvm/trunk/unittests/Passes/TestPlugin.cxx)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Passes/TestPlugin.cpp?p2=llvm/trunk/unittests/Passes/TestPlugin.cpp&p1=llvm/trunk/unittests/Passes/TestPlugin.cxx&r1=332367&r2=332368&rev=332368&view=diff
==============================================================================
--- llvm/trunk/unittests/Passes/TestPlugin.cxx (original)
+++ llvm/trunk/unittests/Passes/TestPlugin.cpp Tue May 15 09:30:30 2018
@@ -1,4 +1,4 @@
-//===- unittests/Passes/Plugins/Plugin.cxx --------------------------------===//
+//===- unittests/Passes/Plugins/Plugin.cpp --------------------------------===//
//
// The LLVM Compiler Infrastructure
//
Removed: llvm/trunk/unittests/Passes/TestPlugin.cxx
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Passes/TestPlugin.cxx?rev=332367&view=auto
==============================================================================
--- llvm/trunk/unittests/Passes/TestPlugin.cxx (original)
+++ llvm/trunk/unittests/Passes/TestPlugin.cxx (removed)
@@ -1,39 +0,0 @@
-//===- unittests/Passes/Plugins/Plugin.cxx --------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Passes/PassBuilder.h"
-#include "llvm/Passes/PassPlugin.h"
-
-#include "TestPlugin.h"
-
-using namespace llvm;
-
-struct TestModulePass : public PassInfoMixin<TestModulePass> {
- PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM) {
- return PreservedAnalyses::all();
- }
-};
-
-void registerCallbacks(PassBuilder &PB) {
- PB.registerPipelineParsingCallback(
- [](StringRef Name, ModulePassManager &PM,
- ArrayRef<PassBuilder::PipelineElement> InnerPipeline) {
- if (Name == "plugin-pass") {
- PM.addPass(TestModulePass());
- return true;
- }
- return false;
- });
-}
-
-extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK LLVM_PLUGIN_EXPORT
-llvmGetPassPluginInfo() {
- return {LLVM_PLUGIN_API_VERSION, TEST_PLUGIN_NAME, TEST_PLUGIN_VERSION,
- registerCallbacks};
-}
Modified: llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt?rev=332368&r1=332367&r2=332368&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt (original)
+++ llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt Tue May 15 09:30:30 2018
@@ -1,6 +1,9 @@
+# Needed by LLVM's CMake checks because this file defines multiple targets.
+set(LLVM_OPTIONAL_SOURCES ExportedFuncs.cpp PipSqueak.cpp)
+
set(LLVM_LINK_COMPONENTS Support)
-add_library(DynamicLibraryLib STATIC ExportedFuncs.cxx)
+add_library(DynamicLibraryLib STATIC ExportedFuncs.cpp)
set_target_properties(DynamicLibraryLib PROPERTIES FOLDER "Tests")
add_llvm_unittest(DynamicLibraryTests DynamicLibraryTest.cpp)
@@ -8,7 +11,7 @@ target_link_libraries(DynamicLibraryTest
export_executable_symbols(DynamicLibraryTests)
function(dynlib_add_module NAME)
- add_library(${NAME} SHARED PipSqueak.cxx)
+ add_library(${NAME} SHARED PipSqueak.cpp)
set_target_properties(${NAME} PROPERTIES FOLDER "Tests")
set_output_directory(${NAME}
Copied: llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cpp (from r332367, llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cpp?p2=llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cpp&p1=llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx&r1=332367&r2=332368&rev=332368&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx (original)
+++ llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cpp Tue May 15 09:30:30 2018
@@ -1,4 +1,4 @@
-//===- llvm/unittest/Support/DynamicLibrary/DynamicLibraryLib.cpp ---------===//
+//===- llvm/unittest/Support/DynamicLibrary/ExportedFuncs.cpp -------------===//
//
// The LLVM Compiler Infrastructure
//
Removed: llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx?rev=332367&view=auto
==============================================================================
--- llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx (original)
+++ llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx (removed)
@@ -1,16 +0,0 @@
-//===- llvm/unittest/Support/DynamicLibrary/DynamicLibraryLib.cpp ---------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "PipSqueak.h"
-
-#ifndef PIPSQUEAK_TESTA_RETURN
-#define PIPSQUEAK_TESTA_RETURN "ProcessCall"
-#endif
-
-extern "C" PIPSQUEAK_EXPORT const char *TestA() { return PIPSQUEAK_TESTA_RETURN; }
Copied: llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cpp (from r332367, llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cpp?p2=llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cpp&p1=llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx&r1=332367&r2=332368&rev=332368&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx (original)
+++ llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cpp Tue May 15 09:30:30 2018
@@ -1,4 +1,4 @@
-//===- llvm/unittest/Support/DynamicLibrary/PipSqueak.cxx -----------------===//
+//===- llvm/unittest/Support/DynamicLibrary/PipSqueak.cpp -----------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -46,4 +46,4 @@ extern "C" PIPSQUEAK_EXPORT void TestOrd
}
#define PIPSQUEAK_TESTA_RETURN "LibCall"
-#include "ExportedFuncs.cxx"
+#include "ExportedFuncs.cpp"
Removed: llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx?rev=332367&view=auto
==============================================================================
--- llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx (original)
+++ llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx (removed)
@@ -1,49 +0,0 @@
-//===- llvm/unittest/Support/DynamicLibrary/PipSqueak.cxx -----------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "PipSqueak.h"
-
-struct Global {
- std::string *Str;
- std::vector<std::string> *Vec;
- Global() : Str(nullptr), Vec(nullptr) {}
- ~Global() {
- if (Str) {
- if (Vec)
- Vec->push_back(*Str);
- *Str = "Global::~Global";
- }
- }
-};
-
-static Global Glb;
-
-struct Local {
- std::string &Str;
- Local(std::string &S) : Str(S) {
- Str = "Local::Local";
- if (Glb.Str && !Glb.Str->empty())
- Str += std::string("(") + *Glb.Str + std::string(")");
- }
- ~Local() { Str = "Local::~Local"; }
-};
-
-
-extern "C" PIPSQUEAK_EXPORT void SetStrings(std::string &GStr,
- std::string &LStr) {
- Glb.Str = &GStr;
- static Local Lcl(LStr);
-}
-
-extern "C" PIPSQUEAK_EXPORT void TestOrder(std::vector<std::string> &V) {
- Glb.Vec = &V;
-}
-
-#define PIPSQUEAK_TESTA_RETURN "LibCall"
-#include "ExportedFuncs.cxx"
More information about the llvm-commits
mailing list