]> granicus.if.org Git - clang/commitdiff
Restrict the hack from r263429 to asan and msan.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 15 Mar 2016 09:41:39 +0000 (09:41 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 15 Mar 2016 09:41:39 +0000 (09:41 +0000)
The other sanitizers don't have backend passes that rely on value names.
Avoid paying the compile time cost of names there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263541 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/CompilerInvocation.cpp

index c21279450d199068cb6153f0deabec0b7758c408..d2643614670c237aeaeca34c6a8c70cc1d4ce22b 100644 (file)
@@ -2154,10 +2154,12 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
       Res.getLangOpts()->ObjCExceptions = 1;
   }
 
-  // FIXME: Override value name discarding when sanitizers are used because the
+  // FIXME: Override value name discarding when asan or msan is used because the
   // backend passes depend on the name of the alloca in order to print out
   // names.
-  Res.getCodeGenOpts().DiscardValueNames &= Res.getLangOpts()->Sanitize.empty();
+  Res.getCodeGenOpts().DiscardValueNames &=
+      !Res.getLangOpts()->Sanitize.has(SanitizerKind::Address) &&
+      !Res.getLangOpts()->Sanitize.has(SanitizerKind::Memory);
 
   // FIXME: ParsePreprocessorArgs uses the FileManager to read the contents of
   // PCH file and find the original header name. Remove the need to do that in