From aed71a89bc0afae47f1f2c7b228fe2d79d2b81fe Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Thu, 9 Oct 2014 17:53:04 +0000 Subject: Add experimental clang/driver flag -fsanitize-address-field-padding=N Summary: This change adds an experimental flag -fsanitize-address-field-padding=N (0, 1, 2) to clang and driver. With this flag ASAN will be able to detect some cases of intra-object-overflow bugs, see https://code.google.com/p/address-sanitizer/wiki/IntraObjectOverflow There is no actual functionality here yet, just the flag parsing. The functionality is being reviewed at http://reviews.llvm.org/D5687 Test Plan: Build and run SPEC, LLVM Bootstrap, Chrome with this flag. Reviewers: samsonov Reviewed By: samsonov Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5676 llvm-svn: 219417 --- clang/lib/Frontend/CompilerInvocation.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 043141a..25d444e 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1628,6 +1628,9 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, break; } } + // -fsanitize-address-field-padding=N has to be a LangOpt, parse it here. + Opts.Sanitize.SanitizeAddressFieldPadding = + getLastArgIntValue(Args, OPT_fsanitize_address_field_padding, 0, Diags); } static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, -- cgit v1.1