File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -433,9 +433,17 @@ static ValueDecl *importMacro(ClangImporter::Implementation &impl,
433
433
434
434
clang::APValue value;
435
435
if (tokenI[1 ].is (clang::tok::pipe)) {
436
- value = clang::APValue (firstInteger | secondInteger);
436
+ if (firstInteger.getBitWidth () == secondInteger.getBitWidth ()) {
437
+ value = clang::APValue (firstInteger | secondInteger);
438
+ } else {
439
+ return nullptr ;
440
+ }
437
441
} else if (tokenI[1 ].is (clang::tok::amp)) {
438
- value = clang::APValue (firstInteger & secondInteger);
442
+ if (firstInteger.getBitWidth () == secondInteger.getBitWidth ()) {
443
+ value = clang::APValue (firstInteger & secondInteger);
444
+ } else {
445
+ return nullptr ;
446
+ }
439
447
} else if (tokenI[1 ].is (clang::tok::pipepipe)) {
440
448
auto firstBool = firstInteger.getBoolValue ();
441
449
auto secondBool = firstInteger.getBoolValue ();
Original file line number Diff line number Diff line change @@ -191,7 +191,8 @@ typedef int typedef_int_t;
191
191
#define FOO_MACRO_6 ((typedef_int_t ) 42 )
192
192
#define FOO_MACRO_7 ((typedef_int_t ) -1 )
193
193
#define FOO_MACRO_OR (FOO_MACRO_2 | FOO_MACRO_6)
194
- #define FOO_MACRO_AND (FOO_MACRO_2 | FOO_MACRO_6)
194
+ #define FOO_MACRO_AND (FOO_MACRO_2 & FOO_MACRO_6)
195
+ #define FOO_MACRO_BITWIDTH (FOO_MACRO_4 & FOO_MACRO_5)
195
196
196
197
#define FOO_MACRO_UNDEF_1 0
197
198
#undef FOO_MACRO_UNDEF_1
You can’t perform that action at this time.
0 commit comments