[Lldb-commits] [lldb] r341535 - Reland [ClangUserExpression][NFC] Removed unused code

2018-09-06 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Sep  6 03:24:11 2018
New Revision: 341535

URL: http://llvm.org/viewvc/llvm-project?rev=341535&view=rev
Log:
Reland [ClangUserExpression][NFC] Removed unused code

The GetLanguageForExpr has side effects, so we can't remove this
call without breaking the completion mechanism. However, we can
keep the change that gets rid of this unnecessary variable.

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp?rev=341535&r1=341534&r2=341535&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp 
Thu Sep  6 03:24:11 2018
@@ -655,9 +655,7 @@ bool ClangUserExpression::Complete(Execu
   if (!PrepareForParsing(diagnostic_manager, exe_ctx))
 return false;
 
-  lldb::LanguageType lang_type = lldb::LanguageType::eLanguageTypeUnknown;
-  if (auto new_lang = GetLanguageForExpr(diagnostic_manager, exe_ctx))
-lang_type = new_lang.getValue();
+  GetLanguageForExpr(diagnostic_manager, exe_ctx);
 
   if (log)
 log->Printf("Parsing the following code:\n%s", m_transformed_text.c_str());


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


Re: [Lldb-commits] [lldb] r341535 - Reland [ClangUserExpression][NFC] Removed unused code

2018-09-06 Thread Greg Clayton via lldb-commits
Might be a good idea to add a comment in the code for this explaining the 
desired side effects?


> On Sep 6, 2018, at 3:24 AM, Raphael Isemann via lldb-commits 
>  wrote:
> 
> Author: teemperor
> Date: Thu Sep  6 03:24:11 2018
> New Revision: 341535
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=341535&view=rev
> Log:
> Reland [ClangUserExpression][NFC] Removed unused code
> 
> The GetLanguageForExpr has side effects, so we can't remove this
> call without breaking the completion mechanism. However, we can
> keep the change that gets rid of this unnecessary variable.
> 
> Modified:
>lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
> 
> Modified: 
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp?rev=341535&r1=341534&r2=341535&view=diff
> ==
> --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp 
> (original)
> +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp 
> Thu Sep  6 03:24:11 2018
> @@ -655,9 +655,7 @@ bool ClangUserExpression::Complete(Execu
>   if (!PrepareForParsing(diagnostic_manager, exe_ctx))
> return false;
> 
> -  lldb::LanguageType lang_type = lldb::LanguageType::eLanguageTypeUnknown;
> -  if (auto new_lang = GetLanguageForExpr(diagnostic_manager, exe_ctx))
> -lang_type = new_lang.getValue();
> +  GetLanguageForExpr(diagnostic_manager, exe_ctx);
> 
>   if (log)
> log->Printf("Parsing the following code:\n%s", 
> m_transformed_text.c_str());
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


Re: [Lldb-commits] [lldb] r341535 - Reland [ClangUserExpression][NFC] Removed unused code

2018-09-06 Thread Raphael Isemann via lldb-commits
Yeah, and we might as well refactor this function. I fell for the same
trap as Dávid when I touched this code for the first time. It's just
unexpected that a getter is doing important work... I'll prepare a
patch.

- Raphael
Am Do., 6. Sep. 2018 um 16:05 Uhr schrieb Greg Clayton :
>
> Might be a good idea to add a comment in the code for this explaining the 
> desired side effects?
>
>
> > On Sep 6, 2018, at 3:24 AM, Raphael Isemann via lldb-commits 
> >  wrote:
> >
> > Author: teemperor
> > Date: Thu Sep  6 03:24:11 2018
> > New Revision: 341535
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=341535&view=rev
> > Log:
> > Reland [ClangUserExpression][NFC] Removed unused code
> >
> > The GetLanguageForExpr has side effects, so we can't remove this
> > call without breaking the completion mechanism. However, we can
> > keep the change that gets rid of this unnecessary variable.
> >
> > Modified:
> >lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
> >
> > Modified: 
> > lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
> > URL: 
> > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp?rev=341535&r1=341534&r2=341535&view=diff
> > ==
> > --- 
> > lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp 
> > (original)
> > +++ 
> > lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp 
> > Thu Sep  6 03:24:11 2018
> > @@ -655,9 +655,7 @@ bool ClangUserExpression::Complete(Execu
> >   if (!PrepareForParsing(diagnostic_manager, exe_ctx))
> > return false;
> >
> > -  lldb::LanguageType lang_type = lldb::LanguageType::eLanguageTypeUnknown;
> > -  if (auto new_lang = GetLanguageForExpr(diagnostic_manager, exe_ctx))
> > -lang_type = new_lang.getValue();
> > +  GetLanguageForExpr(diagnostic_manager, exe_ctx);
> >
> >   if (log)
> > log->Printf("Parsing the following code:\n%s", 
> > m_transformed_text.c_str());
> >
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits