summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CXSourceLocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/tools/libclang/CXSourceLocation.cpp')
-rw-r--r--clang/tools/libclang/CXSourceLocation.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/tools/libclang/CXSourceLocation.cpp b/clang/tools/libclang/CXSourceLocation.cpp
index 73711772fc0..c17449ae364 100644
--- a/clang/tools/libclang/CXSourceLocation.cpp
+++ b/clang/tools/libclang/CXSourceLocation.cpp
@@ -122,7 +122,11 @@ CXSourceLocation clang_getLocation(CXTranslationUnit TU,
CXFile file,
unsigned line,
unsigned column) {
- if (!TU || !file)
+ if (cxtu::isNotUseableTU(TU)) {
+ LOG_BAD_TU(TU);
+ return clang_getNullLocation();
+ }
+ if (!file)
return clang_getNullLocation();
if (line == 0 || column == 0)
return clang_getNullLocation();
@@ -151,9 +155,13 @@ CXSourceLocation clang_getLocation(CXTranslationUnit TU,
CXSourceLocation clang_getLocationForOffset(CXTranslationUnit TU,
CXFile file,
unsigned offset) {
- if (!TU || !file)
+ if (cxtu::isNotUseableTU(TU)) {
+ LOG_BAD_TU(TU);
return clang_getNullLocation();
-
+ }
+ if (!file)
+ return clang_getNullLocation();
+
ASTUnit *CXXUnit = cxtu::getASTUnit(TU);
SourceLocation SLoc
OpenPOWER on IntegriCloud