summaryrefslogtreecommitdiffstats
path: root/mlir/lib
diff options
context:
space:
mode:
authorJacques Pienaar <jpienaar@google.com>2019-08-12 08:59:36 -0700
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-08-12 09:00:09 -0700
commit77ed5247bffc3b63f8d0fbba154bcd8e2ed5a66d (patch)
tree7b6fd867f9a14d1fb1eef21c827680e026451c1b /mlir/lib
parentfe2ea3003b1d0760a3ecef7a15cbfb9849ae5eea (diff)
downloadbcm5719-llvm-77ed5247bffc3b63f8d0fbba154bcd8e2ed5a66d.tar.gz
bcm5719-llvm-77ed5247bffc3b63f8d0fbba154bcd8e2ed5a66d.zip
Avoid passing in line/col for files not registered with SourceMgr.
This can result in index expression overflow in "Loc.getPointer() - ColumnNo" in SourgeMgr. loc could also be prefixed to the message additionally in this case. PiperOrigin-RevId: 262935408
Diffstat (limited to 'mlir/lib')
-rw-r--r--mlir/lib/IR/Diagnostics.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/mlir/lib/IR/Diagnostics.cpp b/mlir/lib/IR/Diagnostics.cpp
index 076a9b21ae5..28894066023 100644
--- a/mlir/lib/IR/Diagnostics.cpp
+++ b/mlir/lib/IR/Diagnostics.cpp
@@ -415,12 +415,10 @@ void SourceMgrDiagnosticHandler::emitDiagnostic(Location loc, Twine message,
if (smloc.isValid())
return mgr.PrintMessage(os, smloc, getDiagKind(kind), message);
- // If the conversion was unsuccessful, create a diagnostic with the source
- // location information directly.
- llvm::SMDiagnostic diag(mgr, llvm::SMLoc(), fileLoc->getFilename(),
- fileLoc->getLine(), fileLoc->getColumn(),
- getDiagKind(kind), message.str(), /*LineStr=*/"",
- /*Ranges=*/llvm::None);
+ // If the conversion was unsuccessful, create a diagnostic with the file
+ // information.
+ llvm::SMDiagnostic diag(fileLoc->getFilename(), getDiagKind(kind),
+ message.str());
diag.print(nullptr, os);
}
OpenPOWER on IntegriCloud