diff options
author | Stephen Kelly <steveire@gmail.com> | 2019-01-07 21:57:30 +0000 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2019-01-07 21:57:30 +0000 |
commit | 54272e5b662ba4590a3df63fcbcc4de4ca31bcd9 (patch) | |
tree | 6bd90da0bbcd3b779502d2271172ff1f2916a76a /clang/lib/AST/NestedNameSpecifier.cpp | |
parent | b460f1624cd57698a8cd94912a50890f01e2ed4d (diff) | |
download | bcm5719-llvm-54272e5b662ba4590a3df63fcbcc4de4ca31bcd9.tar.gz bcm5719-llvm-54272e5b662ba4590a3df63fcbcc4de4ca31bcd9.zip |
NFC: Replace asserts with if() in SourceLocation accessors
Summary:
Nowhere else in the AST classes assert on these kinds of accessors.
This way, we can call the accessors and check the validity of the result
instead of externally duplicating the conditions. This generality will
make it possible to introspect instances for source locations:
http://ec2-18-191-7-3.us-east-2.compute.amazonaws.com:10240/z/iiaWhw
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D56354
llvm-svn: 350573
Diffstat (limited to 'clang/lib/AST/NestedNameSpecifier.cpp')
-rw-r--r-- | clang/lib/AST/NestedNameSpecifier.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/AST/NestedNameSpecifier.cpp b/clang/lib/AST/NestedNameSpecifier.cpp index 548f2f8e3b0..42f6a133d71 100644 --- a/clang/lib/AST/NestedNameSpecifier.cpp +++ b/clang/lib/AST/NestedNameSpecifier.cpp @@ -462,9 +462,9 @@ SourceRange NestedNameSpecifierLoc::getLocalSourceRange() const { } TypeLoc NestedNameSpecifierLoc::getTypeLoc() const { - assert((Qualifier->getKind() == NestedNameSpecifier::TypeSpec || - Qualifier->getKind() == NestedNameSpecifier::TypeSpecWithTemplate) && - "Nested-name-specifier location is not a type"); + if (Qualifier->getKind() != NestedNameSpecifier::TypeSpec && + Qualifier->getKind() != NestedNameSpecifier::TypeSpecWithTemplate) + return TypeLoc(); // The "void*" that points at the TypeLoc data. unsigned Offset = getDataLength(Qualifier->getPrefix()); |