#include <filename>和#inlude特定于LLVM / Clang的“文件名”之间有什么区别?

Brandones

#include <filename>之间的区别#include "filename"是特定编译器实现的(#include <filename>和#include“ filename”之间的区别是什么?)。GCC对此的实现已被详细记录(http://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html)。对于Visual C ++,存在类似的文档。

使用LLVM / Clang编译时对应的规则是什么?即,在使用每种语法时Clang会首先出现在哪里和/或不在哪里出现?

胡安·法科罗

在文档中找不到任何可以指定每种情况下预期行为的内容,因此我很好奇并决定查看此处的代码假设这是始终存在的行为可能是错误的,但是如果没有文档,我认为源代码是次要的事情。

搜索代码后,我发现在这里方法中#include处理编译指示(第453行),在该处确定是否包含(第468行),然后将该值用作方法的参数(第477行)。HandlePragmaDependencyisAngledLookupFile()

此方法在HeaderSearch.cpp(第498行)中定义,文档注释指出:

[...] isAngled指示文件引用是否适用于系统#include的引用(即,使用<>代替“”)。[...]

在该方法的后面,isAngled在三个地方(第547、596和673行)中使用的值,每个地方都有以下注释。

  // Unless disabled, check to see if the file is in the #includer's
  // directory.  This cannot be based on CurDir, because each includer could be
  // a #include of a subdirectory (#include "foo/bar.h") and a subsequent
  // include of "baz.h" should resolve to "whatever/foo/baz.h".
  // This search is not done for <> headers.
  if (!Includers.empty() && !isAngled && !NoCurDirSearch) {

  ...

  // If this is a system #include, ignore the user #include locs.
  unsigned i = isAngled ? AngledDirIdx : 0;

  ...

  // If we are including a file with a quoted include "foo.h" from inside
  // a header in a framework that is currently being built, and we couldn't
  // resolve "foo.h" any other way, change the include to <Foo/foo.h>, where
  // "Foo" is the name of the framework in which the including header was found.
  if (!Includers.empty() && !isAngled &&
      Filename.find('/') == StringRef::npos) {

希望能帮助到你。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

#include <文件名>和#include“文件名”之间的区别

来自分类Dev

#include和复制粘贴之间有什么区别?

来自分类Dev

Linux中filename和./filename有什么区别

来自分类Dev

Linux命令行中cat> filename和cat >> filename之间有什么区别

来自分类Dev

include标签和include函数有什么区别?

来自分类Dev

“ cat <文件名”和“ cat文件名”有什么区别?

来自分类Dev

“ cat <文件名”和“ cat文件名”有什么区别?

来自分类Dev

“ include_examples”和“ it_behaves_like”之间有什么区别?

来自分类Dev

在Java的Dagger中,addsTo和include之间有什么区别?

来自分类Dev

android中的<include>和<ViewStub>标签之间有什么区别?

来自分类Dev

android中的<include>和<ViewStub>标签之间有什么区别?

来自分类Dev

#include和复制并粘贴有什么区别?

来自分类Dev

Jade中的“ extends”和“ include”有什么区别?

来自分类Dev

C中的#import和#include有什么区别?

来自分类Dev

Twig中的include和block有什么区别?

来自分类Dev

clang(和LLVM)和gcc / g ++有什么区别?

来自分类Dev

Include和Include()之间的差异

来自分类Dev

@interface <文件名>:NSObject和@interface NSObject(文件名)之间的区别是什么?

来自分类Dev

clang(和LLVM)与gcc / g ++有什么区别?

来自分类Dev

R中的stringr:当filename和filename.extension共享公共字符时,从filename.extension中提取文件名

来自分类Dev

为什么$ <filename不能从`filename`运行cmd而是$`<filename`和$ exec <filename起作用?

来自分类Dev

torrent文件和Magnet链接之间有什么区别?

来自分类Dev

'2>&1'和'&> filename'之间的区别

来自分类Dev

“ Range#include?”和“ Range#cover?”有什么区别?

来自分类Dev

PHP中的“ include_once”和“ require_once”有什么区别?

来自分类Dev

为什么grep -r --include = *。js *> dirname / .filename不能将所有.js文件写入单个文件?

来自分类Dev

/ usr / include / sys和/ usr / include / linux之间的区别?

来自分类Dev

/ usr / include / sys和/ usr / include / linux之间的区别?

来自分类Dev

Twig中{%include''%}和{{include('')}}之间的差异

Related 相关文章

  1. 1

    #include <文件名>和#include“文件名”之间的区别

  2. 2

    #include和复制粘贴之间有什么区别?

  3. 3

    Linux中filename和./filename有什么区别

  4. 4

    Linux命令行中cat> filename和cat >> filename之间有什么区别

  5. 5

    include标签和include函数有什么区别?

  6. 6

    “ cat <文件名”和“ cat文件名”有什么区别?

  7. 7

    “ cat <文件名”和“ cat文件名”有什么区别?

  8. 8

    “ include_examples”和“ it_behaves_like”之间有什么区别?

  9. 9

    在Java的Dagger中,addsTo和include之间有什么区别?

  10. 10

    android中的<include>和<ViewStub>标签之间有什么区别?

  11. 11

    android中的<include>和<ViewStub>标签之间有什么区别?

  12. 12

    #include和复制并粘贴有什么区别?

  13. 13

    Jade中的“ extends”和“ include”有什么区别?

  14. 14

    C中的#import和#include有什么区别?

  15. 15

    Twig中的include和block有什么区别?

  16. 16

    clang(和LLVM)和gcc / g ++有什么区别?

  17. 17

    Include和Include()之间的差异

  18. 18

    @interface <文件名>:NSObject和@interface NSObject(文件名)之间的区别是什么?

  19. 19

    clang(和LLVM)与gcc / g ++有什么区别?

  20. 20

    R中的stringr:当filename和filename.extension共享公共字符时,从filename.extension中提取文件名

  21. 21

    为什么$ <filename不能从`filename`运行cmd而是$`<filename`和$ exec <filename起作用?

  22. 22

    torrent文件和Magnet链接之间有什么区别?

  23. 23

    '2>&1'和'&> filename'之间的区别

  24. 24

    “ Range#include?”和“ Range#cover?”有什么区别?

  25. 25

    PHP中的“ include_once”和“ require_once”有什么区别?

  26. 26

    为什么grep -r --include = *。js *> dirname / .filename不能将所有.js文件写入单个文件?

  27. 27

    / usr / include / sys和/ usr / include / linux之间的区别?

  28. 28

    / usr / include / sys和/ usr / include / linux之间的区别?

  29. 29

    Twig中{%include''%}和{{include('')}}之间的差异

热门标签

归档