aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2021-09-21 14:09:17 -0700
committerArthur Eubanks <aeubanks@google.com>2021-09-21 14:35:56 -0700
commite1ed02181ffcfea7de952d252a5e25953c822251 (patch)
tree07639d6a5007c8f8d34543513b6997cf41ea0eb7 /clang/lib/Frontend/CompilerInvocation.cpp
parent51a82e051e7cd25f0b60d5106400243bcf87233f (diff)
downloadllvm-e1ed02181ffcfea7de952d252a5e25953c822251.zip
llvm-e1ed02181ffcfea7de952d252a5e25953c822251.tar.gz
llvm-e1ed02181ffcfea7de952d252a5e25953c822251.tar.bz2
[clang] Make -Rpass imply -Rpass=.*
Previously with -Rpass (and friends) we'd have remarks "enabled", but without an actual regex. As seen in the test change to line numbers, this can give us better diagnostics by properly enabling NeedLocTracking with -Rpass. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D110201
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 38abcf9..10b2e96 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1174,8 +1174,9 @@ ParseOptimizationRemark(DiagnosticsEngine &Diags, ArgList &Args,
OptSpecifier OptEQ, StringRef Name) {
CodeGenOptions::OptRemark Result;
- auto InitializeResultPattern = [&Diags, &Args, &Result](const Arg *A) {
- Result.Pattern = A->getValue();
+ auto InitializeResultPattern = [&Diags, &Args, &Result](const Arg *A,
+ StringRef Pattern) {
+ Result.Pattern = Pattern.str();
std::string RegexError;
Result.Regex = std::make_shared<llvm::Regex>(Result.Pattern);
@@ -1200,19 +1201,21 @@ ParseOptimizationRemark(DiagnosticsEngine &Diags, ArgList &Args,
Result.Kind = CodeGenOptions::RK_Disabled;
else if (Value == "no-everything")
Result.Kind = CodeGenOptions::RK_DisabledEverything;
+
+ if (Result.Kind == CodeGenOptions::RK_Disabled ||
+ Result.Kind == CodeGenOptions::RK_DisabledEverything) {
+ Result.Pattern = "";
+ Result.Regex = nullptr;
+ } else {
+ InitializeResultPattern(A, ".*");
+ }
} else if (A->getOption().matches(OptEQ)) {
Result.Kind = CodeGenOptions::RK_WithPattern;
- if (!InitializeResultPattern(A))
+ if (!InitializeResultPattern(A, A->getValue()))
return CodeGenOptions::OptRemark();
}
}
- if (Result.Kind == CodeGenOptions::RK_Disabled ||
- Result.Kind == CodeGenOptions::RK_DisabledEverything) {
- Result.Pattern = "";
- Result.Regex = nullptr;
- }
-
return Result;
}