[clang] [llvm] [flang] [Flang][WIP/RFC] Enable TSan for Flang (PR #74643)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 6 11:04:35 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 1e1e11a4d7c57028953a23deae622acab5eee9ff 03c22524ecf8851951d37f6282b3cd43edb8607e -- clang/lib/Driver/ToolChains/Flang.cpp flang/include/flang/Common/Fortran-features.h flang/lib/Frontend/CompilerInvocation.cpp flang/lib/Frontend/FrontendActions.cpp llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 6b3c0706c9..ffcd3aefd6 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -862,7 +862,9 @@ static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
res.getFrontendOpts().features.Enable(
Fortran::common::LanguageFeature::OpenACC);
}
- if (args.hasArg(clang::driver::options::OPT_fsanitize_EQ) && llvm::StringRef(args.getLastArg(clang::driver::options::OPT_fsanitize_EQ)->getValue()) == "thread" ) {
+ if (args.hasArg(clang::driver::options::OPT_fsanitize_EQ) &&
+ llvm::StringRef(args.getLastArg(clang::driver::options::OPT_fsanitize_EQ)
+ ->getValue()) == "thread") {
res.getFrontendOpts().features.Enable(
Fortran::common::LanguageFeature::TSan);
}
diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index 423e121cdf..7abd283114 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -66,9 +66,9 @@
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/TargetParser/TargetParser.h"
-#include "llvm/Transforms/Utils/ModuleUtils.h"
#include "llvm/Transforms/Instrumentation.h"
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
+#include "llvm/Transforms/Utils/ModuleUtils.h"
#include <memory>
#include <system_error>
@@ -1079,7 +1079,8 @@ void CodeGenAction::runOptimizationPipeline(llvm::raw_pwrite_stream &os) {
if (this->getInstance().getInvocation().getFrontendOpts().features.IsEnabled(
Fortran::common::LanguageFeature::TSan)) {
mpm.addPass(llvm::ModuleThreadSanitizerPass());
- mpm.addPass(llvm::createModuleToFunctionPassAdaptor(llvm::ThreadSanitizerPass()));
+ mpm.addPass(
+ llvm::createModuleToFunctionPassAdaptor(llvm::ThreadSanitizerPass()));
}
if (action == BackendActionTy::Backend_EmitBC)
mpm.addPass(llvm::BitcodeWriterPass(os));
``````````
</details>
https://github.com/llvm/llvm-project/pull/74643
More information about the cfe-commits
mailing list