[Lldb-commits] [lldb] r251354 - Revert "Clang module compilation options need to be per-platform."
Adrian McCarthy via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 26 14:38:41 PDT 2015
Author: amccarth
Date: Mon Oct 26 16:38:41 2015
New Revision: 251354
URL: http://llvm.org/viewvc/llvm-project?rev=251354&view=rev
Log:
Revert "Clang module compilation options need to be per-platform."
This reverts commit r251340.
Breaks the Windows build because Windows doesn't have getuid. The fix is not obvious.
Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h
lldb/trunk/source/Target/Platform.cpp
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=251354&r1=251353&r2=251354&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp Mon Oct 26 16:38:41 2015
@@ -641,7 +641,18 @@ ClangModulesDeclVendor::Create(Target &t
compiler_invocation_arguments.push_back(ModuleImportBufferName);
// Add additional search paths with { "-I", path } or { "-F", path } here.
-
+
+ {
+ llvm::SmallString<128> DefaultModuleCache;
+ const bool erased_on_reboot = false;
+ llvm::sys::path::system_temp_directory(erased_on_reboot, DefaultModuleCache);
+ llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang");
+ llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
+ std::string module_cache_argument("-fmodules-cache-path=");
+ module_cache_argument.append(DefaultModuleCache.str().str());
+ compiler_invocation_arguments.push_back(module_cache_argument);
+ }
+
FileSpecList &module_search_paths = target.GetClangModuleSearchPaths();
for (size_t spi = 0, spe = module_search_paths.GetSize(); spi < spe; ++spi)
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=251354&r1=251353&r2=251354&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Mon Oct 26 16:38:41 2015
@@ -35,10 +35,6 @@
#include "lldb/Target/Target.h"
#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/Path.h"
-
using namespace lldb;
using namespace lldb_private;
@@ -1480,17 +1476,6 @@ PlatformDarwin::AddClangModuleCompilatio
apple_arguments.begin(),
apple_arguments.end());
- {
- llvm::SmallString<128> DefaultModuleCache;
- const bool erased_on_reboot = false;
- llvm::sys::path::system_temp_directory(erased_on_reboot, DefaultModuleCache);
- llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang");
- llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
- std::string module_cache_argument("-fmodules-cache-path=");
- module_cache_argument.append(DefaultModuleCache.str().str());
- options.push_back(module_cache_argument);
- }
-
StreamString minimum_version_option;
uint32_t versions[3] = { 0, 0, 0 };
bool use_current_os_version = false;
Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=251354&r1=251353&r2=251354&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Mon Oct 26 16:38:41 2015
@@ -27,10 +27,6 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/ProcessLaunchInfo.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/Path.h"
-
using namespace lldb;
using namespace lldb_private;
@@ -852,64 +848,4 @@ void
PlatformPOSIX::CalculateTrapHandlerSymbolNames ()
{
m_trap_handlers.push_back (ConstString ("_sigtramp"));
-}
-
-static bool isAlphanumeric(const char c)
-{
- return ((c >= '0' && c <= '9') ||
- (c >= 'a' && c <= 'z') ||
- (c >= 'A' && c <= 'Z'));
-}
-
-static void appendUserToPath(llvm::SmallVectorImpl<char> &Result)
-{
- const char *username = getenv("LOGNAME");
-
- if (username)
- {
- // Validate that LoginName can be used in a path, and get its length.
- size_t Len = 0;
- for (const char *P = username; *P; ++P, ++Len) {
- if (!isAlphanumeric(*P) && *P != '_') {
- username = nullptr;
- break;
- }
- }
-
- if (username && Len > 0) {
- Result.append(username, username + Len);
- return;
- }
- }
-
- // Fallback to user id.
- std::string UID = llvm::utostr(getuid());
-
- Result.append(UID.begin(), UID.end());
-}
-
-void
-PlatformPOSIX::AddClangModuleCompilationOptions (Target *target, std::vector<std::string> &options)
-{
- std::vector<std::string> default_compilation_options =
- {
- "-x", "c++", "-Xclang", "-nostdsysteminc", "-Xclang", "-nostdsysteminc"
- };
-
- options.insert(options.end(),
- default_compilation_options.begin(),
- default_compilation_options.end());
-
- {
- llvm::SmallString<128> DefaultModuleCache;
- const bool erased_on_reboot = false;
- llvm::sys::path::system_temp_directory(erased_on_reboot, DefaultModuleCache);
- llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang.");
- appendUserToPath(DefaultModuleCache);
- llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
- std::string module_cache_argument("-fmodules-cache-path=");
- module_cache_argument.append(DefaultModuleCache.str().str());
- options.push_back(module_cache_argument);
- }
-}
-
+}
Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h?rev=251354&r1=251353&r2=251354&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h Mon Oct 26 16:38:41 2015
@@ -176,9 +176,6 @@ public:
lldb_private::Error
DisconnectRemote () override;
- void
- AddClangModuleCompilationOptions (lldb_private::Target *target, std::vector<std::string> &options) override;
-
protected:
std::unique_ptr<lldb_private::OptionGroupOptions> m_options;
Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=251354&r1=251353&r2=251354&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Mon Oct 26 16:38:41 2015
@@ -38,13 +38,12 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/UnixSignals.h"
#include "lldb/Utility/Utils.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/SmallString.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "Utility/ModuleCache.h"
+
// Define these constants from POSIX mman.h rather than include the file
// so that they will be correct even when compiled on Linux.
#define MAP_PRIVATE 2
@@ -622,17 +621,6 @@ Platform::AddClangModuleCompilationOptio
options.insert(options.end(),
default_compilation_options.begin(),
default_compilation_options.end());
-
- {
- llvm::SmallString<128> DefaultModuleCache;
- const bool erased_on_reboot = false;
- llvm::sys::path::system_temp_directory(erased_on_reboot, DefaultModuleCache);
- llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang");
- llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
- std::string module_cache_argument("-fmodules-cache-path=");
- module_cache_argument.append(DefaultModuleCache.str().str());
- options.push_back(module_cache_argument);
- }
}
More information about the lldb-commits
mailing list