aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2021-02-09 11:06:03 +0100
committerJan Svoboda <jan_svoboda@apple.com>2021-02-09 11:12:13 +0100
commitec12f5febed04dd32e7d4b766b2853d50fca9657 (patch)
tree4293a36cf5f5e103fe15876c8ce4d438c2b1acc3 /clang/lib/Frontend/CompilerInvocation.cpp
parentd7d0b17de77ee14efeb920e543f7ed0b783182d2 (diff)
downloadllvm-ec12f5febed04dd32e7d4b766b2853d50fca9657.zip
llvm-ec12f5febed04dd32e7d4b766b2853d50fca9657.tar.gz
llvm-ec12f5febed04dd32e7d4b766b2853d50fca9657.tar.bz2
[clang][codegen] Remember string used to create llvm::Regex for optimization remarks
Regular expression patterns passed through the command line are being used to create an instances of `llvm::Regex` and thrown away. There is no API to serialize `Regex` back to the original pattern. This means we have no way to reconstruct the original pattern from command line. This is necessary for serializing `CompilerInvocation`. This patch stores the original pattern string in `CodeGenOptions` alongside the `llvm::Regex` instance. Reviewed By: dexonsmith, thegameg Differential Revision: https://reviews.llvm.org/D96036
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 09444b2..658dad5 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1164,8 +1164,8 @@ static void parseAnalyzerConfigs(AnalyzerOptions &AnOpts,
}
/// Create a new Regex instance out of the string value in \p RpassArg.
-/// It returns a pointer to the newly generated Regex instance.
-static std::shared_ptr<llvm::Regex>
+/// It returns the string and a pointer to the newly generated Regex instance.
+static CodeGenOptions::RemarkPattern
GenerateOptimizationRemarkRegex(DiagnosticsEngine &Diags, ArgList &Args,
Arg *RpassArg) {
StringRef Val = RpassArg->getValue();
@@ -1176,7 +1176,7 @@ GenerateOptimizationRemarkRegex(DiagnosticsEngine &Diags, ArgList &Args,
<< RegexError << RpassArg->getAsString(Args);
Pattern.reset();
}
- return Pattern;
+ return {std::string(Val), Pattern};
}
static bool parseDiagnosticLevelMask(StringRef FlagName,