[PATCH] D15996: Avoid undefined behavior in LinkAllPasses.h
Dimitry Andric via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 12 14:57:08 PST 2016
dim updated this revision to Diff 44682.
dim added a comment.
Updates:
- Now simply instantiating RGPassManager
- Also eliminate the last nullptr dereference.
http://reviews.llvm.org/D15996
Files:
include/llvm/LinkAllPasses.h
Index: include/llvm/LinkAllPasses.h
===================================================================
--- include/llvm/LinkAllPasses.h
+++ include/llvm/LinkAllPasses.h
@@ -160,9 +160,11 @@
(void) llvm::createPostOrderFunctionAttrsPass();
(void) llvm::createReversePostOrderFunctionAttrsPass();
(void) llvm::createMergeFunctionsPass();
- (void) llvm::createPrintModulePass(*(llvm::raw_ostream*)nullptr);
- (void) llvm::createPrintFunctionPass(*(llvm::raw_ostream*)nullptr);
- (void) llvm::createPrintBasicBlockPass(*(llvm::raw_ostream*)nullptr);
+ std::string buf;
+ llvm::raw_string_ostream os(buf);
+ (void) llvm::createPrintModulePass(os);
+ (void) llvm::createPrintFunctionPass(os);
+ (void) llvm::createPrintBasicBlockPass(os);
(void) llvm::createModuleDebugInfoPrinterPass();
(void) llvm::createPartialInliningPass();
(void) llvm::createLintPass();
@@ -186,10 +188,10 @@
(void)new llvm::IntervalPartition();
(void)new llvm::ScalarEvolutionWrapperPass();
- ((llvm::Function*)nullptr)->viewCFGOnly();
+ llvm::Function::Create(nullptr, llvm::GlobalValue::ExternalLinkage)->viewCFGOnly();
llvm::RGPassManager RGM;
- ((llvm::RegionPass*)nullptr)->runOnRegion((llvm::Region*)nullptr, RGM);
- llvm::AliasSetTracker X(*(llvm::AliasAnalysis*)nullptr);
+ llvm::AliasAnalysis AA;
+ llvm::AliasSetTracker X(AA);
X.add(nullptr, 0, llvm::AAMDNodes()); // for -print-alias-sets
(void) llvm::AreStatisticsEnabled();
(void) llvm::sys::RunningOnValgrind();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15996.44682.patch
Type: text/x-patch
Size: 1602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160112/da76b8b9/attachment.bin>
More information about the llvm-commits
mailing list