diff --git a/python_src/static_globals/instrumenter.py b/python_src/static_globals/instrumenter.py index 9833c07..fce0ba6 100644 --- a/python_src/static_globals/instrumenter.py +++ b/python_src/static_globals/instrumenter.py @@ -19,12 +19,13 @@ def get_instrumenter( except: # noqa: E722 pass if not clang: - try: - clang = CompilerExe.from_path(Path("clang-15")) - except: # noqa: E722 - pass - if not clang: - clang = CompilerExe.from_path(Path("clang-14")) + for clang_path in ("clang-17", "clang-16", "clang-15", "clang-14"): + try: + clang = CompilerExe.from_path(Path(clang_path)) + break + except: # noqa: E722 + pass + assert clang, "Could not find clang" instrumenter = ClangTool.init_with_paths_from_clang( Path(__file__).parent / "make-globals-static", clang diff --git a/src/GlobalStaticMaker.cpp b/src/GlobalStaticMaker.cpp index 166bfaa..a555325 100644 --- a/src/GlobalStaticMaker.cpp +++ b/src/GlobalStaticMaker.cpp @@ -68,14 +68,14 @@ void detail::RuleActionCallback::run( llvm::errs() << "An error has occured.\n"; return; } -#if CLANG_VERSION_MAJOR == 15 +#if CLANG_VERSION_MAJOR == 15 || CLANG_VERSION_MAJOR == 16 || CLANG_VERSION_MAJOR == 17 Expected> Edits = Rule.Cases[findSelectedCase(Result, Rule)].Edits(Result); #elif CLANG_VERSION_MAJOR == 14 Expected> Edits = findSelectedCase(Result, Rule).Edits(Result); #else -#error "Only versions 14 and 15 are supported" +#error "Only versions 14, 15, 16 and 17 are supported" #endif if (!Edits) { llvm::errs() << "Rewrite failed: " << llvm::toString(Edits.takeError())