aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/compilers/mixins/clang.py11
-rw-r--r--mesonbuild/interpreterbase.py2
-rw-r--r--mesonbuild/mlog.py2
3 files changed, 11 insertions, 4 deletions
diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py
index 1c52af2..6bc7d6c 100644
--- a/mesonbuild/compilers/mixins/clang.py
+++ b/mesonbuild/compilers/mixins/clang.py
@@ -19,7 +19,6 @@ import typing as T
from ... import mesonlib
from ...linkers import AppleDynamicLinker
-from ..compilers import clike_optimization_args
from .gnu import GnuLikeCompiler
if T.TYPE_CHECKING:
@@ -32,6 +31,14 @@ clang_color_args = {
'never': ['-Xclang', '-fno-color-diagnostics'],
} # type: T.Dict[str, T.List[str]]
+clang_optimization_args = {
+ '0': [],
+ 'g': ['-Og'],
+ '1': ['-O1'],
+ '2': ['-O2'],
+ '3': ['-O3'],
+ 's': ['-Os'],
+} # type: T.Dict[str, T.List[str]]
class ClangCompiler(GnuLikeCompiler):
def __init__(self):
@@ -49,7 +56,7 @@ class ClangCompiler(GnuLikeCompiler):
return clang_color_args[colortype][:]
def get_optimization_args(self, optimization_level: str) -> T.List[str]:
- return clike_optimization_args[optimization_level]
+ return clang_optimization_args[optimization_level]
def get_pch_suffix(self) -> str:
return 'pch'
diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py
index b8008b0..a3acc75 100644
--- a/mesonbuild/interpreterbase.py
+++ b/mesonbuild/interpreterbase.py
@@ -446,7 +446,7 @@ class InterpreterBase:
self.current_lineno = cur.lineno
self.evaluate_statement(cur)
except Exception as e:
- if getattr(e, 'lineno') is None:
+ if getattr(e, 'lineno', None) is None:
# We are doing the equivalent to setattr here and mypy does not like it
e.lineno = cur.lineno # type: ignore
e.colno = cur.colno # type: ignore
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index 88a47e7..7d9dc16 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -298,7 +298,7 @@ def exception(e: Exception, prefix: T.Optional[AnsiDecorator] = None) -> None:
prefix = red('ERROR:')
log()
args = [] # type: T.List[T.Union[AnsiDecorator, str]]
- if getattr(e, 'file') is not None and getattr(e, 'lineno') is not None and getattr(e, 'colno') is not None:
+ if all(getattr(e, a, None) is not None for a in ['file', 'lineno', 'colno']):
# Mypy doesn't follow hasattr, and it's pretty easy to visually inspect
# that this is correct, so we'll just ignore it.
path = get_relative_path(Path(e.file), Path(os.getcwd())) # type: ignore