[Lldb-commits] [PATCH] D17266: delete unused function in ClangExpressionParser`

2016-02-15 Thread Luke Drummond via lldb-commits
ldrumm created this revision.
ldrumm added reviewers: clayborg, spyffe, jingham.
ldrumm added a subscriber: lldb-commits.

[git 65dafa83] introduced the `GetBuiltinIncludePath` function copied from 
[cfe/lib/Driver/CC1Options.cpp](http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CC1Options.cpp?view=markup&pathrev=90090#l378#)

This function is no longer used in lldb's expression parser and I believe it is 
safe to remove it.

http://reviews.llvm.org/D17266

Files:
  source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -87,21 +87,6 @@
 // Utility Methods for Clang
 
//===--===//
 
-std::string GetBuiltinIncludePath(const char *Argv0) {
-SmallString<128> P(llvm::sys::fs::getMainExecutable(
-Argv0, (void *)(intptr_t) GetBuiltinIncludePath));
-
-if (!P.empty()) {
-llvm::sys::path::remove_filename(P); // Remove /clang from 
foo/bin/clang
-llvm::sys::path::remove_filename(P); // Remove /bin   from foo/bin
-
-// Get foo/lib/clang//include
-llvm::sys::path::append(P, "lib", "clang", CLANG_VERSION_STRING,
-"include");
-}
-
-return P.str();
-}
 
 class ClangExpressionParser::LLDBPreprocessorCallbacks : public PPCallbacks
 {


Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -87,21 +87,6 @@
 // Utility Methods for Clang
 //===--===//
 
-std::string GetBuiltinIncludePath(const char *Argv0) {
-SmallString<128> P(llvm::sys::fs::getMainExecutable(
-Argv0, (void *)(intptr_t) GetBuiltinIncludePath));
-
-if (!P.empty()) {
-llvm::sys::path::remove_filename(P); // Remove /clang from foo/bin/clang
-llvm::sys::path::remove_filename(P); // Remove /bin   from foo/bin
-
-// Get foo/lib/clang//include
-llvm::sys::path::append(P, "lib", "clang", CLANG_VERSION_STRING,
-"include");
-}
-
-return P.str();
-}
 
 class ClangExpressionParser::LLDBPreprocessorCallbacks : public PPCallbacks
 {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D17273: refactor/cleanup ClangExpressionParser::Parse

2016-02-15 Thread Luke Drummond via lldb-commits
ldrumm created this revision.
ldrumm added reviewers: clayborg, zturner, spyffe.
ldrumm added a subscriber: lldb-commits.

  - fix return type: `ClangExpressionParser::Parse` returns unsigned, but was 
actually returning a signed value, `num_errors`.
  - use helper `clang::TextDiagnosticBuffer::getNumErrors()` instead of 
counting the errors ourself.
  - limit scoping of block-level automatic variables as much as practical.
  - remove reused multipurpose `TextDiagnosticBuffer::const_iterator` in favour 
of loop-scoped `err`, `warn`, and `note` variables in the diagnostic printing 
code.
  - refactor diagnostic printing loops to use a proper loop invariant.


http://reviews.llvm.org/D17273

Files:
  source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -440,37 +440,34 @@
 }
 
 unsigned
-ClangExpressionParser::Parse (Stream &stream)
+ClangExpressionParser::Parse(Stream &stream)
 {
-TextDiagnosticBuffer *diag_buf = static_cast(m_compiler->getDiagnostics().getClient());
-
-diag_buf->FlushDiagnostics (m_compiler->getDiagnostics());
+TextDiagnosticBuffer *diag_buf = static_cast(m_compiler->getDiagnostics().getClient());
+diag_buf->FlushDiagnostics(m_compiler->getDiagnostics());
 
 const char *expr_text = m_expr.Text();
 
-clang::SourceManager &SourceMgr = m_compiler->getSourceManager();
+clang::SourceManager &source_mgr = m_compiler->getSourceManager();
 bool created_main_file = false;
 if (m_compiler->getCodeGenOpts().getDebugInfo() == codegenoptions::FullDebugInfo)
 {
-std::string temp_source_path;
-
 int temp_fd = -1;
 llvm::SmallString result_path;
 FileSpec tmpdir_file_spec;
 if (HostInfo::GetLLDBPath(lldb::ePathTypeLLDBTempSystemDir, tmpdir_file_spec))
 {
 tmpdir_file_spec.AppendPathComponent("lldb-%%.expr");
-temp_source_path = tmpdir_file_spec.GetPath();
+std::string temp_source_path = tmpdir_file_spec.GetPath();
 llvm::sys::fs::createUniqueFile(temp_source_path, temp_fd, result_path);
 }
 else
 {
 llvm::sys::fs::createTemporaryFile("lldb", "expr", temp_fd, result_path);
 }
-
+
 if (temp_fd != -1)
 {
-lldb_private::File file (temp_fd, true);
+lldb_private::File file(temp_fd, true);
 const size_t expr_text_len = strlen(expr_text);
 size_t bytes_written = expr_text_len;
 if (file.Write(expr_text, bytes_written).Success())
@@ -478,9 +475,8 @@
 if (bytes_written == expr_text_len)
 {
 file.Close();
-SourceMgr.setMainFileID(SourceMgr.createFileID(
-m_file_manager->getFile(result_path),
-SourceLocation(), SrcMgr::C_User));
+source_mgr.setMainFileID(
+source_mgr.createFileID(m_file_manager->getFile(result_path), SourceLocation(), SrcMgr::C_User));
 created_main_file = true;
 }
 }
@@ -490,7 +486,7 @@
 if (!created_main_file)
 {
 std::unique_ptr memory_buffer = MemoryBuffer::getMemBufferCopy(expr_text, __FUNCTION__);
-SourceMgr.setMainFileID(SourceMgr.createFileID(std::move(memory_buffer)));
+source_mgr.setMainFileID(source_mgr.createFileID(std::move(memory_buffer)));
 }
 
 diag_buf->BeginSourceFile(m_compiler->getLangOpts(), &m_compiler->getPreprocessor());
@@ -515,34 +511,22 @@
 
 diag_buf->EndSourceFile();
 
-TextDiagnosticBuffer::const_iterator diag_iterator;
+unsigned num_errors = diag_buf->getNumErrors();
 
-int num_errors = 0;
-
 if (m_pp_callbacks && m_pp_callbacks->hasErrors())
 {
 num_errors++;
-
 stream.PutCString(m_pp_callbacks->getErrorString().c_str());
 }
 
-for (diag_iterator = diag_buf->warn_begin();
- diag_iterator != diag_buf->warn_end();
- ++diag_iterator)
-stream.Printf("warning: %s\n", (*diag_iterator).second.c_str());
+for (auto warn = diag_buf->warn_begin(), warn_end = diag_buf->warn_end(); warn != warn_end; ++warn)
+stream.Printf("warning: %s\n", warn->second.c_str());
 
-for (diag_iterator = diag_buf->err_begin();
- diag_iterator != diag_buf->err_end();
- ++diag_iterator)
-{
-num_errors++;
-stream.Printf("error: %s\n", (*diag_iterator).second.c_str());
-}
+for (auto err = diag_buf->err_begin(), err_end = diag_buf->err_end(); err != err_end; ++err)
+stream.Printf("error: %s\n", err->second.c_str());
 
-for (diag_iterator = diag_buf->note_begin

Re: [Lldb-commits] [PATCH] D17088: Add target and host platform enums so we're not using strings everywhere

2016-02-15 Thread Todd Fiala via lldb-commits
tfiala accepted this revision.
tfiala added a comment.

LGTM.  Having the single list to cover host and target is a good way to go 
here, too.


http://reviews.llvm.org/D17088



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r260909 - Refinement of r260624. It is possible somebody might try to add to the map

2016-02-15 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Mon Feb 15 14:04:15 2016
New Revision: 260909

URL: http://llvm.org/viewvc/llvm-project?rev=260909&view=rev
Log:
Refinement of r260624.  It is possible somebody might try to add to the map
while we are finalizing its elements.  Prevent that.



Modified:
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/Symbol/TypeSystem.cpp

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=260909&r1=260908&r2=260909&view=diff
==
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Mon Feb 15 14:04:15 2016
@@ -607,9 +607,13 @@ protected:
 GetTypeSystemForLanguage (lldb::LanguageType language, Target *target, 
bool can_create);
 
 protected:
+void
+AddToMap (lldb::LanguageType language, lldb::TypeSystemSP const 
&type_system_sp);
+
 typedef std::map collection;
 mutable Mutex m_mutex; ///< A mutex to keep this object happy in 
multi-threaded environments.
 collection m_map;
+bool m_clear_in_progress;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Symbol/TypeSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/TypeSystem.cpp?rev=260909&r1=260908&r2=260909&view=diff
==
--- lldb/trunk/source/Symbol/TypeSystem.cpp (original)
+++ lldb/trunk/source/Symbol/TypeSystem.cpp Mon Feb 15 14:04:15 2016
@@ -165,7 +165,8 @@ TypeSystem::DeclContextFindDeclByName (v
 
 TypeSystemMap::TypeSystemMap() :
 m_mutex (),
-m_map ()
+m_map (),
+m_clear_in_progress(false)
 {
 }
 
@@ -180,6 +181,7 @@ TypeSystemMap::Clear ()
 {
 Mutex::Locker locker (m_mutex);
 map = m_map;
+m_clear_in_progress = true;
 }
 std::set visited;
 for (auto pair : map)
@@ -195,6 +197,7 @@ TypeSystemMap::Clear ()
 {
 Mutex::Locker locker (m_mutex);
 m_map.clear();
+m_clear_in_progress = false;
 }
 }
 
@@ -232,7 +235,7 @@ TypeSystemMap::GetTypeSystemForLanguage
 {
 // Add a new mapping for "language" to point to an already existing
 // TypeSystem that supports this language
-m_map[language] = pair.second;
+AddToMap(language, pair.second);
 return pair.second.get();
 }
 }
@@ -242,7 +245,7 @@ TypeSystemMap::GetTypeSystemForLanguage
 
 // Cache even if we get a shared pointer that contains null type system 
back
 lldb::TypeSystemSP type_system_sp = TypeSystem::CreateInstance (language, 
module);
-m_map[language] = type_system_sp;
+AddToMap (language, type_system_sp);
 return type_system_sp.get();
 }
 
@@ -260,7 +263,8 @@ TypeSystemMap::GetTypeSystemForLanguage
 {
 // Add a new mapping for "language" to point to an already existing
 // TypeSystem that supports this language
-m_map[language] = pair.second;
+
+AddToMap(language, pair.second);
 return pair.second.get();
 }
 }
@@ -269,7 +273,17 @@ TypeSystemMap::GetTypeSystemForLanguage
 return nullptr;
 
 // Cache even if we get a shared pointer that contains null type system 
back
-lldb::TypeSystemSP type_system_sp = TypeSystem::CreateInstance (language, 
target);
-m_map[language] = type_system_sp;
+lldb::TypeSystemSP type_system_sp;
+if (!m_clear_in_progress)
+type_system_sp = TypeSystem::CreateInstance (language, target);
+
+AddToMap(language, type_system_sp);
 return type_system_sp.get();
 }
+
+void
+TypeSystemMap::AddToMap (lldb::LanguageType language, lldb::TypeSystemSP const 
&type_system_sp)
+{
+if (!m_clear_in_progress)
+m_map[language] = type_system_sp;
+}


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D17274: improve readability and performance of ClangExpressionParser::FindFunctionInModule

2016-02-15 Thread Luke Drummond via lldb-commits
ldrumm created this revision.
ldrumm added reviewers: spyffe, dawn.
ldrumm added a subscriber: lldb-commits.

- Prefer `llvm::StringRef::find` over allocating a `std::string` and then 
discarding it after calling the equivalent `find` method.
- improve readability of function iterator, and make the function variable a 
`const` ref.
- Prefer passing `StringRef` directly to `ConstString::setString(StringRef &)` 
over allocating a new `std::string` from a StringRef only to convert to `const 
char *`, which is then passed to  ConstString::setCString(const char *)


http://reviews.llvm.org/D17274

Files:
  source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -556,17 +556,15 @@
 return num_errors;
 }
 
-static bool FindFunctionInModule (ConstString &mangled_name,
-  llvm::Module *module,
-  const char *orig_name)
+static bool
+FindFunctionInModule(ConstString &mangled_name, llvm::Module *module, const 
char *orig_name)
 {
-for (llvm::Module::iterator fi = module->getFunctionList().begin(), fe = 
module->getFunctionList().end();
- fi != fe;
- ++fi)
+for (const auto &func : module->getFunctionList())
 {
-if (fi->getName().str().find(orig_name) != std::string::npos)
+const StringRef &name = func.getName();
+if (name.find(orig_name) != StringRef::npos)
 {
-mangled_name.SetCString(fi->getName().str().c_str());
+mangled_name.SetString(name);
 return true;
 }
 }


Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -556,17 +556,15 @@
 return num_errors;
 }
 
-static bool FindFunctionInModule (ConstString &mangled_name,
-  llvm::Module *module,
-  const char *orig_name)
+static bool
+FindFunctionInModule(ConstString &mangled_name, llvm::Module *module, const char *orig_name)
 {
-for (llvm::Module::iterator fi = module->getFunctionList().begin(), fe = module->getFunctionList().end();
- fi != fe;
- ++fi)
+for (const auto &func : module->getFunctionList())
 {
-if (fi->getName().str().find(orig_name) != std::string::npos)
+const StringRef &name = func.getName();
+if (name.find(orig_name) != StringRef::npos)
 {
-mangled_name.SetCString(fi->getName().str().c_str());
+mangled_name.SetString(name);
 return true;
 }
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17274: improve readability and performance of ClangExpressionParser::FindFunctionInModule

2016-02-15 Thread Jim Ingham via lldb-commits
jingham added a subscriber: jingham.
jingham added a comment.

Other than that is looks fine.



Comment at: 
source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:559-560
@@ -558,5 +558,4 @@
 
-static bool FindFunctionInModule (ConstString &mangled_name,
-  llvm::Module *module,
-  const char *orig_name)
+static bool
+FindFunctionInModule(ConstString &mangled_name, llvm::Module *module, const 
char *orig_name)
 {

Don't make this kind of change, please.  As long as the arguments fit in 120 
characters we don't have a rule one way or the other about how to write 
argument lists like this.  But changing them just because they look better to 
you results in unnecessary churn.  Moreover, this is changing it away from the 
way all the other functions in this source file are written, so it ends up 
looking odd.


http://reviews.llvm.org/D17274



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17027: [expression evaluator] Allow runtimes to execute custom LLVM ModulePasses over the generated IR at various stages after expression compilation.

2016-02-15 Thread Luke Drummond via lldb-commits

Hi Jim

On 10/02/16 17:02, Jim Ingham wrote:



On Feb 10, 2016, at 3:45 AM, Luke Drummond  wrote:

ldrumm added a comment.



In http://reviews.llvm.org/D17027#347487, @jingham wrote:


This seems fine as a generic instrumentation point.  Obviously, the onus in on 
the passes, since they could totally ruin the expression evaluation if they 
don't do their job right...  But I'm not sure there's any good way to make this 
not a sharp tool.  But you should wait on Sean to weigh in as well...



I appreciate this, and I think that if a runtime provides passes, the 
expectation should be that the runtime knows what it's doing because this 
really //is// a powertool - as you say. I think it's a generally useful 
mechanism for better modularity/encapsulation of language-specific behaviours 
that are required during expression evaluation. For example, there are 
presently a large number of language-specific fixups in the clang-based 
expression evaluator, that could be factored out into individual 
`EarlyPasses/LatePasses` provided by their runtime, leaving `IRForTarget` and 
friends a lot cleaner and more maintainable.


Yes, that seems reasonable.




One question, what is the force of the "legacy" in "llvm::legacy::PassManager?  Is there 
some more "modern" way to do this, is this going to go away at some point?



The legacy pass manager is fully functional and tested. Using the new version 
does not work unfortunately in this instance. We can certainly move to the new 
version as it matures and becomes ready for general use, but I tried this 
implementation with both `llvm::PassManager` and the the 
`llvm::legacy::PassManager`, and unfortunately the new PassManager did not work 
here.



Did you file bugs with llvm on these issues?  It would be good to file a "move to 
the new pass manager when ready" bug on lldb, but it should be blocked on the 
relevant llvm bugs.



Not yet. I believe it's best to wait this until this revision is 
accepted before reporting bugs on its implementation. Though I'm happy 
to do so, I'll prefer to wait for yours and Sean's final comments.


Let me know your thoughts.

Best

Luke
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17027: [expression evaluator] Allow runtimes to execute custom LLVM ModulePasses over the generated IR at various stages after expression compilation.

2016-02-15 Thread Luke Drummond via lldb-commits
ldrumm added a subscriber: ldrumm.
ldrumm added a comment.

Hi Jim


http://reviews.llvm.org/D17027



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D16412: remove unused local string in IRForTarget.cpp

2016-02-15 Thread Luke Drummond via lldb-commits
ldrumm updated this revision to Diff 48006.
ldrumm added a comment.

rebased on current HEAD


http://reviews.llvm.org/D16412

Files:
  source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

Index: source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
===
--- source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -134,8 +134,6 @@
 {
 llvm_function.setLinkage(GlobalValue::ExternalLinkage);
 
-std::string name = llvm_function.getName().str();
-
 return true;
 }
 


Index: source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
===
--- source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -134,8 +134,6 @@
 {
 llvm_function.setLinkage(GlobalValue::ExternalLinkage);
 
-std::string name = llvm_function.getName().str();
-
 return true;
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r260914 - Silence some clang warnings

2016-02-15 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Mon Feb 15 15:50:28 2016
New Revision: 260914

URL: http://llvm.org/viewvc/llvm-project?rev=260914&view=rev
Log:
Silence some clang warnings

Silences -Wmissing-brace and -Wformat-pedantic warnings from clang on Linux.  
NFC.

Modified:

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
lldb/trunk/tools/driver/Driver.cpp

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=260914&r1=260913&r2=260914&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Mon Feb 15 15:50:28 2016
@@ -174,15 +174,15 @@ GetArgsX86_64(GetArgsCtx &ctx, ArgItem *
 // number of arguments passed in registers
 static const uint32_t c_args_in_reg = 6;
 // register passing order
-static const std::array c_reg_names = {"rdi", 
"rsi", "rdx", "rcx", "r8", "r9"};
+static const std::array c_reg_names{{"rdi", 
"rsi", "rdx", "rcx", "r8", "r9"}};
 // argument type to size mapping
-static const std::array arg_size = {
+static const std::array arg_size{{
 8, // ePointer,
 4, // eInt32,
 8, // eInt64,
 8, // eLong,
 4, // eBool,
-};
+}};
 
 // get the current stack pointer
 uint64_t sp = ctx.reg_ctx->GetSP();
@@ -1020,7 +1020,7 @@ RenderScriptRuntime::CaptureScriptInvoke
 eRsSc,
 };
 
-std::array args = {
+std::array args{{
 ArgItem{ArgItem::ePointer, 0}, // const Context   *rsc
 ArgItem{ArgItem::ePointer, 0}, // Script  *s
 ArgItem{ArgItem::eInt32, 0},   // uint32_t slot
@@ -1030,7 +1030,7 @@ RenderScriptRuntime::CaptureScriptInvoke
 ArgItem{ArgItem::ePointer, 0}, // const void  *usr
 ArgItem{ArgItem::eInt32, 0},   // size_t   usrLen
 ArgItem{ArgItem::ePointer, 0}, // const RsScriptCall  *sc
-};
+}};
 
 bool success = GetArgs(context, &args[0], args.size());
 if (!success)
@@ -1125,13 +1125,13 @@ RenderScriptRuntime::CaptureSetGlobalVar
 eRsLength,
 };
 
-std::array args = {
+std::array args{{
 ArgItem{ArgItem::ePointer, 0}, // eRsContext
 ArgItem{ArgItem::ePointer, 0}, // eRsScript
 ArgItem{ArgItem::eInt32, 0},   // eRsId
 ArgItem{ArgItem::ePointer, 0}, // eRsData
 ArgItem{ArgItem::eInt32, 0},   // eRsLength
-};
+}};
 
 bool success = GetArgs(context, &args[0], args.size());
 if (!success)
@@ -1173,11 +1173,11 @@ RenderScriptRuntime::CaptureAllocationIn
 eRsForceZero
 };
 
-std::array args = {
+std::array args{{
 ArgItem{ArgItem::ePointer, 0}, // eRsContext
 ArgItem{ArgItem::ePointer, 0}, // eRsAlloc
 ArgItem{ArgItem::eBool, 0},// eRsForceZero
-};
+}};
 
 bool success = GetArgs(context, &args[0], args.size());
 if (!success) // error case
@@ -1207,10 +1207,10 @@ RenderScriptRuntime::CaptureAllocationDe
 eRsAlloc,
 };
 
-std::array args = {
+std::array args{{
 ArgItem{ArgItem::ePointer, 0}, // eRsContext
 ArgItem{ArgItem::ePointer, 0}, // eRsAlloc
-};
+}};
 
 bool success = GetArgs(context, &args[0], args.size());
 if (!success)
@@ -1256,8 +1256,8 @@ RenderScriptRuntime::CaptureScriptInit(R
 eRsCachedDirPtr
 };
 
-std::array args = {ArgItem{ArgItem::ePointer, 0}, 
ArgItem{ArgItem::ePointer, 0},
-   ArgItem{ArgItem::ePointer, 0}, 
ArgItem{ArgItem::ePointer, 0}};
+std::array args{{ArgItem{ArgItem::ePointer, 0}, 
ArgItem{ArgItem::ePointer, 0},
+ ArgItem{ArgItem::ePointer, 0}, 
ArgItem{ArgItem::ePointer, 0}}};
 bool success = GetArgs(context, &args[0], args.size());
 if (!success)
 {

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=260914&r1=260913&r2=260914&view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Mon Feb 15 15:50:28 2016
@@ -914,7 +914,8 @@ PrepareCommandsForSourcing (const char *
 {
 fprintf(stderr, "error: write(%i, %p, %" PRIu64 ") failed (errno = 
%i) "
 "when trying to open LLDB commands pipe\n",
-fds[WRITE], commands_data, 
static_cast(commands_size), errno);
+fds[WRITE], static_cast(commands_data),
+ 

[Lldb-commits] [lldb] r260930 - Add -Wimplicit-fallthrough command line option to clang in

2016-02-15 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Feb 15 22:14:33 2016
New Revision: 260930

URL: http://llvm.org/viewvc/llvm-project?rev=260930&view=rev
Log:
Add -Wimplicit-fallthrough command line option to clang in
the xcode project file to catch switch statements that have a
case that falls through unintentionally.

Define LLVM_FALLTHROUGH to indicate instances where a case has code
and intends to fall through.  This should be in llvm/Support/Compiler.h;
Peter Collingbourne originally checked in there (r237766), then
reverted (r237941) because he didn't have time to mark up all the
'case' statements that were intended to fall through.  I put together
a patch to get this back in llvm http://reviews.llvm.org/D17063 but
it hasn't been approved in the past week.  I added a new
lldb-private-defines.h to hold the definition for now.

Every place in lldb where there is a comment that the fall-through
is intentional, I added LLVM_FALLTHROUGH to silence the warning.
I haven't tried to identify whether the fallthrough is a bug or
not in the other places.

I haven't tried to add this to the cmake option build flags.
This warning will only work for clang.

This build cleanly (with some new warnings) on macosx with clang
under xcodebuild, but if this causes problems for people on other
configurations, I'll back it out.


Added:
lldb/trunk/include/lldb/lldb-private-defines.h
Modified:
lldb/trunk/include/lldb/lldb-private.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Core/Address.cpp
lldb/trunk/source/Core/AddressRange.cpp
lldb/trunk/source/Core/ArchSpec.cpp
lldb/trunk/source/Core/Communication.cpp
lldb/trunk/source/Core/CxaDemangle.cpp
lldb/trunk/source/Core/FastDemangle.cpp
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Expression/REPL.cpp
lldb/trunk/source/Interpreter/OptionValueArray.cpp
lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp
lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/StackFrame.cpp

Added: lldb/trunk/include/lldb/lldb-private-defines.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-defines.h?rev=260930&view=auto
==
--- lldb/trunk/include/lldb/lldb-private-defines.h (added)
+++ lldb/trunk/include/lldb/lldb-private-defines.h Mon Feb 15 22:14:33 2016
@@ -0,0 +1,39 @@
+//===-- lldb-private-defines.h --*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_lldb_private_defines_h_
+#define liblldb_lldb_private_defines_h_
+
+#if defined(__cplusplus)
+
+// Include Compiler.h here so we don't define LLVM_FALLTHROUGH and then 
Compiler.h
+// later tries to redefine it.
+#include "llvm/Support/Compiler.h"
+
+#ifndef LLVM_FALLTHROUGH
+
+#ifndef __has_cpp_attribute
+# define __has_cpp_attribute(x) 0
+#endif
+
+/// \macro LLVM_FALLTHROUGH
+/// \brief Marks an empty statement preceding a deliberate switch fallthrough.
+#if __has_cpp_attribute(clang::fallthrough)
+#define LLVM_FALLTHROUGH [[clang::fallthrough]]
+#else
+#define LLVM_FALLTHROUGH
+#endif
+
+#endif // ifndef LLVM_FALLTHROUGH
+
+
+
+#endif  // #if defined(__cplusplus)
+
+#endif  // liblldb_lldb_private_defines_h_

Modified: lldb/trunk/include/lldb/lldb-private.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private.h?rev=260930&r1=260929&r2=260930&view=diff
==
--- lldb/trunk/include/lldb/lldb-private.h (original)
+++ lldb/trunk/include/lldb/lldb-private.h Mon Feb 15 22:14:33 2016
@@ -24,6 +24,7 @@
 #include "lldb/lldb-private-enumerations.h"
 #include "lldb/lldb-private-interfaces.h"
 #include "lldb/lldb-private-types.h"
+#include "lldb/lldb-private-defines.h"
 
 namespace lldb_private {
 

Modifie

[Lldb-commits] [lldb] r260932 - Fix buildbot failure because I got an include path wrong.

2016-02-15 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Feb 15 22:20:56 2016
New Revision: 260932

URL: http://llvm.org/viewvc/llvm-project?rev=260932&view=rev
Log:
Fix buildbot failure because I got an include path wrong.

Modified:
lldb/trunk/source/Commands/CommandObjectMemory.cpp

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=260932&r1=260931&r2=260932&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Mon Feb 15 22:20:56 2016
@@ -42,7 +42,7 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Thread.h"
 
-#include "lldb-private.h"
+#include "lldb/lldb-private.h"
 
 using namespace lldb;
 using namespace lldb_private;


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits