summaryrefslogtreecommitdiffstats
path: root/clang/include
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-04-28 18:26:32 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-04-28 18:26:32 +0000
commit41e6629100664281aaf77dc20579a6d3e983149b (patch)
tree8c50affb47c0549fba98376da556880c7236878a /clang/include
parent551ccac7e4d59bf0f6236b3d993d401b410e3fd9 (diff)
downloadbcm5719-llvm-41e6629100664281aaf77dc20579a6d3e983149b.tar.gz
bcm5719-llvm-41e6629100664281aaf77dc20579a6d3e983149b.zip
Fix use of uninitialized value exposed by r267802. Accessors of an invalid
PresumedLoc should not be called. llvm-svn: 267914
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/Basic/SourceLocation.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/include/clang/Basic/SourceLocation.h b/clang/include/clang/Basic/SourceLocation.h
index 0aeba5e3f37..006cf3dc950 100644
--- a/clang/include/clang/Basic/SourceLocation.h
+++ b/clang/include/clang/Basic/SourceLocation.h
@@ -373,22 +373,22 @@ public:
/// \brief Return the presumed filename of this location.
///
/// This can be affected by \#line etc.
- const char *getFilename() const { return Filename; }
+ const char *getFilename() const { assert(isValid()); return Filename; }
/// \brief Return the presumed line number of this location.
///
/// This can be affected by \#line etc.
- unsigned getLine() const { return Line; }
+ unsigned getLine() const { assert(isValid()); return Line; }
/// \brief Return the presumed column number of this location.
///
/// This cannot be affected by \#line, but is packaged here for convenience.
- unsigned getColumn() const { return Col; }
+ unsigned getColumn() const { assert(isValid()); return Col; }
/// \brief Return the presumed include location of this location.
///
/// This can be affected by GNU linemarker directives.
- SourceLocation getIncludeLoc() const { return IncludeLoc; }
+ SourceLocation getIncludeLoc() const { assert(isValid()); return IncludeLoc; }
};
OpenPOWER on IntegriCloud