Skip to content

Commit 99b147d

Browse files
committed
parser: Simplify parse_macro for clang 4.0+
Here we delete a workaround that is no longer needed.
1 parent 5fa985f commit 99b147d

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/ir/var.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -391,25 +391,13 @@ fn parse_macro(
391391
) -> Option<(Vec<u8>, cexpr::expr::EvalResult)> {
392392
use cexpr::expr;
393393

394-
let mut cexpr_tokens: Vec<_> = tokens
394+
let cexpr_tokens: Vec<_> = tokens
395395
.iter()
396396
.filter_map(ClangToken::as_cexpr_token)
397397
.collect();
398398

399399
let parser = expr::IdentifierParser::new(ctx.parsed_macros());
400400

401-
if let Ok((_, (id, val))) = parser.macro_definition(&cexpr_tokens) {
402-
return Some((id.into(), val));
403-
}
404-
405-
// Try without the last token, to workaround a libclang bug in versions
406-
// previous to 4.0.
407-
//
408-
// See:
409-
// https://bugs.llvm.org//show_bug.cgi?id=9069
410-
// https://reviews.llvm.org/D26446
411-
cexpr_tokens.pop()?;
412-
413401
match parser.macro_definition(&cexpr_tokens) {
414402
Ok((_, (id, val))) => Some((id.into(), val)),
415403
_ => None,

0 commit comments

Comments
 (0)