Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 3d65864

Browse files
committed
Add svn:eol-style=native to some files
Correct two files with inconsistent lines endings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64564 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent f3710ba commit 3d65864

19 files changed

+2729
-2729
lines changed

lib/Sema/SemaCXXScopeSpec.cpp

+106-106
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,106 @@
1-
//===--- SemaCXXScopeSpec.cpp - Semantic Analysis for C++ scope specifiers-===//
2-
//
3-
// The LLVM Compiler Infrastructure
4-
//
5-
// This file is distributed under the University of Illinois Open Source
6-
// License. See LICENSE.TXT for details.
7-
//
8-
//===----------------------------------------------------------------------===//
9-
//
10-
// This file implements C++ semantic analysis for scope specifiers.
11-
//
12-
//===----------------------------------------------------------------------===//
13-
14-
#include "Sema.h"
15-
#include "clang/AST/ASTContext.h"
16-
#include "clang/Parse/DeclSpec.h"
17-
#include "llvm/ADT/STLExtras.h"
18-
using namespace clang;
19-
20-
21-
/// ActOnCXXGlobalScopeSpecifier - Return the object that represents the
22-
/// global scope ('::').
23-
Sema::CXXScopeTy *Sema::ActOnCXXGlobalScopeSpecifier(Scope *S,
24-
SourceLocation CCLoc) {
25-
return cast<DeclContext>(Context.getTranslationUnitDecl());
26-
}
27-
28-
/// ActOnCXXNestedNameSpecifier - Called during parsing of a
29-
/// nested-name-specifier. e.g. for "foo::bar::" we parsed "foo::" and now
30-
/// we want to resolve "bar::". 'SS' is empty or the previously parsed
31-
/// nested-name part ("foo::"), 'IdLoc' is the source location of 'bar',
32-
/// 'CCLoc' is the location of '::' and 'II' is the identifier for 'bar'.
33-
/// Returns a CXXScopeTy* object representing the C++ scope.
34-
Sema::CXXScopeTy *Sema::ActOnCXXNestedNameSpecifier(Scope *S,
35-
const CXXScopeSpec &SS,
36-
SourceLocation IdLoc,
37-
SourceLocation CCLoc,
38-
IdentifierInfo &II) {
39-
NamedDecl *SD = LookupParsedName(S, &SS, &II, LookupNestedNameSpecifierName);
40-
41-
if (SD) {
42-
if (TypedefDecl *TD = dyn_cast<TypedefDecl>(SD)) {
43-
if (const RecordType* Record = TD->getUnderlyingType()->getAsRecordType())
44-
return cast<DeclContext>(Record->getDecl());
45-
} else if (isa<NamespaceDecl>(SD) || isa<RecordDecl>(SD)) {
46-
return cast<DeclContext>(SD);
47-
}
48-
49-
// FIXME: Template parameters and dependent types.
50-
// FIXME: C++0x scoped enums
51-
52-
// Fall through to produce an error: we found something that isn't
53-
// a class or a namespace.
54-
}
55-
56-
// If we didn't find anything during our lookup, try again with
57-
// ordinary name lookup, which can help us produce better error
58-
// messages.
59-
if (!SD)
60-
SD = LookupParsedName(S, &SS, &II, LookupOrdinaryName);
61-
unsigned DiagID;
62-
if (SD)
63-
DiagID = diag::err_expected_class_or_namespace;
64-
else if (SS.isSet())
65-
DiagID = diag::err_typecheck_no_member;
66-
else
67-
DiagID = diag::err_undeclared_var_use;
68-
69-
if (SS.isSet())
70-
Diag(IdLoc, DiagID) << &II << SS.getRange();
71-
else
72-
Diag(IdLoc, DiagID) << &II;
73-
74-
return 0;
75-
}
76-
77-
/// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
78-
/// scope or nested-name-specifier) is parsed, part of a declarator-id.
79-
/// After this method is called, according to [C++ 3.4.3p3], names should be
80-
/// looked up in the declarator-id's scope, until the declarator is parsed and
81-
/// ActOnCXXExitDeclaratorScope is called.
82-
/// The 'SS' should be a non-empty valid CXXScopeSpec.
83-
void Sema::ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
84-
assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
85-
assert(PreDeclaratorDC == 0 && "Previous declarator context not popped?");
86-
PreDeclaratorDC = static_cast<DeclContext*>(S->getEntity());
87-
CurContext = static_cast<DeclContext*>(SS.getScopeRep());
88-
S->setEntity(CurContext);
89-
}
90-
91-
/// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
92-
/// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
93-
/// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
94-
/// Used to indicate that names should revert to being looked up in the
95-
/// defining scope.
96-
void Sema::ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
97-
assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
98-
assert(S->getEntity() == SS.getScopeRep() && "Context imbalance!");
99-
S->setEntity(PreDeclaratorDC);
100-
PreDeclaratorDC = 0;
101-
102-
// Reset CurContext to the nearest enclosing context.
103-
while (!S->getEntity() && S->getParent())
104-
S = S->getParent();
105-
CurContext = static_cast<DeclContext*>(S->getEntity());
106-
}
1+
//===--- SemaCXXScopeSpec.cpp - Semantic Analysis for C++ scope specifiers-===//
2+
//
3+
// The LLVM Compiler Infrastructure
4+
//
5+
// This file is distributed under the University of Illinois Open Source
6+
// License. See LICENSE.TXT for details.
7+
//
8+
//===----------------------------------------------------------------------===//
9+
//
10+
// This file implements C++ semantic analysis for scope specifiers.
11+
//
12+
//===----------------------------------------------------------------------===//
13+
14+
#include "Sema.h"
15+
#include "clang/AST/ASTContext.h"
16+
#include "clang/Parse/DeclSpec.h"
17+
#include "llvm/ADT/STLExtras.h"
18+
using namespace clang;
19+
20+
21+
/// ActOnCXXGlobalScopeSpecifier - Return the object that represents the
22+
/// global scope ('::').
23+
Sema::CXXScopeTy *Sema::ActOnCXXGlobalScopeSpecifier(Scope *S,
24+
SourceLocation CCLoc) {
25+
return cast<DeclContext>(Context.getTranslationUnitDecl());
26+
}
27+
28+
/// ActOnCXXNestedNameSpecifier - Called during parsing of a
29+
/// nested-name-specifier. e.g. for "foo::bar::" we parsed "foo::" and now
30+
/// we want to resolve "bar::". 'SS' is empty or the previously parsed
31+
/// nested-name part ("foo::"), 'IdLoc' is the source location of 'bar',
32+
/// 'CCLoc' is the location of '::' and 'II' is the identifier for 'bar'.
33+
/// Returns a CXXScopeTy* object representing the C++ scope.
34+
Sema::CXXScopeTy *Sema::ActOnCXXNestedNameSpecifier(Scope *S,
35+
const CXXScopeSpec &SS,
36+
SourceLocation IdLoc,
37+
SourceLocation CCLoc,
38+
IdentifierInfo &II) {
39+
NamedDecl *SD = LookupParsedName(S, &SS, &II, LookupNestedNameSpecifierName);
40+
41+
if (SD) {
42+
if (TypedefDecl *TD = dyn_cast<TypedefDecl>(SD)) {
43+
if (const RecordType* Record = TD->getUnderlyingType()->getAsRecordType())
44+
return cast<DeclContext>(Record->getDecl());
45+
} else if (isa<NamespaceDecl>(SD) || isa<RecordDecl>(SD)) {
46+
return cast<DeclContext>(SD);
47+
}
48+
49+
// FIXME: Template parameters and dependent types.
50+
// FIXME: C++0x scoped enums
51+
52+
// Fall through to produce an error: we found something that isn't
53+
// a class or a namespace.
54+
}
55+
56+
// If we didn't find anything during our lookup, try again with
57+
// ordinary name lookup, which can help us produce better error
58+
// messages.
59+
if (!SD)
60+
SD = LookupParsedName(S, &SS, &II, LookupOrdinaryName);
61+
unsigned DiagID;
62+
if (SD)
63+
DiagID = diag::err_expected_class_or_namespace;
64+
else if (SS.isSet())
65+
DiagID = diag::err_typecheck_no_member;
66+
else
67+
DiagID = diag::err_undeclared_var_use;
68+
69+
if (SS.isSet())
70+
Diag(IdLoc, DiagID) << &II << SS.getRange();
71+
else
72+
Diag(IdLoc, DiagID) << &II;
73+
74+
return 0;
75+
}
76+
77+
/// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
78+
/// scope or nested-name-specifier) is parsed, part of a declarator-id.
79+
/// After this method is called, according to [C++ 3.4.3p3], names should be
80+
/// looked up in the declarator-id's scope, until the declarator is parsed and
81+
/// ActOnCXXExitDeclaratorScope is called.
82+
/// The 'SS' should be a non-empty valid CXXScopeSpec.
83+
void Sema::ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
84+
assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
85+
assert(PreDeclaratorDC == 0 && "Previous declarator context not popped?");
86+
PreDeclaratorDC = static_cast<DeclContext*>(S->getEntity());
87+
CurContext = static_cast<DeclContext*>(SS.getScopeRep());
88+
S->setEntity(CurContext);
89+
}
90+
91+
/// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
92+
/// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
93+
/// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
94+
/// Used to indicate that names should revert to being looked up in the
95+
/// defining scope.
96+
void Sema::ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
97+
assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
98+
assert(S->getEntity() == SS.getScopeRep() && "Context imbalance!");
99+
S->setEntity(PreDeclaratorDC);
100+
PreDeclaratorDC = 0;
101+
102+
// Reset CurContext to the nearest enclosing context.
103+
while (!S->getEntity() && S->getParent())
104+
S = S->getParent();
105+
CurContext = static_cast<DeclContext*>(S->getEntity());
106+
}

