summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-06-28 23:54:17 +0000
committerTed Kremenek <kremenek@apple.com>2010-06-28 23:54:17 +0000
commit54140270202faef7b4576ac0c73f8b60e798b5a8 (patch)
tree2264fa15b2258d5f7650849419032f98f729246f
parent8d38ac453673a0cbad6d2a6b5332cbf2c2847d1a (diff)
downloadbcm5719-llvm-54140270202faef7b4576ac0c73f8b60e798b5a8.tar.gz
bcm5719-llvm-54140270202faef7b4576ac0c73f8b60e798b5a8.zip
Per Doug's suggestion, move check for invalid SourceLocation into
cxloc::translateSourceLocation() (thus causing all clients of this function to have the same behavior). llvm-svn: 107101
-rw-r--r--clang/tools/libclang/CIndex.cpp4
-rw-r--r--clang/tools/libclang/CXSourceLocation.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index e19cd4214f4..ce9357de330 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -1417,9 +1417,7 @@ CXSourceLocation clang_getLocation(CXTranslationUnit tu,
static_cast<const FileEntry *>(file),
line, column);
- return SLoc.isInvalid() ?
- clang_getNullLocation() :
- cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc);
+ return cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc);
}
CXSourceRange clang_getNullRange() {
diff --git a/clang/tools/libclang/CXSourceLocation.h b/clang/tools/libclang/CXSourceLocation.h
index 235f78c5a1b..7a502059634 100644
--- a/clang/tools/libclang/CXSourceLocation.h
+++ b/clang/tools/libclang/CXSourceLocation.h
@@ -29,6 +29,9 @@ namespace cxloc {
static inline CXSourceLocation
translateSourceLocation(const SourceManager &SM, const LangOptions &LangOpts,
SourceLocation Loc) {
+ if (Loc.isInvalid())
+ clang_getNullLocation();
+
CXSourceLocation Result = { { (void*) &SM, (void*) &LangOpts, },
Loc.getRawEncoding() };
return Result;
OpenPOWER on IntegriCloud