r187977 - Factor out parsing sanitizer arguments to a separate function

Alexey Samsonov samsonov at google.com
Thu Aug 8 04:32:17 PDT 2013


Author: samsonov
Date: Thu Aug  8 06:32:17 2013
New Revision: 187977

URL: http://llvm.org/viewvc/llvm-project?rev=187977&view=rev
Log:
Factor out parsing sanitizer arguments to a separate function

Modified:
    cfe/trunk/lib/Driver/SanitizerArgs.cpp
    cfe/trunk/lib/Driver/SanitizerArgs.h

Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.cpp?rev=187977&r1=187976&r2=187977&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
+++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Thu Aug  8 06:32:17 2013
@@ -19,14 +19,26 @@
 using namespace clang::driver;
 using namespace llvm::opt;
 
-SanitizerArgs::SanitizerArgs()
-    : Kind(0), BlacklistFile(""), MsanTrackOrigins(false),
-      AsanZeroBaseShadow(false), UbsanTrapOnError(false) {}
+void SanitizerArgs::clear() {
+  Kind = 0;
+  BlacklistFile = "";
+  MsanTrackOrigins = false;
+  AsanZeroBaseShadow = false;
+  UbsanTrapOnError = false;
+}
+
+SanitizerArgs::SanitizerArgs() {
+  clear();
+}
 
 SanitizerArgs::SanitizerArgs(const ToolChain &TC,
-                             const llvm::opt::ArgList &Args)
-    : Kind(0), BlacklistFile(""), MsanTrackOrigins(false),
-      AsanZeroBaseShadow(false) {
+                             const llvm::opt::ArgList &Args) {
+  clear();
+  parse(TC, Args);
+}
+
+void SanitizerArgs::parse(const ToolChain &TC,
+                          const llvm::opt::ArgList &Args) {
   unsigned AllKinds = 0;  // All kinds of sanitizers that were turned on
                           // at least once (possibly, disabled further).
   const Driver &D = TC.getDriver();

Modified: cfe/trunk/lib/Driver/SanitizerArgs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.h?rev=187977&r1=187976&r2=187977&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/SanitizerArgs.h (original)
+++ cfe/trunk/lib/Driver/SanitizerArgs.h Thu Aug  8 06:32:17 2013
@@ -54,6 +54,8 @@ class SanitizerArgs {
   /// Parses the sanitizer arguments from an argument list.
   SanitizerArgs(const ToolChain &TC, const llvm::opt::ArgList &Args);
 
+  void parse(const ToolChain &TC, const llvm::opt::ArgList &Args);
+
   bool needsAsanRt() const { return Kind & NeedsAsanRt; }
   bool needsTsanRt() const { return Kind & NeedsTsanRt; }
   bool needsMsanRt() const { return Kind & NeedsMsanRt; }
@@ -76,6 +78,8 @@ class SanitizerArgs {
                llvm::opt::ArgStringList &CmdArgs) const;
 
  private:
+  void clear();
+
   /// Parse a single value from a -fsanitize= or -fno-sanitize= value list.
   /// Returns OR of members of the \c SanitizeKind enumeration, or \c 0
   /// if \p Value is not known.





More information about the cfe-commits mailing list