test/Parser/cxx-condition.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// RUN: clang -parse-noop -verify %s
2-
3-
void f() {
4-
int a;
5-
while (a) ;
6-
while (int x) ; // expected-error {{expected '=' after declarator}}
7-
while (float x = 0) ;
8-
if (const int x = a) ;
9-
switch (int x = a+10) {}
10-
for (; int x = ++a; ) ;
11-
}
1+
// RUN: clang -parse-noop -verify %s
2+
3+
void f() {
4+
int a;
5+
while (a) ;
6+
while (int x) ; // expected-error {{expected '=' after declarator}}
7+
while (float x = 0) ;
8+
if (const int x = a) ;
9+
switch (int x = a+10) {}
10+
for (; int x = ++a; ) ;
11+
}

test/Parser/cxx-variadic-func.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: clang -fsyntax-only %s
2-
3-
void f(...) {
4-
int g(int(...));
5-
}
1+
// RUN: clang -fsyntax-only %s
2+
3+
void f(...) {
4+
int g(int(...));
5+
}

test/SemaCXX/class-names.cpp

+52-52
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
// RUN: clang -fsyntax-only -verify %s
2-
class C { };
3-
4-
C c;
5-
6-
void D(int);
7-
8-
class D {}; // expected-note {{previous use is here}}
9-
10-
void foo()
11-
{
12-
D(5);
13-
class D d;
14-
}
15-
16-
class D;
17-
18-
enum D; // expected-error {{use of 'D' with tag type that does not match previous declaration}}
19-
20-
class A * A;
21-
22-
class A * a2;
23-
24-
void bar()
25-
{
26-
A = 0;
27-
}
28-
29-
void C(int);
30-
31-
void bar2()
32-
{
33-
C(17);
34-
}
35-
36-
extern int B;
37-
class B;
38-
class B {};
39-
int B;
40-
41-
enum E { e1_val };
42-
E e1;
43-
44-
void E(int);
45-
46-
void bar3() {
47-
E(17);
48-
}
49-
50-
enum E e2;
51-
52-
enum E2 { E2 };
1+
// RUN: clang -fsyntax-only -verify %s
2+
class C { };
3+
4+
C c;
5+
6+
void D(int);
7+
8+
class D {}; // expected-note {{previous use is here}}
9+
10+
void foo()
11+
{
12+
D(5);
13+
class D d;
14+
}
15+
16+
class D;
17+
18+
enum D; // expected-error {{use of 'D' with tag type that does not match previous declaration}}
19+
20+
class A * A;
21+
22+
class A * a2;
23+
24+
void bar()
25+
{
26+
A = 0;
27+
}
28+
29+
void C(int);
30+
31+
void bar2()
32+
{
33+
C(17);
34+
}
35+
36+
extern int B;
37+
class B;
38+
class B {};
39+
int B;
40+
41+
enum E { e1_val };
42+
E e1;
43+
44+
void E(int);
45+
46+
void bar3() {
47+
E(17);
48+
}
49+
50+
enum E e2;
51+
52+
enum E2 { E2 };

test/SemaCXX/do-while-scope.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: clang -fsyntax-only -verify %s
22

33
void test() {
4-
int x;
5-
do
6-
int x;
7-
while (1);
4+
int x;
5+
do
6+
int x;
7+
while (1);
88
}

0 commit comments

Comments
 (0)