diff options
author | Manuel Klimek <klimek@google.com> | 2016-03-01 10:56:19 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2016-03-01 10:56:19 +0000 |
commit | ac0a11ae22d93e452b579b2adf6af933c49f9616 (patch) | |
tree | 6ca9dade319f3dc573c057c90fabbe555cb1e75a /test/Index/keep-going.cpp | |
parent | 77355c758454c64d032a13df8a51a9ec9840d095 (diff) |
Optionally demote fatal errors to non-fatal errors.
This behavior is enabled when the new CXTranslationUnit_KeepGoing
option is passed to clang_parseTranslationUnit{,2}. It is geared
towards use by IDEs and similar consumers of the clang-c API where
fatal errors may arise when parsing incomplete code mid-edit, or
when include paths are not properly configured yet. In such situations
one still wants to get as much information as possible about a TU.
Previously, the semantic analysis would not instantiate templates
or report additional fatal errors after the first fatal error was
encountered.
Fixes PR24268.
Patch by Milian Wolff.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/keep-going.cpp')
-rw-r--r-- | test/Index/keep-going.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Index/keep-going.cpp b/test/Index/keep-going.cpp new file mode 100644 index 0000000000..9bf23947d1 --- /dev/null +++ b/test/Index/keep-going.cpp @@ -0,0 +1,29 @@ +#include "missing1.h" + +template<class T> +class A { T a; }; + +class B : public A<int> { }; + +#include "missing2.h" + +class C : public A<float> { }; + +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_KEEP_GOING=1 c-index-test -test-print-type %s 2> %t.stderr.txt | FileCheck %s +// RUN: FileCheck -check-prefix CHECK-DIAG %s < %t.stderr.txt + +// CHECK: inclusion directive=missing1.h ((null)) [type=] [typekind=Invalid] [isPOD=0] +// CHECK: inclusion directive=missing2.h ((null)) [type=] [typekind=Invalid] [isPOD=0] +// CHECK: ClassTemplate=A:4:7 (Definition) [type=] [typekind=Invalid] [isPOD=0] +// CHECK: TemplateTypeParameter=T:3:16 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] +// CHECK: FieldDecl=a:4:13 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] +// CHECK: TypeRef=T:3:16 [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] +// CHECK: ClassDecl=B:6:7 (Definition) [type=B] [typekind=Record] [isPOD=0] +// CHECK: C++ base class specifier=A<int>:4:7 [access=public isVirtual=false] [type=A<int>] [typekind=Unexposed] [canonicaltype=A<int>] [canonicaltypekind=Record] [templateargs/1= [type=int] [typekind=Int]] [isPOD=0] [nbFields=1] +// CHECK: TemplateRef=A:4:7 [type=] [typekind=Invalid] [isPOD=0] +// CHECK: ClassDecl=C:10:7 (Definition) [type=C] [typekind=Record] [isPOD=0] +// CHECK: C++ base class specifier=A<float>:4:7 [access=public isVirtual=false] [type=A<float>] [typekind=Unexposed] [canonicaltype=A<float>] [canonicaltypekind=Record] [templateargs/1= [type=float] [typekind=Float]] [isPOD=0] [nbFields=1] +// CHECK: TemplateRef=A:4:7 [type=] [typekind=Invalid] [isPOD=0] + +// CHECK-DIAG: keep-going.cpp:1:10: error: 'missing1.h' file not found +// CHECK-DIAG: keep-going.cpp:8:10: error: 'missing2.h' file not found |