diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-12 07:07:40 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-12 07:07:40 +0000 |
commit | 7f6b029c4e038ff7719d5ea1354ee4c5cae9d9da (patch) | |
tree | ae9b60641a6fc0cc884a79d8efaa939c3869497e /clang/lib/Basic/SourceManager.cpp | |
parent | e4549866175a8c2bef551fc7f1d4d7a643df26eb (diff) | |
download | bcm5719-llvm-7f6b029c4e038ff7719d5ea1354ee4c5cae9d9da.tar.gz bcm5719-llvm-7f6b029c4e038ff7719d5ea1354ee4c5cae9d9da.zip |
Introduce SourceManager::getFileLoc which returns a file location
taking into account macro arguments.
llvm-svn: 141771
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index a540f3b9450..364663ee326 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -815,6 +815,16 @@ SourceLocation SourceManager::getSpellingLocSlowCase(SourceLocation Loc) const { return Loc; } +SourceLocation SourceManager::getFileLocSlowCase(SourceLocation Loc) const { + do { + if (isMacroArgExpansion(Loc)) + Loc = getImmediateSpellingLoc(Loc); + else + Loc = getImmediateExpansionRange(Loc).first; + } while (!Loc.isFileID()); + return Loc; +} + std::pair<FileID, unsigned> SourceManager::getDecomposedExpansionLocSlowCase( |