Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to r…
…emove redundant parameter which can be calculated from other parameter. rdar://problem/43822994 Differential Revision: https://reviews.llvm.org/D54003 llvm-svn: 346428
- Loading branch information
Showing
8 changed files
with
117 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
lldb/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
LEVEL = ../../make | ||
|
||
CXX_SOURCES := main.cpp | ||
CXXFLAGS += -std=c++11 | ||
|
||
include $(LEVEL)/Makefile.rules |
44 changes: 44 additions & 0 deletions
44
lldb/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from __future__ import print_function | ||
|
||
|
||
import lldb | ||
from lldbsuite.test.decorators import * | ||
from lldbsuite.test.lldbtest import * | ||
from lldbsuite.test import lldbutil | ||
|
||
|
||
class ExprXValuePrintingTestCase(TestBase): | ||
|
||
mydir = TestBase.compute_mydir(__file__) | ||
|
||
def test(self): | ||
self.build() | ||
|
||
self.main_source = "main.cpp" | ||
self.main_source_spec = lldb.SBFileSpec(self.main_source) | ||
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, | ||
'// Set break point at this line.', self.main_source_spec) | ||
frame = thread.GetFrameAtIndex(0) | ||
|
||
self.expect("expr f == Foo::FooBar", | ||
substrs=['(bool) $0 = true']) | ||
|
||
value = frame.EvaluateExpression("f == Foo::FooBar") | ||
self.assertTrue(value.IsValid()) | ||
self.assertTrue(value.GetError().Success()) | ||
self.assertEqual(value.GetValueAsUnsigned(), 1) | ||
|
||
value = frame.EvaluateExpression("b == BarBar") | ||
self.assertTrue(value.IsValid()) | ||
self.assertTrue(value.GetError().Success()) | ||
self.assertEqual(value.GetValueAsUnsigned(), 1) | ||
|
||
## b is not a Foo | ||
value = frame.EvaluateExpression("b == Foo::FooBar") | ||
self.assertTrue(value.IsValid()) | ||
self.assertFalse(value.GetError().Success()) | ||
|
||
## integral is not implicitly convertible to a scoped enum | ||
value = frame.EvaluateExpression("1 == Foo::FooBar") | ||
self.assertTrue(value.IsValid()) | ||
self.assertFalse(value.GetError().Success()) |
16 changes: 16 additions & 0 deletions
16
lldb/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
enum class Foo { | ||
FooBar = 42 | ||
}; | ||
|
||
enum Bar { | ||
BarBar = 3, | ||
BarBarBar = 42 | ||
}; | ||
|
||
int main(int argc, const char **argv) { | ||
Foo f = Foo::FooBar; | ||
Bar b = BarBar; | ||
bool b1 = f == Foo::FooBar; | ||
bool b2 = b == BarBar; | ||
return 0; // Set break point at this line. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters