[cfe-dev] Check include guards in a file

Pedro Delgado Perez pedro.delgadoperez at mail.uca.es
Sat Feb 21 08:17:38 PST 2015


 
Hi,

I would like to know if there is one and only one include guards in the file parsed, that is, if the file has the #ifndef directive (or the "\#if !defined" equivalent). I have been searching for the way to achieve this, but I'm really confused because there are several classes refering to include guards.

- void clang::MultipleIncludeOpt::EnterTopLevelIfndef (http://clang.llvm.org/doxygen/classclang_1_1MultipleIncludeOpt.html#aef87b0d5364cd004dbf6335655de0f3d [ http://clang.llvm.org/doxygen/classclang_1_1MultipleIncludeOpt.html#aef87b0d5364cd004dbf6335655de0f3d ])
- void Preprocessor::HandleDirective( Token & Result)    (http://clang.llvm.org/doxygen/classclang_1_1Preprocessor.html#ab6cb207d9606e228aac0ed63d529cfa2 [ http://clang.llvm.org/doxygen/classclang_1_1Preprocessor.html#ab6cb207d9606e228aac0ed63d529cfa2 ])
- bool HeaderSearch::isFileMultipleIncludeGuarded (const FileEntry * File) (http://clang.llvm.org/doxygen/classclang_1_1HeaderSearch.html#a46e7c5c402dad28ed7df35b51ff66dd1 [ http://clang.llvm.org/doxygen/classclang_1_1HeaderSearch.html#a46e7c5c402dad28ed7df35b51ff66dd1 ])
- CINDEX_LINKAGE unsigned clang_isFileMultipleIncludeGuarded (http://clang.llvm.org/doxygen/group__CINDEX__FILES.html#ga1969fe907a40d9469ea68c370d0f602a [ http://clang.llvm.org/doxygen/group__CINDEX__FILES.html#ga1969fe907a40d9469ea68c370d0f602a ])
   
What is the simplest way to check this?

Cheers.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150221/d7583bf5/attachment.html>


More information about the cfe-dev mailing list