summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-05-04 00:14:37 +0000
committerDouglas Gregor <dgregor@apple.com>2011-05-04 00:14:37 +0000
commit37aa4938c8b59db704d4b9c9fed7d6e5e6583bbe (patch)
tree049bbfe1caf644c67612a71316c981c09a96d85b /clang/tools/libclang/CIndex.cpp
parent24f3490467371e2ec713becf49ac9fc586a6a718 (diff)
downloadbcm5719-llvm-37aa4938c8b59db704d4b9c9fed7d6e5e6583bbe.tar.gz
bcm5719-llvm-37aa4938c8b59db704d4b9c9fed7d6e5e6583bbe.zip
Introduce a new libclang API, clang_isFileMultipleIncludeGuarded(),
which determines whether a particular file is actually a header that is intended to be guarded from multiple inclusions within the same translation unit. llvm-svn: 130808
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
-rw-r--r--clang/tools/libclang/CIndex.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 28f1506988e..e6774dc895c 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -30,6 +30,7 @@
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Lex/Lexer.h"
+#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/PreprocessingRecord.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/STLExtras.h"
@@ -2890,6 +2891,16 @@ CXFile clang_getFile(CXTranslationUnit tu, const char *file_name) {
return const_cast<FileEntry *>(FMgr.getFile(file_name));
}
+unsigned clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file) {
+ if (!tu || !file)
+ return 0;
+
+ ASTUnit *CXXUnit = static_cast<ASTUnit *>(tu->TUData);
+ FileEntry *FEnt = static_cast<FileEntry *>(file);
+ return CXXUnit->getPreprocessor().getHeaderSearchInfo()
+ .isFileMultipleIncludeGuarded(FEnt);
+}
+
} // end: extern "C"
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud