summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Kulp <darren@kulp.ch>2020-06-21 17:35:09 -0700
committerEmilio Cobos Álvarez <emilio@crisal.io>2022-02-18 19:33:25 +0100
commit69ee6fb243f56648a66c492f5b7395bc37d59f06 (patch)
treed6e693f96f295fada3acaf961489e005ae27df95
parentfdb762a9d44229a74f5d428b167b39f02bd10432 (diff)
parser: Simplify parse_macro for clang 4.0+
Here we delete a workaround that is no longer needed.
-rw-r--r--src/ir/var.rs14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/ir/var.rs b/src/ir/var.rs
index cd179370..396b3e04 100644
--- a/src/ir/var.rs
+++ b/src/ir/var.rs
@@ -391,25 +391,13 @@ fn parse_macro(
) -> Option<(Vec<u8>, cexpr::expr::EvalResult)> {
use cexpr::expr;
- let mut cexpr_tokens: Vec<_> = tokens
+ let cexpr_tokens: Vec<_> = tokens
.iter()
.filter_map(ClangToken::as_cexpr_token)
.collect();
let parser = expr::IdentifierParser::new(ctx.parsed_macros());
- if let Ok((_, (id, val))) = parser.macro_definition(&cexpr_tokens) {
- return Some((id.into(), val));
- }
-
- // Try without the last token, to workaround a libclang bug in versions
- // previous to 4.0.
- //
- // See:
- // https://bugs.llvm.org//show_bug.cgi?id=9069
- // https://reviews.llvm.org/D26446
- cexpr_tokens.pop()?;
-
match parser.macro_definition(&cexpr_tokens) {
Ok((_, (id, val))) => Some((id.into(), val)),
_ => None,